From a459f111d85598df56c6ab711cec11632676b39c Mon Sep 17 00:00:00 2001 From: idfx Date: Mon, 21 Apr 2003 12:42:45 +0000 Subject: [PATCH] Organizing import, refresh the license (zapata deleted cos.jar) --- source/Mir.java | 925 +++++++------- source/OpenMir.java | 46 +- source/mir/config/MirPropertiesConfiguration.java | 20 +- source/mir/entity/Entity.java | 30 +- source/mir/entity/EntityBrowser.java | 19 +- source/mir/entity/EntityList.java | 20 +- source/mir/entity/EntityRelation.java | 20 +- source/mir/entity/GenericEntity.java | 23 +- source/mir/entity/StorableObjectEntity.java | 20 +- source/mir/entity/adapter/EntityAdapter.java | 20 +- .../entity/adapter/EntityAdapterDefinition.java | 20 +- source/mir/entity/adapter/EntityAdapterExc.java | 20 +- source/mir/entity/adapter/EntityAdapterModel.java | 20 +- .../mir/entity/adapter/EntityIteratorAdapter.java | 20 +- source/mir/entity/adapter/EntityListAdapter.java | 20 +- .../mir/generator/CompositeGeneratorLibrary.java | 22 +- source/mir/generator/FreemarkerGenerator.java | 62 +- source/mir/generator/Generator.java | 25 +- source/mir/generator/GeneratorExc.java | 20 +- source/mir/generator/GeneratorFailure.java | 20 +- .../mir/generator/GeneratorLibraryRepository.java | 20 +- source/mir/generator/WriterEngine.java | 19 +- source/mir/log/Log.java | 19 +- source/mir/log/Logger.java | 19 +- source/mir/log/LoggerToWriterAdapter.java | 19 +- source/mir/log/LoggerWrapper.java | 20 +- source/mir/log/TestFramework.java | 19 +- source/mir/log/log4j/LoggerImpl.java | 20 +- source/mir/media/MediaExc.java | 19 +- source/mir/media/MediaFailure.java | 20 +- source/mir/media/MediaHelper.java | 20 +- source/mir/media/MirMedia.java | 22 +- source/mir/misc/ConfigException.java | 21 +- source/mir/misc/FileUtil.java | 20 +- source/mir/misc/HTMLParseException.java | 20 +- source/mir/misc/HTMLTemplateProcessor.java | 770 ++++++------ source/mir/misc/LineFilterWriter.java | 20 +- source/mir/misc/Location.java | 22 +- source/mir/misc/MpRequest.java | 73 -- source/mir/misc/NumberUtils.java | 22 +- source/mir/misc/PDFUtil.java | 22 +- source/mir/misc/StringUtil.java | 22 +- source/mir/misc/WebdbImage.java | 24 +- source/mir/module/AbstractModule.java | 20 +- source/mir/module/ModuleExc.java | 20 +- source/mir/module/ModuleFailure.java | 20 +- source/mir/producer/AssignmentProducerNode.java | 20 +- source/mir/producer/CompositeProducerNode.java | 20 +- source/mir/producer/ConditionalProducerNode.java | 20 +- source/mir/producer/DirCopyingProducerNode.java | 20 +- .../mir/producer/EntityBatchingProducerNode.java | 20 +- .../producer/EntityEnumeratingProducerNode.java | 20 +- source/mir/producer/EntityListProducerNode.java | 20 +- .../mir/producer/EntityModifyingProducerNode.java | 20 +- .../producer/EvaluatedAssignmentProducerNode.java | 20 +- .../producer/ExpandedAssignmentProducerNode.java | 20 +- .../mir/producer/FileDateSettingProducerNode.java | 20 +- source/mir/producer/FileDeletingProducerNode.java | 20 +- source/mir/producer/FileOperationProducerNode.java | 20 +- source/mir/producer/GeneratingProducerNode.java | 22 +- source/mir/producer/LoggingProducerNode.java | 20 +- source/mir/producer/LoopProducerNode.java | 20 +- source/mir/producer/NodedProducer.java | 20 +- source/mir/producer/NodedProducerFactory.java | 20 +- source/mir/producer/Producer.java | 20 +- source/mir/producer/ProducerExc.java | 20 +- source/mir/producer/ProducerFactory.java | 20 +- source/mir/producer/ProducerFailure.java | 20 +- source/mir/producer/ProducerNode.java | 20 +- source/mir/producer/ProducerNodeDecorator.java | 20 +- source/mir/producer/RSSProducerNode.java | 22 +- .../mir/producer/ResourceBundleProducerNode.java | 20 +- source/mir/producer/ScriptCallingProducerNode.java | 20 +- source/mir/producer/SimpleProducerVerb.java | 20 +- source/mir/producer/ValuesMapProducerNode.java | 20 +- .../reader/DefaultProducerNodeBuilders.java | 20 +- source/mir/producer/reader/ProducerConfigExc.java | 20 +- .../mir/producer/reader/ProducerConfigFailure.java | 21 +- .../mir/producer/reader/ProducerConfigReader.java | 20 +- .../mir/producer/reader/ProducerNodeBuilder.java | 20 +- .../reader/ProducerNodeBuilderLibrary.java | 20 +- .../producer/reader/ScriptedProducerFactory.java | 20 +- .../mir/producer/reader/ScriptedProducerNode.java | 20 +- .../reader/ScriptedProducerNodeDefinition.java | 20 +- .../producer/reader/ScriptedProducerNodeTool.java | 20 +- source/mir/rss/RSSChannel.java | 23 +- source/mir/rss/RSSData.java | 20 +- source/mir/rss/RSSExc.java | 20 +- source/mir/rss/RSSFailure.java | 20 +- source/mir/rss/RSSItem.java | 21 +- source/mir/rss/RSSReader.java | 20 +- source/mir/rss/RSSToMapConverter.java | 26 +- source/mir/servlet/AbstractServlet.java | 30 +- source/mir/servlet/ServletModule.java | 25 +- source/mir/servlet/ServletModuleDispatch.java | 26 +- source/mir/servlet/ServletModuleExc.java | 20 +- source/mir/servlet/ServletModuleFailure.java | 20 +- source/mir/servlet/ServletModuleShow.java | 20 +- source/mir/servlet/ServletModuleUserExc.java | 20 +- source/mir/session/CommonsUploadedFileAdapter.java | 20 +- source/mir/session/HTTPAdapters.java | 24 +- source/mir/session/Request.java | 20 +- source/mir/session/Response.java | 21 +- source/mir/session/Session.java | 20 +- source/mir/session/SessionExc.java | 20 +- source/mir/session/SessionFailure.java | 20 +- source/mir/session/SessionHandler.java | 20 +- source/mir/session/SimpleResponse.java | 20 +- source/mir/session/UploadedFile.java | 20 +- source/mir/storage/Database.java | 21 +- source/mir/storage/DatabaseAdaptor.java | 21 +- source/mir/storage/DatabaseAdaptorMySQL.java | 19 +- source/mir/storage/DatabaseAdaptorOracle.java | 22 +- source/mir/storage/DatabaseAdaptorPostgresql.java | 19 +- source/mir/storage/DatabaseAdaptorSybase.java | 22 +- source/mir/storage/DatabaseCache.java | 163 --- source/mir/storage/StorageObject.java | 24 +- source/mir/storage/StorageObjectExc.java | 19 +- source/mir/storage/StorageObjectFailure.java | 19 +- source/mir/storage/store/ObjectStore.java | 20 +- source/mir/storage/store/ServletStoreInfo.java | 20 +- source/mir/storage/store/StorableObject.java | 20 +- source/mir/storage/store/StoreContainer.java | 19 +- source/mir/storage/store/StoreContainerType.java | 20 +- source/mir/storage/store/StoreIdentifier.java | 20 +- source/mir/storage/store/StoreUtil.java | 20 +- source/mir/storage/store/test/EntityC1.java | 20 +- source/mir/storage/store/test/EntityC2.java | 20 +- source/mir/storage/store/test/EntityC3.java | 20 +- source/mir/storage/store/test/TestStore.java | 20 +- source/mir/util/CachingRewindableIterator.java | 20 +- source/mir/util/DateToMapAdapter.java | 20 +- source/mir/util/ExceptionFunctions.java | 20 +- source/mir/util/FileFunctions.java | 26 +- source/mir/util/FileMonitor.java | 20 +- source/mir/util/GeneratorExpressionFunctions.java | 30 +- source/mir/util/GeneratorHTMLFunctions.java | 20 +- source/mir/util/GeneratorIntegerFunctions.java | 20 +- source/mir/util/GeneratorListFunctions.java | 20 +- .../util/GeneratorRegularExpressionFunctions.java | 20 +- source/mir/util/GeneratorStringFunctions.java | 20 +- source/mir/util/HTMLRoutines.java | 19 +- source/mir/util/HTTPParsedRequest.java | 24 +- source/mir/util/HTTPRequestParser.java | 177 ++- source/mir/util/JDBCStringRoutines.java | 20 +- source/mir/util/NullWriter.java | 20 +- source/mir/util/ParameterExpander.java | 20 +- source/mir/util/PropertiesManipulator.java | 20 +- .../mir/util/ResourceBundleGeneratorFunction.java | 185 ++- source/mir/util/RewindableIterator.java | 19 +- source/mir/util/SQLQueryBuilder.java | 19 +- source/mir/util/SimpleParser.java | 19 +- source/mir/util/StringParseRoutines.java | 19 +- source/mir/util/StringRoutines.java | 422 ++++--- source/mir/util/SubsetIterator.java | 20 +- source/mir/util/URLBuilder.java | 20 +- source/mir/util/UtilExc.java | 20 +- source/mir/util/UtilFailure.java | 20 +- source/mir/util/XMLReader.java | 26 +- source/mir/util/XMLReaderTool.java | 24 +- source/mir/xml/SaxContext.java | 20 +- source/mir/xml/XmlConfigurator.java | 20 +- source/mir/xml/XmlMatch.java | 19 +- source/mircoders/entity/EntityAudio.java | 23 +- source/mircoders/entity/EntityComment.java | 261 ++-- source/mircoders/entity/EntityContent.java | 21 +- source/mircoders/entity/EntityFeature.java | 19 +- source/mircoders/entity/EntityImages.java | 21 +- source/mircoders/entity/EntityLinksImcs.java | 20 +- source/mircoders/entity/EntityMedia.java | 152 ++- source/mircoders/entity/EntityOther.java | 21 +- source/mircoders/entity/EntityTopics.java | 19 +- source/mircoders/entity/EntityUploadedMedia.java | 50 +- source/mircoders/entity/EntityUsers.java | 20 +- source/mircoders/entity/EntityVideo.java | 22 +- source/mircoders/global/Abuse.java | 1261 ++++++++++---------- source/mircoders/global/CacheKey.java | 20 +- source/mircoders/global/JobQueue.java | 19 +- source/mircoders/global/MRUCache.java | 244 ++-- source/mircoders/global/MirGlobal.java | 19 +- source/mircoders/global/ProducerEngine.java | 20 +- .../localizer/MirAdminInterfaceLocalizer.java | 20 +- .../localizer/MirCachingLocalizerDecorator.java | 19 +- .../mircoders/localizer/MirDataModelLocalizer.java | 19 +- .../mircoders/localizer/MirGeneratorLocalizer.java | 19 +- source/mircoders/localizer/MirLocalizer.java | 19 +- source/mircoders/localizer/MirLocalizerExc.java | 19 +- .../mircoders/localizer/MirLocalizerFailure.java | 19 +- .../localizer/MirOpenPostingLocalizer.java | 146 ++- .../localizer/MirProducerAssistantLocalizer.java | 20 +- .../mircoders/localizer/MirProducerLocalizer.java | 20 +- .../basic/MirBasicAdminInterfaceLocalizer.java | 20 +- .../MirBasicCommentPostingSessionHandler.java | 484 ++++---- .../basic/MirBasicDataModelLocalizer.java | 98 +- .../basic/MirBasicGeneratorLocalizer.java | 19 +- .../localizer/basic/MirBasicLocalizer.java | 20 +- .../basic/MirBasicOpenPostingLocalizer.java | 236 ++-- .../basic/MirBasicPostingSessionHandler.java | 690 ++++++----- .../basic/MirBasicProducerAssistantLocalizer.java | 54 +- .../localizer/basic/MirBasicProducerLocalizer.java | 22 +- .../localizer/basic/MirBasicWriterEngine.java | 20 +- source/mircoders/media/ImageProcessor.java | 19 +- source/mircoders/media/MediaHandlerAudio.java | 21 +- source/mircoders/media/MediaHandlerGeneric.java | 22 +- source/mircoders/media/MediaHandlerImages.java | 23 +- .../mircoders/media/MediaHandlerImagesExtern.java | 382 +++--- source/mircoders/media/MediaHandlerImagesJpeg.java | 23 +- source/mircoders/media/MediaHandlerImagesPng.java | 23 +- source/mircoders/media/MediaHandlerMp3.java | 22 +- source/mircoders/media/MediaHandlerRealAudio.java | 22 +- source/mircoders/media/MediaHandlerRealVideo.java | 22 +- source/mircoders/media/MediaHandlerVideo.java | 22 +- source/mircoders/media/MediaUploadProcessor.java | 21 +- .../mircoders/media/UnsupportedMediaFormatExc.java | 20 +- source/mircoders/module/ModuleArticleType.java | 20 +- source/mircoders/module/ModuleBreaking.java | 20 +- source/mircoders/module/ModuleComment.java | 20 +- source/mircoders/module/ModuleCommentStatus.java | 20 +- source/mircoders/module/ModuleContent.java | 19 +- source/mircoders/module/ModuleImages.java | 20 +- source/mircoders/module/ModuleLanguage.java | 20 +- source/mircoders/module/ModuleLinksImcs.java | 20 +- source/mircoders/module/ModuleMediaType.java | 172 +-- source/mircoders/module/ModuleMediafolder.java | 20 +- source/mircoders/module/ModuleMessage.java | 20 +- source/mircoders/module/ModuleTopics.java | 20 +- source/mircoders/module/ModuleUploadedMedia.java | 107 +- source/mircoders/module/ModuleUsers.java | 19 +- source/mircoders/pdf/PDFGenerator.java | 50 +- .../producer/ContentMarkingProducerNode.java | 20 +- .../producer/ContentModifyingProducerNode.java | 20 +- .../mircoders/producer/IndexingProducerNode.java | 20 +- .../producer/MediaGeneratingProducerNode.java | 19 +- .../producer/PDFGeneratingProducerNode.java | 19 +- .../producer/PDFPreFormattingProducerNode.java | 19 +- .../mircoders/producer/UnIndexingProducerNode.java | 20 +- .../reader/SupplementalProducerNodeBuilders.java | 20 +- source/mircoders/search/AudioSearchTerm.java | 19 +- source/mircoders/search/ContentSearchTerm.java | 21 +- source/mircoders/search/ImagesSearchTerm.java | 23 +- source/mircoders/search/IndexUtil.java | 20 +- source/mircoders/search/KeywordSearchTerm.java | 23 +- source/mircoders/search/MediaSearchTerm.java | 23 +- source/mircoders/search/SearchTerm.java | 19 +- source/mircoders/search/TextSearchTerm.java | 19 +- source/mircoders/search/TopicSearchTerm.java | 20 +- source/mircoders/search/UnIndexedSearchTerm.java | 20 +- source/mircoders/search/UnStoredSearchTerm.java | 20 +- source/mircoders/search/VideoSearchTerm.java | 19 +- source/mircoders/servlet/ServletHelper.java | 242 ++-- source/mircoders/servlet/ServletModuleAbuse.java | 360 +++--- source/mircoders/servlet/ServletModuleAdmin.java | 141 ++- .../servlet/ServletModuleArticleType.java | 20 +- source/mircoders/servlet/ServletModuleAudio.java | 20 +- .../mircoders/servlet/ServletModuleBreaking.java | 44 +- source/mircoders/servlet/ServletModuleComment.java | 632 +++++----- .../servlet/ServletModuleCommentStatus.java | 20 +- source/mircoders/servlet/ServletModuleContent.java | 30 +- .../mircoders/servlet/ServletModuleFileEdit.java | 26 +- source/mircoders/servlet/ServletModuleHidden.java | 20 +- source/mircoders/servlet/ServletModuleImages.java | 22 +- .../mircoders/servlet/ServletModuleLanguage.java | 20 +- .../mircoders/servlet/ServletModuleLinksImcs.java | 20 +- .../mircoders/servlet/ServletModuleLocalizer.java | 20 +- .../servlet/ServletModuleMediafolder.java | 20 +- source/mircoders/servlet/ServletModuleMessage.java | 231 ++-- .../mircoders/servlet/ServletModuleOpenIndy.java | 25 +- .../mircoders/servlet/ServletModuleOtherMedia.java | 19 +- .../mircoders/servlet/ServletModuleProducer.java | 21 +- source/mircoders/servlet/ServletModuleTopics.java | 19 +- .../servlet/ServletModuleUploadedMedia.java | 31 +- source/mircoders/servlet/ServletModuleUsers.java | 19 +- source/mircoders/servlet/ServletModuleVideo.java | 19 +- source/mircoders/storage/DatabaseArticleType.java | 145 ++- source/mircoders/storage/DatabaseAudio.java | 20 +- source/mircoders/storage/DatabaseBreaking.java | 19 +- source/mircoders/storage/DatabaseComment.java | 35 +- .../mircoders/storage/DatabaseCommentStatus.java | 19 +- .../mircoders/storage/DatabaseCommentToMedia.java | 21 +- source/mircoders/storage/DatabaseContent.java | 19 +- .../mircoders/storage/DatabaseContentToMedia.java | 21 +- .../mircoders/storage/DatabaseContentToTopics.java | 19 +- source/mircoders/storage/DatabaseImageColor.java | 19 +- source/mircoders/storage/DatabaseImageFormat.java | 19 +- source/mircoders/storage/DatabaseImageLayout.java | 19 +- source/mircoders/storage/DatabaseImageType.java | 20 +- source/mircoders/storage/DatabaseImages.java | 19 +- source/mircoders/storage/DatabaseLanguage.java | 19 +- source/mircoders/storage/DatabaseLinksImcs.java | 19 +- source/mircoders/storage/DatabaseMedia.java | 19 +- source/mircoders/storage/DatabaseMediaType.java | 20 +- source/mircoders/storage/DatabaseMediafolder.java | 19 +- source/mircoders/storage/DatabaseMessages.java | 23 +- source/mircoders/storage/DatabaseOther.java | 20 +- source/mircoders/storage/DatabaseRights.java | 19 +- source/mircoders/storage/DatabaseTopics.java | 19 +- .../mircoders/storage/DatabaseUploadedMedia.java | 19 +- source/mircoders/storage/DatabaseUsers.java | 19 +- source/mircoders/storage/DatabaseVideo.java | 19 +- source/tool/BundleTool.java | 543 +++++---- 300 files changed, 7176 insertions(+), 7884 deletions(-) delete mode 100755 source/mir/misc/MpRequest.java delete mode 100755 source/mir/storage/DatabaseCache.java diff --git a/source/Mir.java b/source/Mir.java index 9a93a655..4f904451 100755 --- a/source/Mir.java +++ b/source/Mir.java @@ -1,34 +1,33 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir 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 of the License, or - * (at your option) any later version. - * - * Mir 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 Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir 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 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ + import java.io.IOException; import java.io.PrintWriter; import java.lang.reflect.Method; @@ -39,18 +38,13 @@ import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Vector; + import javax.servlet.ServletException; import javax.servlet.UnavailableException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.apache.struts.util.MessageResources; -import freemarker.template.SimpleHash; -import freemarker.template.SimpleList; -import freemarker.template.SimpleScalar; -import freemarker.template.TemplateModel; - import mir.config.MirPropertiesConfiguration; import mir.entity.adapter.EntityIteratorAdapter; import mir.generator.FreemarkerGenerator; @@ -70,428 +64,435 @@ import mircoders.global.MirGlobal; import mircoders.module.ModuleMessage; import mircoders.module.ModuleUsers; import mircoders.servlet.ServletHelper; -import mircoders.storage.DatabaseUsers; - - - - -/** - * Mir.java - main servlet, that dispatches to servletmodules - * - * @author $Author: zapata $ - * @version $Id: Mir.java,v 1.44 2003/04/21 02:58:29 zapata Exp $ - * - */ -public class Mir extends AbstractServlet { - private static ModuleUsers usersModule = null; - private static ModuleMessage messageModule = null; - private final static Map servletModuleInstanceHash = new HashMap(); - private static Locale fallbackLocale = null; - - //I don't know about making this static cause it removes the - //possibility to change the config on the fly.. -mh - private static List loginLanguages = null; - - protected TemplateModel getLoginLanguages() throws ServletException { - synchronized (Mir.class) { - try { - if (loginLanguages == null) { - MessageResources messageResources = - MessageResources.getMessageResources("bundles.adminlocal"); - MessageResources messageResources2 = - MessageResources.getMessageResources("bundles.admin"); - - List languages = - StringRoutines.splitString(MirGlobal.config().getString("Mir.Login.Languages", "en"), ";"); - - loginLanguages = new Vector(); - - Iterator i = languages.iterator(); - - while (i.hasNext()) { - String code = (String) i.next(); - Locale locale = new Locale(code, ""); - String name = messageResources.getMessage(locale, "languagename"); - - if (name == null) { - name = messageResources2.getMessage(locale, "languagename"); - } - - if (name == null) { - name = code; - } - - Map record = new HashMap(); - record.put("name", name); - record.put("code", code); - loginLanguages.add(record); - } - } - - return FreemarkerGenerator.makeAdapter(loginLanguages); - } - catch (Throwable t) { - throw new ServletException(t.getMessage()); - } - } - } - - // FIXME: this should probalby go into AbstractServlet so it can be used in - // OpenMir as well -mh - protected String getDefaultLanguage(HttpServletRequest aRequest) { - String defaultlanguage = - MirGlobal.config().getString("Mir.Login.DefaultLanguage", ""); - - if (defaultlanguage.length() == 0) { - Locale locale = aRequest.getLocale(); - defaultlanguage = locale.getLanguage(); - } - - return defaultlanguage; - } - - protected synchronized Locale getFallbackLocale() throws ServletException { - try { - if (fallbackLocale == null) { - fallbackLocale = new Locale(MirPropertiesConfiguration.instance().getString("Mir.Admin.FallbackLanguage", "en"), ""); - } - } - catch (Throwable t) { - throw new ServletException(t.getMessage()); - } - - return fallbackLocale; - } - - public void process(HttpServletRequest aRequest, HttpServletResponse aResponse) - throws ServletException, IOException, UnavailableException { - long startTime = System.currentTimeMillis(); - long sessionConnectTime = 0; - EntityUsers userEntity; - HttpSession session; - String http = ""; - - configuration.addProperty("ServletName", getServletName()); - - session = aRequest.getSession(true); - userEntity = (EntityUsers) session.getAttribute("login.uid"); - - if (aRequest.getServerPort() == 443) { - http = "https"; - } else { - http = "http"; - } - - //make sure client browsers don't cache anything - setNoCaching(aResponse); - - //FIXME: this seems kind of hackish and only here because we can have - // default other than the one that the browser is set to. - Locale locale = new Locale(getDefaultLanguage(aRequest), ""); - String htmlcharset = "UTF-8"; - try { - htmlcharset = MirPropertiesConfiguration.instance().getString("Mir.DefaultHTMLCharset"); - } - catch (Throwable t) { - } - - aResponse.setContentType("text/html; charset=" + htmlcharset); - - String moduleName = aRequest.getParameter("module"); - checkLanguage(session, aRequest); - - - - // Authentication - if (((moduleName != null) && moduleName.equals("login")) || - (userEntity == null)) { - String user = aRequest.getParameter("login"); - String passwd = aRequest.getParameter("password"); - logger.debug("--login: evaluating for user: " + user); - userEntity = allowedUser(user, passwd); - - if (userEntity == null) { - // login failed: redirecting to login - logger.warn("--login: failed!"); - _sendLoginPage(aResponse, aRequest, aResponse.getWriter()); - - return; - } - else if ((moduleName != null) && moduleName.equals("login")) { - // login successful - logger.info("--login: successful! setting uid: " + userEntity.getId()); - session.setAttribute("login.uid", userEntity); - logger.debug("--login: trying to retrieve login.target"); - - String target = (String) session.getAttribute("login.target"); - - if (target != null) { - logger.debug("Redirect: " + target); - - int serverPort = aRequest.getServerPort(); - String redirect = ""; - String redirectString = ""; - - if (serverPort == 80) { - redirect = - aResponse.encodeURL(http + "://" + aRequest.getServerName() + target); - redirectString = - "going Mir"; - } else { - redirect = - aResponse.encodeURL(http + "://" + aRequest.getServerName() + ":" + - aRequest.getServerPort() + target); - redirectString = - "going Mir"; - } - - aResponse.getWriter().println(redirectString); - - //aResponse.sendRedirect(redirect); - } else { - // redirecting to default target - logger.debug("--login: no target - redirecting to default"); - _sendStartPage(aResponse, aRequest, aResponse.getWriter(), userEntity); - } - - return; - } - // if login succesful - } - // if login - - if ((moduleName != null) && moduleName.equals("logout")) { - logger.info("--logout"); - session.invalidate(); - - //session = aRequest.getSession(true); - //checkLanguage(session, aRequest); - _sendLoginPage(aResponse, aRequest, aResponse.getWriter()); - - return; - } - - // Check if authed! - if (userEntity == null) { - // redirect to loginpage - String redirectString = aRequest.getRequestURI(); - String queryString = aRequest.getQueryString(); - - if ((queryString != null) && !queryString.equals("")) { - redirectString += ("?" + aRequest.getQueryString()); - logger.debug("STORING: " + redirectString); - session.setAttribute("login.target", redirectString); - } - - _sendLoginPage(aResponse, aRequest, aResponse.getWriter()); - - return; - } - - // If no module is specified goto standard startpage - if ((moduleName == null) || moduleName.equals("")) { - logger.debug("no module: redirect to standardpage"); - _sendStartPage(aResponse, aRequest, aResponse.getWriter(), userEntity); - - return; - } - - // end of auth - // From now on regular dispatching... - try { - // get servletmodule by parameter and continue with dispacher - ServletModule smod = getServletModuleForName(moduleName); - ServletModuleDispatch.dispatch(smod, aRequest, aResponse); - } - catch (Throwable e) { - Throwable cause = ExceptionFunctions.traceCauseException(e); - - if (cause instanceof ServletModuleUserExc) - handleUserError(aRequest, aResponse, aResponse.getWriter(), (ServletModuleUserExc) cause); - else - handleError(aRequest, aResponse, aResponse.getWriter(), cause); - - } - - // timing... - sessionConnectTime = System.currentTimeMillis() - startTime; - logger.info("EXECTIME (" + moduleName + "): " + sessionConnectTime + " ms"); - } - - /** - * Private method getServletModuleForName returns ServletModule - * from Cache - * - * @param moduleName - * @return ServletModule - * - */ - private static ServletModule getServletModuleForName(String moduleName) throws ServletModuleExc { - // Instance in Map ? - if (!servletModuleInstanceHash.containsKey(moduleName)) { - // was not found in hash... - try { - Class theServletModuleClass = null; - - try { - // first we try to get ServletModule from stern.che3.servlet - theServletModuleClass = - Class.forName("mircoders.servlet.ServletModule" + moduleName); - } catch (ClassNotFoundException e) { - // on failure, we try to get it from lib-layer - theServletModuleClass = - Class.forName("mir.servlet.ServletModule" + moduleName); - } - - Method m = theServletModuleClass.getMethod("getInstance", null); - ServletModule smod = (ServletModule) m.invoke(null, null); - - // we put it into map for further reference - servletModuleInstanceHash.put(moduleName, smod); - - return smod; - } - catch (Exception e) { - throw new ServletModuleExc("*** error resolving classname for " + moduleName + " -- " + e.getMessage()); - } - } - else { - return (ServletModule) servletModuleInstanceHash.get(moduleName); - } - } - - private void handleUserError(HttpServletRequest aRequest, HttpServletResponse aResponse, - PrintWriter out, ServletModuleUserExc anException) { - try { - logger.info("user error: " + anException.getMessage()); - SimpleHash modelRoot = new SimpleHash(); - MessageResources messages = MessageResources.getMessageResources("bundles.admin"); - modelRoot.put("errorstring", - new SimpleScalar( - messages.getMessage(getLocale(aRequest), anException.getMessage(), anException.getParameters()) - )); - modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime(new GregorianCalendar()))); - HTMLTemplateProcessor.process( - aResponse, - MirPropertiesConfiguration.instance().getString("Mir.UserErrorTemplate"), - modelRoot, - null, - out, - getLocale(aRequest), - fallbackLocale); - out.close(); - } - catch (Exception e) { - logger.error("Error in UserErrorTemplate"); - } - - } - - private void handleError(HttpServletRequest aRequest, HttpServletResponse aResponse,PrintWriter out, Throwable anException) { - - try { - logger.error("error: " + anException); - SimpleHash modelRoot = new SimpleHash(); - modelRoot.put("errorstring", new SimpleScalar(anException.getMessage())); - modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime( - new GregorianCalendar()))); - HTMLTemplateProcessor.process( - aResponse,MirPropertiesConfiguration.instance().getString("Mir.ErrorTemplate"), - modelRoot,null,out, getLocale(aRequest), getFallbackLocale()); - out.close(); - } - catch (Exception e) { - logger.error("Error in ErrorTemplate"); - } - } - - /** - * evaluate login for user / password - */ - protected EntityUsers allowedUser(String user, String password) { - try { - if (usersModule == null) { - usersModule = new ModuleUsers(DatabaseUsers.getInstance()); - } - - return usersModule.getUserForLogin(user, password); - } - catch (Exception e) { - logger.debug(e.getMessage()); - e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE)); - - return null; - } - } - - // Redirect-methods - private void _sendLoginPage(HttpServletResponse aResponse, HttpServletRequest aRequest, - PrintWriter out) { - String loginTemplate = configuration.getString("Mir.LoginTemplate"); - String sessionUrl = aResponse.encodeURL(""); - - try { - SimpleHash mergeData = new SimpleHash(); - SimpleList languages = new SimpleList(); - - mergeData.put("session", sessionUrl); - - mergeData.put("defaultlanguage", getDefaultLanguage(aRequest)); - mergeData.put("languages", getLoginLanguages()); - - HTMLTemplateProcessor.process(aResponse, loginTemplate, mergeData, null, out, getLocale(aRequest), getFallbackLocale()); - } - catch (Throwable e) { - handleError(aRequest, aResponse, out, e); - } - } - - private void _sendStartPage(HttpServletResponse aResponse, HttpServletRequest aRequest, - PrintWriter out, EntityUsers userEntity) { - String startTemplate = configuration.getString("Mir.StartTemplate"); - String sessionUrl = aResponse.encodeURL(""); - - try { - Map mergeData = ServletHelper.makeGenerationData(new Locale[] {getLocale(aRequest), getFallbackLocale()}, "bundles.admin", "bundles.adminlocal"); - mergeData.put("messages", - new CachingRewindableIterator( - new EntityIteratorAdapter( "", "webdb_create desc", 10, - MirGlobal.localizer().dataModel().adapterModel(), "internalMessage", 10, 0))); - mergeData.put("searchvalue", null); - mergeData.put("searchfield", null); - mergeData.put("searchispublished", null); - mergeData.put("searcharticletype", null); - mergeData.put("searchorder", null); - mergeData.put("selectarticleurl", null); - - ServletHelper.generateResponse(aResponse.getWriter(), mergeData, startTemplate); - } - catch (Exception e) { - e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE)); - handleError(aRequest, aResponse, out, e); - } - } - - public String getServletInfo() { - return "Mir " + configuration.getString("Mir.Version"); - } - - private void checkLanguage(HttpSession session, HttpServletRequest aRequest) { - // a lang parameter always sets the language - String lang = aRequest.getParameter("language"); - - if (lang != null) { - logger.info("selected language " + lang + " overrides accept-language"); - setLanguage(session, lang); - } - // otherwise store language from accept header in session - else if (session.getAttribute("language") == null) { - logger.info("accept-language is " + aRequest.getLocale().getLanguage()); - setLanguage(session, aRequest.getLocale().getLanguage()); - } - } -} +import mircoders.storage.DatabaseUsers; + +import org.apache.struts.util.MessageResources; + +import freemarker.template.SimpleHash; +import freemarker.template.SimpleList; +import freemarker.template.SimpleScalar; +import freemarker.template.TemplateModel; + + + + +/** + * Mir.java - main servlet, that dispatches to servletmodules + * + * @author $Author: idfx $ + * @version $Id: Mir.java,v 1.45 2003/04/21 12:42:46 idfx Exp $ + * + */ +public class Mir extends AbstractServlet { + private static ModuleUsers usersModule = null; + private static ModuleMessage messageModule = null; + private final static Map servletModuleInstanceHash = new HashMap(); + private static Locale fallbackLocale = null; + + //I don't know about making this static cause it removes the + //possibility to change the config on the fly.. -mh + private static List loginLanguages = null; + + protected TemplateModel getLoginLanguages() throws ServletException { + synchronized (Mir.class) { + try { + if (loginLanguages == null) { + MessageResources messageResources = + MessageResources.getMessageResources("bundles.adminlocal"); + MessageResources messageResources2 = + MessageResources.getMessageResources("bundles.admin"); + + List languages = + StringRoutines.splitString(MirGlobal.config().getString("Mir.Login.Languages", "en"), ";"); + + loginLanguages = new Vector(); + + Iterator i = languages.iterator(); + + while (i.hasNext()) { + String code = (String) i.next(); + Locale locale = new Locale(code, ""); + String name = messageResources.getMessage(locale, "languagename"); + + if (name == null) { + name = messageResources2.getMessage(locale, "languagename"); + } + + if (name == null) { + name = code; + } + + Map record = new HashMap(); + record.put("name", name); + record.put("code", code); + loginLanguages.add(record); + } + } + + return FreemarkerGenerator.makeAdapter(loginLanguages); + } + catch (Throwable t) { + throw new ServletException(t.getMessage()); + } + } + } + + // FIXME: this should probalby go into AbstractServlet so it can be used in + // OpenMir as well -mh + protected String getDefaultLanguage(HttpServletRequest aRequest) { + String defaultlanguage = + MirGlobal.config().getString("Mir.Login.DefaultLanguage", ""); + + if (defaultlanguage.length() == 0) { + Locale locale = aRequest.getLocale(); + defaultlanguage = locale.getLanguage(); + } + + return defaultlanguage; + } + + protected synchronized Locale getFallbackLocale() throws ServletException { + try { + if (fallbackLocale == null) { + fallbackLocale = new Locale(MirPropertiesConfiguration.instance().getString("Mir.Admin.FallbackLanguage", "en"), ""); + } + } + catch (Throwable t) { + throw new ServletException(t.getMessage()); + } + + return fallbackLocale; + } + + public void process(HttpServletRequest aRequest, HttpServletResponse aResponse) + throws ServletException, IOException, UnavailableException { + long startTime = System.currentTimeMillis(); + long sessionConnectTime = 0; + EntityUsers userEntity; + HttpSession session; + String http = ""; + + configuration.addProperty("ServletName", getServletName()); + + session = aRequest.getSession(true); + userEntity = (EntityUsers) session.getAttribute("login.uid"); + + if (aRequest.getServerPort() == 443) { + http = "https"; + } else { + http = "http"; + } + + //make sure client browsers don't cache anything + setNoCaching(aResponse); + + //FIXME: this seems kind of hackish and only here because we can have + // default other than the one that the browser is set to. + Locale locale = new Locale(getDefaultLanguage(aRequest), ""); + String htmlcharset = "UTF-8"; + try { + htmlcharset = MirPropertiesConfiguration.instance().getString("Mir.DefaultHTMLCharset"); + } + catch (Throwable t) { + } + + aResponse.setContentType("text/html; charset=" + htmlcharset); + + String moduleName = aRequest.getParameter("module"); + checkLanguage(session, aRequest); + + + + // Authentication + if (((moduleName != null) && moduleName.equals("login")) || + (userEntity == null)) { + String user = aRequest.getParameter("login"); + String passwd = aRequest.getParameter("password"); + logger.debug("--login: evaluating for user: " + user); + userEntity = allowedUser(user, passwd); + + if (userEntity == null) { + // login failed: redirecting to login + logger.warn("--login: failed!"); + _sendLoginPage(aResponse, aRequest, aResponse.getWriter()); + + return; + } + else if ((moduleName != null) && moduleName.equals("login")) { + // login successful + logger.info("--login: successful! setting uid: " + userEntity.getId()); + session.setAttribute("login.uid", userEntity); + logger.debug("--login: trying to retrieve login.target"); + + String target = (String) session.getAttribute("login.target"); + + if (target != null) { + logger.debug("Redirect: " + target); + + int serverPort = aRequest.getServerPort(); + String redirect = ""; + String redirectString = ""; + + if (serverPort == 80) { + redirect = + aResponse.encodeURL(http + "://" + aRequest.getServerName() + target); + redirectString = + "going Mir"; + } else { + redirect = + aResponse.encodeURL(http + "://" + aRequest.getServerName() + ":" + + aRequest.getServerPort() + target); + redirectString = + "going Mir"; + } + + aResponse.getWriter().println(redirectString); + + //aResponse.sendRedirect(redirect); + } else { + // redirecting to default target + logger.debug("--login: no target - redirecting to default"); + _sendStartPage(aResponse, aRequest, aResponse.getWriter(), userEntity); + } + + return; + } + // if login succesful + } + // if login + + if ((moduleName != null) && moduleName.equals("logout")) { + logger.info("--logout"); + session.invalidate(); + + //session = aRequest.getSession(true); + //checkLanguage(session, aRequest); + _sendLoginPage(aResponse, aRequest, aResponse.getWriter()); + + return; + } + + // Check if authed! + if (userEntity == null) { + // redirect to loginpage + String redirectString = aRequest.getRequestURI(); + String queryString = aRequest.getQueryString(); + + if ((queryString != null) && !queryString.equals("")) { + redirectString += ("?" + aRequest.getQueryString()); + logger.debug("STORING: " + redirectString); + session.setAttribute("login.target", redirectString); + } + + _sendLoginPage(aResponse, aRequest, aResponse.getWriter()); + + return; + } + + // If no module is specified goto standard startpage + if ((moduleName == null) || moduleName.equals("")) { + logger.debug("no module: redirect to standardpage"); + _sendStartPage(aResponse, aRequest, aResponse.getWriter(), userEntity); + + return; + } + + // end of auth + // From now on regular dispatching... + try { + // get servletmodule by parameter and continue with dispacher + ServletModule smod = getServletModuleForName(moduleName); + ServletModuleDispatch.dispatch(smod, aRequest, aResponse); + } + catch (Throwable e) { + Throwable cause = ExceptionFunctions.traceCauseException(e); + + if (cause instanceof ServletModuleUserExc) + handleUserError(aRequest, aResponse, aResponse.getWriter(), (ServletModuleUserExc) cause); + else + handleError(aRequest, aResponse, aResponse.getWriter(), cause); + + } + + // timing... + sessionConnectTime = System.currentTimeMillis() - startTime; + logger.info("EXECTIME (" + moduleName + "): " + sessionConnectTime + " ms"); + } + + /** + * Private method getServletModuleForName returns ServletModule + * from Cache + * + * @param moduleName + * @return ServletModule + * + */ + private static ServletModule getServletModuleForName(String moduleName) throws ServletModuleExc { + // Instance in Map ? + if (!servletModuleInstanceHash.containsKey(moduleName)) { + // was not found in hash... + try { + Class theServletModuleClass = null; + + try { + // first we try to get ServletModule from stern.che3.servlet + theServletModuleClass = + Class.forName("mircoders.servlet.ServletModule" + moduleName); + } catch (ClassNotFoundException e) { + // on failure, we try to get it from lib-layer + theServletModuleClass = + Class.forName("mir.servlet.ServletModule" + moduleName); + } + + Method m = theServletModuleClass.getMethod("getInstance", null); + ServletModule smod = (ServletModule) m.invoke(null, null); + + // we put it into map for further reference + servletModuleInstanceHash.put(moduleName, smod); + + return smod; + } + catch (Exception e) { + throw new ServletModuleExc("*** error resolving classname for " + moduleName + " -- " + e.getMessage()); + } + } + else { + return (ServletModule) servletModuleInstanceHash.get(moduleName); + } + } + + private void handleUserError(HttpServletRequest aRequest, HttpServletResponse aResponse, + PrintWriter out, ServletModuleUserExc anException) { + try { + logger.info("user error: " + anException.getMessage()); + SimpleHash modelRoot = new SimpleHash(); + MessageResources messages = MessageResources.getMessageResources("bundles.admin"); + modelRoot.put("errorstring", + new SimpleScalar( + messages.getMessage(getLocale(aRequest), anException.getMessage(), anException.getParameters()) + )); + modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime(new GregorianCalendar()))); + HTMLTemplateProcessor.process( + aResponse, + MirPropertiesConfiguration.instance().getString("Mir.UserErrorTemplate"), + modelRoot, + null, + out, + getLocale(aRequest), + fallbackLocale); + out.close(); + } + catch (Exception e) { + logger.error("Error in UserErrorTemplate"); + } + + } + + private void handleError(HttpServletRequest aRequest, HttpServletResponse aResponse,PrintWriter out, Throwable anException) { + + try { + logger.error("error: " + anException); + SimpleHash modelRoot = new SimpleHash(); + modelRoot.put("errorstring", new SimpleScalar(anException.getMessage())); + modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime( + new GregorianCalendar()))); + HTMLTemplateProcessor.process( + aResponse,MirPropertiesConfiguration.instance().getString("Mir.ErrorTemplate"), + modelRoot,null,out, getLocale(aRequest), getFallbackLocale()); + out.close(); + } + catch (Exception e) { + logger.error("Error in ErrorTemplate"); + } + } + + /** + * evaluate login for user / password + */ + protected EntityUsers allowedUser(String user, String password) { + try { + if (usersModule == null) { + usersModule = new ModuleUsers(DatabaseUsers.getInstance()); + } + + return usersModule.getUserForLogin(user, password); + } + catch (Exception e) { + logger.debug(e.getMessage()); + e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE)); + + return null; + } + } + + // Redirect-methods + private void _sendLoginPage(HttpServletResponse aResponse, HttpServletRequest aRequest, + PrintWriter out) { + String loginTemplate = configuration.getString("Mir.LoginTemplate"); + String sessionUrl = aResponse.encodeURL(""); + + try { + SimpleHash mergeData = new SimpleHash(); + SimpleList languages = new SimpleList(); + + mergeData.put("session", sessionUrl); + + mergeData.put("defaultlanguage", getDefaultLanguage(aRequest)); + mergeData.put("languages", getLoginLanguages()); + + HTMLTemplateProcessor.process(aResponse, loginTemplate, mergeData, null, out, getLocale(aRequest), getFallbackLocale()); + } + catch (Throwable e) { + handleError(aRequest, aResponse, out, e); + } + } + + private void _sendStartPage(HttpServletResponse aResponse, HttpServletRequest aRequest, + PrintWriter out, EntityUsers userEntity) { + String startTemplate = configuration.getString("Mir.StartTemplate"); + String sessionUrl = aResponse.encodeURL(""); + + try { + Map mergeData = ServletHelper.makeGenerationData(new Locale[] {getLocale(aRequest), getFallbackLocale()}, "bundles.admin", "bundles.adminlocal"); + mergeData.put("messages", + new CachingRewindableIterator( + new EntityIteratorAdapter( "", "webdb_create desc", 10, + MirGlobal.localizer().dataModel().adapterModel(), "internalMessage", 10, 0))); + mergeData.put("searchvalue", null); + mergeData.put("searchfield", null); + mergeData.put("searchispublished", null); + mergeData.put("searcharticletype", null); + mergeData.put("searchorder", null); + mergeData.put("selectarticleurl", null); + + ServletHelper.generateResponse(aResponse.getWriter(), mergeData, startTemplate); + } + catch (Exception e) { + e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE)); + handleError(aRequest, aResponse, out, e); + } + } + + public String getServletInfo() { + return "Mir " + configuration.getString("Mir.Version"); + } + + private void checkLanguage(HttpSession session, HttpServletRequest aRequest) { + // a lang parameter always sets the language + String lang = aRequest.getParameter("language"); + + if (lang != null) { + logger.info("selected language " + lang + " overrides accept-language"); + setLanguage(session, lang); + } + // otherwise store language from accept header in session + else if (session.getAttribute("language") == null) { + logger.info("accept-language is " + aRequest.getLocale().getLanguage()); + setLanguage(session, aRequest.getLocale().getLanguage()); + } + } +} diff --git a/source/OpenMir.java b/source/OpenMir.java index ccda9818..8c57e54c 100755 --- a/source/OpenMir.java +++ b/source/OpenMir.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,36 +18,36 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ -import java.io.IOException; -import java.io.PrintWriter; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import mir.servlet.AbstractServlet; -import mir.servlet.ServletModuleDispatch; -import mir.servlet.ServletModuleUserExc; -import mir.util.ExceptionFunctions; -import mircoders.global.MirGlobal; +import java.io.IOException; +import java.io.PrintWriter; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import mir.servlet.AbstractServlet; +import mir.servlet.ServletModuleDispatch; +import mir.servlet.ServletModuleUserExc; +import mir.util.ExceptionFunctions; +import mircoders.global.MirGlobal; import mircoders.servlet.ServletModuleOpenIndy; /** * OpenMir.java - main servlet for open posting and comment feature to articles * * @author RK 1999-2001, the mir-coders group - * @version $Id: OpenMir.java,v 1.33 2003/04/21 00:24:05 zapata Exp $ + * @version $Id: OpenMir.java,v 1.34 2003/04/21 12:42:46 idfx Exp $ * */ diff --git a/source/mir/config/MirPropertiesConfiguration.java b/source/mir/config/MirPropertiesConfiguration.java index 359ad467..443117cb 100755 --- a/source/mir/config/MirPropertiesConfiguration.java +++ b/source/mir/config/MirPropertiesConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mir.config; @@ -36,6 +35,7 @@ import java.io.IOException; import java.util.HashMap; import java.util.Iterator; import java.util.Map; + import javax.servlet.ServletContext; import multex.Exc; diff --git a/source/mir/entity/Entity.java b/source/mir/entity/Entity.java index d6fb3f2d..4cb42993 100755 --- a/source/mir/entity/Entity.java +++ b/source/mir/entity/Entity.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,22 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - -/** - * Base class the entities are derived from. Provides base functionality of - * an entity. Entities are used to represent rows of a database table.

- */ - package mir.entity; import java.util.HashMap; @@ -54,10 +47,11 @@ import freemarker.template.TemplateModelException; import freemarker.template.TemplateModelRoot; /** - * Base Class of Entities + * Base class the entities are derived from. Provides base functionality of + * an entity. Entities are used to represent rows of a database table.

* Interfacing TemplateHashModel and TemplateModelRoot to be freemarker compliant * - * @version $Id: Entity.java,v 1.19 2003/04/09 02:06:06 zapata Exp $ + * @version $Id: Entity.java,v 1.20 2003/04/21 12:42:46 idfx Exp $ * @author rk * */ diff --git a/source/mir/entity/EntityBrowser.java b/source/mir/entity/EntityBrowser.java index 8ce7a6e2..44b21f4a 100755 --- a/source/mir/entity/EntityBrowser.java +++ b/source/mir/entity/EntityBrowser.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mir.entity; diff --git a/source/mir/entity/EntityList.java b/source/mir/entity/EntityList.java index 14170d0f..c2616f18 100755 --- a/source/mir/entity/EntityList.java +++ b/source/mir/entity/EntityList.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.entity; import java.util.ArrayList; diff --git a/source/mir/entity/EntityRelation.java b/source/mir/entity/EntityRelation.java index bd435921..5713a858 100755 --- a/source/mir/entity/EntityRelation.java +++ b/source/mir/entity/EntityRelation.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.entity; import mir.storage.StorageObject; diff --git a/source/mir/entity/GenericEntity.java b/source/mir/entity/GenericEntity.java index 22808b30..d5632e1c 100755 --- a/source/mir/entity/GenericEntity.java +++ b/source/mir/entity/GenericEntity.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,20 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ -/* - * GenericEntity - */ - package mir.entity; /** diff --git a/source/mir/entity/StorableObjectEntity.java b/source/mir/entity/StorableObjectEntity.java index 3f12a31b..79dc3bdc 100755 --- a/source/mir/entity/StorableObjectEntity.java +++ b/source/mir/entity/StorableObjectEntity.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.entity; /** diff --git a/source/mir/entity/adapter/EntityAdapter.java b/source/mir/entity/adapter/EntityAdapter.java index d78c1fea..cafd1eb5 100755 --- a/source/mir/entity/adapter/EntityAdapter.java +++ b/source/mir/entity/adapter/EntityAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.entity.adapter; import java.util.Collection; diff --git a/source/mir/entity/adapter/EntityAdapterDefinition.java b/source/mir/entity/adapter/EntityAdapterDefinition.java index c86fc7b2..8162bb98 100755 --- a/source/mir/entity/adapter/EntityAdapterDefinition.java +++ b/source/mir/entity/adapter/EntityAdapterDefinition.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.entity.adapter; import java.util.Calendar; diff --git a/source/mir/entity/adapter/EntityAdapterExc.java b/source/mir/entity/adapter/EntityAdapterExc.java index 9d21d57e..7e1d888f 100755 --- a/source/mir/entity/adapter/EntityAdapterExc.java +++ b/source/mir/entity/adapter/EntityAdapterExc.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.entity.adapter; import multex.Exc; diff --git a/source/mir/entity/adapter/EntityAdapterModel.java b/source/mir/entity/adapter/EntityAdapterModel.java index 76dca010..0c29089c 100755 --- a/source/mir/entity/adapter/EntityAdapterModel.java +++ b/source/mir/entity/adapter/EntityAdapterModel.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.entity.adapter; import java.util.HashMap; diff --git a/source/mir/entity/adapter/EntityIteratorAdapter.java b/source/mir/entity/adapter/EntityIteratorAdapter.java index 1af1babe..0b29d42c 100755 --- a/source/mir/entity/adapter/EntityIteratorAdapter.java +++ b/source/mir/entity/adapter/EntityIteratorAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.entity.adapter; import mir.entity.Entity; diff --git a/source/mir/entity/adapter/EntityListAdapter.java b/source/mir/entity/adapter/EntityListAdapter.java index f3dcbee6..5bf6ae46 100755 --- a/source/mir/entity/adapter/EntityListAdapter.java +++ b/source/mir/entity/adapter/EntityListAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.entity.adapter; import java.util.AbstractList; diff --git a/source/mir/generator/CompositeGeneratorLibrary.java b/source/mir/generator/CompositeGeneratorLibrary.java index a338ca82..d1c5651b 100755 --- a/source/mir/generator/CompositeGeneratorLibrary.java +++ b/source/mir/generator/CompositeGeneratorLibrary.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,20 +18,18 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.generator; -import java.util.HashMap; +import java.util.HashMap; import java.util.Map; public class CompositeGeneratorLibrary implements Generator.GeneratorLibrary { diff --git a/source/mir/generator/FreemarkerGenerator.java b/source/mir/generator/FreemarkerGenerator.java index da2fe3c3..11d86109 100755 --- a/source/mir/generator/FreemarkerGenerator.java +++ b/source/mir/generator/FreemarkerGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,40 +18,40 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.generator; -import java.io.PrintWriter; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Vector; - -import org.apache.commons.beanutils.PropertyUtils; -import freemarker.template.FileTemplateCache; -import freemarker.template.SimpleScalar; -import freemarker.template.Template; -import freemarker.template.TemplateHashModel; -import freemarker.template.TemplateListModel; -import freemarker.template.TemplateMethodModel; -import freemarker.template.TemplateModel; -import freemarker.template.TemplateModelException; -import freemarker.template.TemplateModelRoot; -import freemarker.template.TemplateScalarModel; -import mir.log.LoggerWrapper; +import java.io.PrintWriter; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import mir.log.LoggerWrapper; import mir.util.RewindableIterator; +import org.apache.commons.beanutils.PropertyUtils; + +import freemarker.template.FileTemplateCache; +import freemarker.template.SimpleScalar; +import freemarker.template.Template; +import freemarker.template.TemplateHashModel; +import freemarker.template.TemplateListModel; +import freemarker.template.TemplateMethodModel; +import freemarker.template.TemplateModel; +import freemarker.template.TemplateModelException; +import freemarker.template.TemplateModelRoot; +import freemarker.template.TemplateScalarModel; + public class FreemarkerGenerator implements Generator { private Template template; @@ -70,7 +70,7 @@ public class FreemarkerGenerator implements Generator { catch (Throwable t) { t.printStackTrace(); aLogger.error("Exception occurred: "+t.getMessage()); - t.printStackTrace(aLogger.asPrintWriter(aLogger.DEBUG_MESSAGE)); + t.printStackTrace(aLogger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE)); throw new GeneratorFailure( t ); } } diff --git a/source/mir/generator/Generator.java b/source/mir/generator/Generator.java index 011c1c2e..7d7e461a 100755 --- a/source/mir/generator/Generator.java +++ b/source/mir/generator/Generator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,22 +18,21 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mir.generator; -import java.util.List; -import java.util.Map; - +import java.util.List; +import java.util.Map; + import mir.log.LoggerWrapper; public interface Generator { diff --git a/source/mir/generator/GeneratorExc.java b/source/mir/generator/GeneratorExc.java index 53dff4a6..77c103ef 100755 --- a/source/mir/generator/GeneratorExc.java +++ b/source/mir/generator/GeneratorExc.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.generator; import multex.Exc; diff --git a/source/mir/generator/GeneratorFailure.java b/source/mir/generator/GeneratorFailure.java index a1ca3385..97046f26 100755 --- a/source/mir/generator/GeneratorFailure.java +++ b/source/mir/generator/GeneratorFailure.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.generator; import multex.Failure; diff --git a/source/mir/generator/GeneratorLibraryRepository.java b/source/mir/generator/GeneratorLibraryRepository.java index a7116cfb..3f19fc08 100755 --- a/source/mir/generator/GeneratorLibraryRepository.java +++ b/source/mir/generator/GeneratorLibraryRepository.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.generator; import java.util.HashMap; diff --git a/source/mir/generator/WriterEngine.java b/source/mir/generator/WriterEngine.java index b6f62ff3..47ebf4d3 100755 --- a/source/mir/generator/WriterEngine.java +++ b/source/mir/generator/WriterEngine.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mir.generator; diff --git a/source/mir/log/Log.java b/source/mir/log/Log.java index d953599d..17fec303 100755 --- a/source/mir/log/Log.java +++ b/source/mir/log/Log.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mir.log; diff --git a/source/mir/log/Logger.java b/source/mir/log/Logger.java index 5152b542..47dc7db9 100755 --- a/source/mir/log/Logger.java +++ b/source/mir/log/Logger.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ diff --git a/source/mir/log/LoggerToWriterAdapter.java b/source/mir/log/LoggerToWriterAdapter.java index 91b57953..018547d5 100755 --- a/source/mir/log/LoggerToWriterAdapter.java +++ b/source/mir/log/LoggerToWriterAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ diff --git a/source/mir/log/LoggerWrapper.java b/source/mir/log/LoggerWrapper.java index f8316b58..7853ef98 100755 --- a/source/mir/log/LoggerWrapper.java +++ b/source/mir/log/LoggerWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,18 +18,16 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.log; import java.io.PrintWriter; diff --git a/source/mir/log/TestFramework.java b/source/mir/log/TestFramework.java index dcec4c10..48a7891d 100755 --- a/source/mir/log/TestFramework.java +++ b/source/mir/log/TestFramework.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mir.log; diff --git a/source/mir/log/log4j/LoggerImpl.java b/source/mir/log/log4j/LoggerImpl.java index 97bfd9a6..99ebed48 100755 --- a/source/mir/log/log4j/LoggerImpl.java +++ b/source/mir/log/log4j/LoggerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.log.log4j; import java.util.HashMap; diff --git a/source/mir/media/MediaExc.java b/source/mir/media/MediaExc.java index 43c3c93a..287b02ec 100755 --- a/source/mir/media/MediaExc.java +++ b/source/mir/media/MediaExc.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mir.media; diff --git a/source/mir/media/MediaFailure.java b/source/mir/media/MediaFailure.java index 3df8e3a4..741bb9fd 100755 --- a/source/mir/media/MediaFailure.java +++ b/source/mir/media/MediaFailure.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.media; import multex.Failure; diff --git a/source/mir/media/MediaHelper.java b/source/mir/media/MediaHelper.java index b2748db5..a4d43779 100755 --- a/source/mir/media/MediaHelper.java +++ b/source/mir/media/MediaHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.media; import java.lang.reflect.Method; diff --git a/source/mir/media/MirMedia.java b/source/mir/media/MirMedia.java index 07c3fe7c..9f0caf14 100755 --- a/source/mir/media/MirMedia.java +++ b/source/mir/media/MirMedia.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.media; import java.io.InputStream; @@ -81,7 +79,7 @@ import freemarker.template.SimpleList; * ) and just override the things that need to be specific. see MediaHandlerAudio * * @author , the Mir-coders group - * @version $Id: MirMedia.java,v 1.16 2003/03/09 03:53:10 zapata Exp $ + * @version $Id: MirMedia.java,v 1.17 2003/04/21 12:42:46 idfx Exp $ */ public interface MirMedia{ diff --git a/source/mir/misc/ConfigException.java b/source/mir/misc/ConfigException.java index 3d7f8807..cbbb4249 100755 --- a/source/mir/misc/ConfigException.java +++ b/source/mir/misc/ConfigException.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mir.misc; @@ -38,7 +37,7 @@ package mir.misc; * Based and inspired by a source from the Ant distribution * (Copyright (c) 1999-2001 The Apache Software Foundation.) * - * @version $Id: ConfigException.java,v 1.3 2003/01/25 17:45:17 idfx Exp $ + * @version $Id: ConfigException.java,v 1.4 2003/04/21 12:42:52 idfx Exp $ * * @author The Mir-coders group */ diff --git a/source/mir/misc/FileUtil.java b/source/mir/misc/FileUtil.java index c9791989..3f08a573 100755 --- a/source/mir/misc/FileUtil.java +++ b/source/mir/misc/FileUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.misc; import java.io.File; diff --git a/source/mir/misc/HTMLParseException.java b/source/mir/misc/HTMLParseException.java index 09315d9d..3e139564 100755 --- a/source/mir/misc/HTMLParseException.java +++ b/source/mir/misc/HTMLParseException.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.misc; diff --git a/source/mir/misc/HTMLTemplateProcessor.java b/source/mir/misc/HTMLTemplateProcessor.java index 1f40e510..6ea623c3 100755 --- a/source/mir/misc/HTMLTemplateProcessor.java +++ b/source/mir/misc/HTMLTemplateProcessor.java @@ -1,36 +1,34 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir 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 of the License, or - * (at your option) any later version. - * - * Mir 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 Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package mir.misc; - +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir 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 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package mir.misc; + import java.io.PrintWriter; import java.net.URLEncoder; import java.util.GregorianCalendar; @@ -38,18 +36,11 @@ import java.util.Iterator; import java.util.Locale; import java.util.Map; import java.util.Set; -import javax.servlet.http.HttpServletResponse; -import org.apache.struts.util.MessageResources; -import freemarker.template.FileTemplateCache; -import freemarker.template.SimpleHash; -import freemarker.template.SimpleList; -import freemarker.template.SimpleScalar; -import freemarker.template.Template; -import freemarker.template.TemplateModelRoot; +import javax.servlet.http.HttpServletResponse; import mir.config.MirPropertiesConfiguration; -import mir.config.MirPropertiesConfiguration$PropertiesConfigExc; +import mir.config.MirPropertiesConfiguration.PropertiesConfigExc; import mir.entity.Entity; import mir.entity.EntityList; import mir.generator.FreemarkerGenerator; @@ -57,347 +48,356 @@ import mir.log.LoggerWrapper; import mir.storage.StorageObjectFailure; import mir.util.GeneratorHTMLFunctions; import mir.util.GeneratorIntegerFunctions; -import mir.util.ResourceBundleGeneratorFunction; - -/** - * Hilfsklasse zum Mergen von Template und Daten - */ -public final class HTMLTemplateProcessor { - - public static String templateDir; - private static final String[] bundles = { "bundles.adminlocal", "bundles.admin" }; - private static MirPropertiesConfiguration configuration; - private static FileTemplateCache templateCache; - private static String docRoot; - private static String actionRoot; - private static LoggerWrapper logger; - - static { - // ML: configuration is not thread safe: it's risky to use it like this - // actually I don't see why HTMLTemplateProcessor needs to be a - // class with static methods. This causes more problems than it solves. - try { - configuration = MirPropertiesConfiguration.instance(); - } - catch (PropertiesConfigExc e) { - e.printStackTrace(); - } - - logger = new LoggerWrapper("TemplateEngine"); - - templateDir = - configuration.getStringWithHome("Mir.TemplateDir"); - templateCache = new FileTemplateCache(templateDir); - templateCache.setLoadingPolicy(FileTemplateCache.LOAD_ON_DEMAND); - // gone in freemarker 1.7.1: templateCache.startAutoUpdate(); - - - docRoot = configuration.getString("RootUri"); - try { - actionRoot = docRoot +configuration.getString("Producer.ActionServlet"); - } - catch (ConfigException ce) { - // if Producer.ActionServlet is not set in the conf file - actionRoot = docRoot + "/Mir"; - } - } - - /** - * empty private constructor, to avoid instantiation - */ - private HTMLTemplateProcessor() { - } - - /** - * Wandelt Liste mit Entities entList in freemarker-Struktur um, mischt die Daten mit - * Template templateFilename und gibt das Ergebnis an den PrintWriter - * out - * - * @param templateFilename - * @param entList - * @param out - * @exception HTMLParseException - */ - - public static void process(HttpServletResponse res, String templateFilename, EntityList entList, PrintWriter out, Locale locale, Locale aFallbackLocale) throws HTMLParseException { - process(res, templateFilename, entList, (String)null, (TemplateModelRoot) null, out, locale, aFallbackLocale); - } - - /** - * Wandelt Entitylist in freemarker-Struktur um, f?gt additionalModel - * unter dem Namen additionalModelName ein und mischt die Daten mit - * Template templateFilename und gibt das Ergebnis an den PrintWriter - * out - * - * @param templateFilename - * @param entList - * @param additionalModelName - * @param additionalModel - * @param out - * @exception HTMLParseException - */ - - public static void process(HttpServletResponse res, String templateFilename, - EntityList entList, String additionalModelName, - TemplateModelRoot additionalModel, PrintWriter out, - Locale locale, Locale aFallbackLocale) throws HTMLParseException { - - SimpleHash modelRoot = new SimpleHash(); - - if (entList == null) { - process(null, templateFilename, modelRoot, null, out, locale, aFallbackLocale); - } - else { - try { - modelRoot = makeSimpleHashWithEntitylistInfos(entList); - - // Quickhack um mal ein Popup mit reinzunhemen .. - if (additionalModelName != null && additionalModel != null) - modelRoot.put(additionalModelName, additionalModel); - - process(res, templateFilename, modelRoot, null, out, locale, aFallbackLocale); - } - catch (StorageObjectFailure e) { - throw new HTMLParseException(e.toString()); - } - } - } - - - /** - * Mischt die freemarker-Struktur tmr mit - * Template templateFilename und gibt das Ergebnis an den PrintWriter - * out - * - * @param templateFilename - * @param mergeData - * @param out - * @exception HTMLParseException - */ - public static void process(HttpServletResponse res, String templateFilename, - TemplateModelRoot tmr, PrintWriter out, - Locale locale, Locale aFallbackLocale) throws HTMLParseException { - process(res, templateFilename, tmr, null, out, locale, aFallbackLocale); - } - - /** - * Mischt die freemarker-Struktur tmr mit - * Template templateFilename und gibt das Ergebnis an den PrintWriter - * out - * - * @param templateFilename - * @param mergeData - * @param out - * @exception HTMLParseException - */ - public static void process(HttpServletResponse res, String templateFilename, - TemplateModelRoot tmr, TemplateModelRoot extra, - PrintWriter out, Locale locale, Locale aFallbackLocale) throws HTMLParseException { - - if (out == null) - throw new HTMLParseException("no outputstream"); - Template tmpl = getTemplateFor(templateFilename); - if (tmpl == null) - throw new HTMLParseException("no template: " + templateFilename); - if (tmr == null) - tmr = new SimpleHash(); - - /** @todo what is this for? (rk) */ - String session = ""; - if (res != null) { - session = res.encodeURL(""); - } - - SimpleHash configHash = new SimpleHash(); - - // pass the whole config hash to the templates - Iterator it = configuration.getKeys(); - String key; - while (it.hasNext()) { - key = (String) it.next(); - configHash.put(key, new SimpleScalar( - configuration.getString(key)) - ); - } - - // this does not come directly from the config file - configHash.put("docRoot", new SimpleScalar(docRoot)); - configHash.put("actionRoot", new SimpleScalar(actionRoot + session)); - configHash.put("now", - new SimpleScalar(StringUtil.date2readableDateTime(new GregorianCalendar()))); - - // this conform to updated freemarker syntax - configHash.put("compressWhitespace", - new freemarker.template.utility.CompressWhitespace()); - - SimpleHash utilityHash = new SimpleHash(); - try { - utilityHash.put("compressWhitespace", - new freemarker.template.utility.CompressWhitespace()); - utilityHash.put("encodeURI", - FreemarkerGenerator.makeAdapter(new GeneratorHTMLFunctions. - encodeURIGeneratorFunction())); - utilityHash.put("encodeHTML", - FreemarkerGenerator.makeAdapter(new GeneratorHTMLFunctions. - encodeHTMLGeneratorFunction())); - utilityHash.put("isOdd", - FreemarkerGenerator.makeAdapter(new GeneratorIntegerFunctions. - isOddFunction())); - utilityHash.put("increment", - FreemarkerGenerator.makeAdapter(new GeneratorIntegerFunctions. - incrementFunction())); - } - catch (Throwable t) { - throw new HTMLParseException(t.getMessage()); - } - - SimpleHash outPutHash = new SimpleHash(); - - if (extra != null) { - outPutHash.put("extra", extra); - } - outPutHash.put("data", tmr); - outPutHash.put("config", configHash); - outPutHash.put("utility", utilityHash); - - MessageResources messages[] = new MessageResources[bundles.length]; - - for (int i=0; ientList in freemarker-Struktur um, mischt die Daten mit + * Template templateFilename und gibt das Ergebnis an den PrintWriter + * out + * + * @param templateFilename + * @param entList + * @param out + * @exception HTMLParseException + */ + + public static void process(HttpServletResponse res, String templateFilename, EntityList entList, PrintWriter out, Locale locale, Locale aFallbackLocale) throws HTMLParseException { + process(res, templateFilename, entList, (String)null, (TemplateModelRoot) null, out, locale, aFallbackLocale); + } + + /** + * Wandelt Entitylist in freemarker-Struktur um, f?gt additionalModel + * unter dem Namen additionalModelName ein und mischt die Daten mit + * Template templateFilename und gibt das Ergebnis an den PrintWriter + * out + * + * @param templateFilename + * @param entList + * @param additionalModelName + * @param additionalModel + * @param out + * @exception HTMLParseException + */ + + public static void process(HttpServletResponse res, String templateFilename, + EntityList entList, String additionalModelName, + TemplateModelRoot additionalModel, PrintWriter out, + Locale locale, Locale aFallbackLocale) throws HTMLParseException { + + SimpleHash modelRoot = new SimpleHash(); + + if (entList == null) { + process(null, templateFilename, modelRoot, null, out, locale, aFallbackLocale); + } + else { + try { + modelRoot = makeSimpleHashWithEntitylistInfos(entList); + + // Quickhack um mal ein Popup mit reinzunhemen .. + if (additionalModelName != null && additionalModel != null) + modelRoot.put(additionalModelName, additionalModel); + + process(res, templateFilename, modelRoot, null, out, locale, aFallbackLocale); + } + catch (StorageObjectFailure e) { + throw new HTMLParseException(e.toString()); + } + } + } + + + /** + * Mischt die freemarker-Struktur tmr mit + * Template templateFilename und gibt das Ergebnis an den PrintWriter + * out + * + * @param templateFilename + * @param mergeData + * @param out + * @exception HTMLParseException + */ + public static void process(HttpServletResponse res, String templateFilename, + TemplateModelRoot tmr, PrintWriter out, + Locale locale, Locale aFallbackLocale) throws HTMLParseException { + process(res, templateFilename, tmr, null, out, locale, aFallbackLocale); + } + + /** + * Mischt die freemarker-Struktur tmr mit + * Template templateFilename und gibt das Ergebnis an den PrintWriter + * out + * + * @param templateFilename + * @param mergeData + * @param out + * @exception HTMLParseException + */ + public static void process(HttpServletResponse res, String templateFilename, + TemplateModelRoot tmr, TemplateModelRoot extra, + PrintWriter out, Locale locale, Locale aFallbackLocale) throws HTMLParseException { + + if (out == null) + throw new HTMLParseException("no outputstream"); + Template tmpl = getTemplateFor(templateFilename); + if (tmpl == null) + throw new HTMLParseException("no template: " + templateFilename); + if (tmr == null) + tmr = new SimpleHash(); + + /** @todo what is this for? (rk) */ + String session = ""; + if (res != null) { + session = res.encodeURL(""); + } + + SimpleHash configHash = new SimpleHash(); + + // pass the whole config hash to the templates + Iterator it = configuration.getKeys(); + String key; + while (it.hasNext()) { + key = (String) it.next(); + configHash.put(key, new SimpleScalar( + configuration.getString(key)) + ); + } + + // this does not come directly from the config file + configHash.put("docRoot", new SimpleScalar(docRoot)); + configHash.put("actionRoot", new SimpleScalar(actionRoot + session)); + configHash.put("now", + new SimpleScalar(StringUtil.date2readableDateTime(new GregorianCalendar()))); + + // this conform to updated freemarker syntax + configHash.put("compressWhitespace", + new freemarker.template.utility.CompressWhitespace()); + + SimpleHash utilityHash = new SimpleHash(); + try { + utilityHash.put("compressWhitespace", + new freemarker.template.utility.CompressWhitespace()); + utilityHash.put("encodeURI", + FreemarkerGenerator.makeAdapter(new GeneratorHTMLFunctions. + encodeURIGeneratorFunction())); + utilityHash.put("encodeHTML", + FreemarkerGenerator.makeAdapter(new GeneratorHTMLFunctions. + encodeHTMLGeneratorFunction())); + utilityHash.put("isOdd", + FreemarkerGenerator.makeAdapter(new GeneratorIntegerFunctions. + isOddFunction())); + utilityHash.put("increment", + FreemarkerGenerator.makeAdapter(new GeneratorIntegerFunctions. + incrementFunction())); + } + catch (Throwable t) { + throw new HTMLParseException(t.getMessage()); + } + + SimpleHash outPutHash = new SimpleHash(); + + if (extra != null) { + outPutHash.put("extra", extra); + } + outPutHash.put("data", tmr); + outPutHash.put("config", configHash); + outPutHash.put("utility", utilityHash); + + MessageResources messages[] = new MessageResources[bundles.length]; + + for (int i=0; i * - * @version $Id: DatabaseAdaptor.java,v 1.6 2003/03/05 19:23:15 idfx Exp $ + * @version $Id: DatabaseAdaptor.java,v 1.7 2003/04/21 12:42:47 idfx Exp $ */ public interface DatabaseAdaptor { /* Liefert den Namen der Adaptorklasse diff --git a/source/mir/storage/DatabaseAdaptorMySQL.java b/source/mir/storage/DatabaseAdaptorMySQL.java index 21f94cd6..00970d99 100755 --- a/source/mir/storage/DatabaseAdaptorMySQL.java +++ b/source/mir/storage/DatabaseAdaptorMySQL.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mir.storage; diff --git a/source/mir/storage/DatabaseAdaptorOracle.java b/source/mir/storage/DatabaseAdaptorOracle.java index fc20498d..f0366485 100755 --- a/source/mir/storage/DatabaseAdaptorOracle.java +++ b/source/mir/storage/DatabaseAdaptorOracle.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,18 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ -/* - * put your module comment here + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mir.storage; diff --git a/source/mir/storage/DatabaseAdaptorPostgresql.java b/source/mir/storage/DatabaseAdaptorPostgresql.java index 87130746..59ea2b55 100755 --- a/source/mir/storage/DatabaseAdaptorPostgresql.java +++ b/source/mir/storage/DatabaseAdaptorPostgresql.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mir.storage; diff --git a/source/mir/storage/DatabaseAdaptorSybase.java b/source/mir/storage/DatabaseAdaptorSybase.java index 3e7b0583..3d9c8089 100755 --- a/source/mir/storage/DatabaseAdaptorSybase.java +++ b/source/mir/storage/DatabaseAdaptorSybase.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,18 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ -/* - * Implementiert DatabaseAdaptor Interface f?r Sybase. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mir.storage; diff --git a/source/mir/storage/DatabaseCache.java b/source/mir/storage/DatabaseCache.java deleted file mode 100755 index dfe9cccd..00000000 --- a/source/mir/storage/DatabaseCache.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir 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 of the License, or - * (at your option) any later version. - * - * Mir 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 Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ -package mir.storage; - -import java.util.ArrayList; - - -public class DatabaseCache { - private final ArrayList _cache; - private int _counter; - private final int _max; - - public DatabaseCache(int i_max) { - _counter = 0; - _max = i_max; - _cache = new ArrayList(_max); - } - - public DatabaseCache() { - _counter = -1; - _max = 100; - _cache = new ArrayList(_max); - } - - public synchronized void put(String key, Object value) { - if (_counter >= _max) { - _cache.remove(0); - _cache.trimToSize(); - _counter--; - System.out.println("put: remove " + _counter); - } - - _cache.add(new Entry(key, value)); - _counter++; - System.out.println("put: put " + _counter); - } - - public synchronized void clear() { - _cache.clear(); - } - - public int containsKey(String key) { - for (int i = 0; i < _cache.size(); i++) { - if ((_cache.get(i) != null) && - ((Entry) _cache.get(i)).getKey().equals(key)) { - return i; - } - } - - return -1; - } - - public int containsValue(Object o) { - for (int i = 0; i < _cache.size(); i++) { - if ((_cache.get(i) != null) && - ((Entry) _cache.get(i)).getValue().equals(o)) { - return i; - } - } - - return -1; - } - - public Object get(String key) { - for (int i = 0; i < _cache.size(); i++) { - if ((_cache.get(i) != null) && - (((Entry) _cache.get(i)).getKey(key) != null) && - ((Entry) _cache.get(i)).getKey(key).equals(key)) { - System.out.println("test2: " + ((Entry) _cache.get(i)).getKey(key)); - - return ((Entry) _cache.get(i)).getValue(); - } - } - - return null; - } - - public synchronized boolean remove(String key) { - int i = containsKey(key); - - if (i == -1) { - return false; - } - - _cache.remove(i); - _cache.trimToSize(); - _counter--; - - return true; - } - - public int size() { - return _counter; - } - - private class Entry { - private String _key; - private Object _value; - - public Entry(String i_key, Object i_value) { - _key = i_key; - _value = i_value; - } - - public void put(String i_key, Object i_value) { - _key = i_key; - _value = i_value; - } - - public Object getValue(String i_key) { - if (i_key.equals(_key)) { - return _value; - } else { - return null; - } - } - - public Object getValue() { - return _value; - } - - public String getKey(Object i_o) { - if (i_o.equals(_value)) { - return _key; - } else { - return null; - } - } - - public String getKey() { - return _key; - } - } - //Entry -} diff --git a/source/mir/storage/StorageObject.java b/source/mir/storage/StorageObject.java index 99e4c431..6ed2d836 100755 --- a/source/mir/storage/StorageObject.java +++ b/source/mir/storage/StorageObject.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,20 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ -/* - * Implementiert Interface f?r die Speicherschicht. - * Bislang gibt es in der Bibliothek nur die M?glichkeit - * in einer Datenbank zu speichern. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mir.storage; diff --git a/source/mir/storage/StorageObjectExc.java b/source/mir/storage/StorageObjectExc.java index 5cb3acdb..39a9970d 100755 --- a/source/mir/storage/StorageObjectExc.java +++ b/source/mir/storage/StorageObjectExc.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mir.storage; diff --git a/source/mir/storage/StorageObjectFailure.java b/source/mir/storage/StorageObjectFailure.java index b6cd10f6..40765af2 100755 --- a/source/mir/storage/StorageObjectFailure.java +++ b/source/mir/storage/StorageObjectFailure.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mir.storage; diff --git a/source/mir/storage/store/ObjectStore.java b/source/mir/storage/store/ObjectStore.java index c23f7866..f84206df 100755 --- a/source/mir/storage/store/ObjectStore.java +++ b/source/mir/storage/store/ObjectStore.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.storage.store; /** diff --git a/source/mir/storage/store/ServletStoreInfo.java b/source/mir/storage/store/ServletStoreInfo.java index 0ef6bdb5..947513b3 100755 --- a/source/mir/storage/store/ServletStoreInfo.java +++ b/source/mir/storage/store/ServletStoreInfo.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.storage.store; /** diff --git a/source/mir/storage/store/StorableObject.java b/source/mir/storage/store/StorableObject.java index 8bc6958c..05766b24 100755 --- a/source/mir/storage/store/StorableObject.java +++ b/source/mir/storage/store/StorableObject.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.storage.store; /** diff --git a/source/mir/storage/store/StoreContainer.java b/source/mir/storage/store/StoreContainer.java index bcc4c8aa..dafe1419 100755 --- a/source/mir/storage/store/StoreContainer.java +++ b/source/mir/storage/store/StoreContainer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mir.storage.store; diff --git a/source/mir/storage/store/StoreContainerType.java b/source/mir/storage/store/StoreContainerType.java index d4df0a22..4f913c3e 100755 --- a/source/mir/storage/store/StoreContainerType.java +++ b/source/mir/storage/store/StoreContainerType.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.storage.store; /** diff --git a/source/mir/storage/store/StoreIdentifier.java b/source/mir/storage/store/StoreIdentifier.java index e5fa9271..26f8af10 100755 --- a/source/mir/storage/store/StoreIdentifier.java +++ b/source/mir/storage/store/StoreIdentifier.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.storage.store; /** diff --git a/source/mir/storage/store/StoreUtil.java b/source/mir/storage/store/StoreUtil.java index 3c986d42..efd8148f 100755 --- a/source/mir/storage/store/StoreUtil.java +++ b/source/mir/storage/store/StoreUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.storage.store; /** diff --git a/source/mir/storage/store/test/EntityC1.java b/source/mir/storage/store/test/EntityC1.java index 5b9423c3..96273dec 100755 --- a/source/mir/storage/store/test/EntityC1.java +++ b/source/mir/storage/store/test/EntityC1.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.storage.store.test; /** diff --git a/source/mir/storage/store/test/EntityC2.java b/source/mir/storage/store/test/EntityC2.java index c232c78a..b8c80c9f 100755 --- a/source/mir/storage/store/test/EntityC2.java +++ b/source/mir/storage/store/test/EntityC2.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.storage.store.test; /** diff --git a/source/mir/storage/store/test/EntityC3.java b/source/mir/storage/store/test/EntityC3.java index 0af33069..f151f3d5 100755 --- a/source/mir/storage/store/test/EntityC3.java +++ b/source/mir/storage/store/test/EntityC3.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.storage.store.test; /** diff --git a/source/mir/storage/store/test/TestStore.java b/source/mir/storage/store/test/TestStore.java index d10f06be..4f019955 100755 --- a/source/mir/storage/store/test/TestStore.java +++ b/source/mir/storage/store/test/TestStore.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.storage.store.test; /** diff --git a/source/mir/util/CachingRewindableIterator.java b/source/mir/util/CachingRewindableIterator.java index 8456c759..1edf7797 100755 --- a/source/mir/util/CachingRewindableIterator.java +++ b/source/mir/util/CachingRewindableIterator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.util; import java.util.Iterator; diff --git a/source/mir/util/DateToMapAdapter.java b/source/mir/util/DateToMapAdapter.java index e3b4c967..01159845 100755 --- a/source/mir/util/DateToMapAdapter.java +++ b/source/mir/util/DateToMapAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.util; import java.text.SimpleDateFormat; diff --git a/source/mir/util/ExceptionFunctions.java b/source/mir/util/ExceptionFunctions.java index cd6459fe..218213e3 100755 --- a/source/mir/util/ExceptionFunctions.java +++ b/source/mir/util/ExceptionFunctions.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.util; import java.lang.reflect.InvocationTargetException; diff --git a/source/mir/util/FileFunctions.java b/source/mir/util/FileFunctions.java index 77cdc1b2..862145d9 100755 --- a/source/mir/util/FileFunctions.java +++ b/source/mir/util/FileFunctions.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,26 +18,24 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.util; +import gnu.regexp.RE; + import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; -import java.io.IOException; import java.io.FilenameFilter; - -import gnu.regexp.RE; +import java.io.IOException; public class FileFunctions { protected static final int FILE_COPY_BUFFER_SIZE = 65536; diff --git a/source/mir/util/FileMonitor.java b/source/mir/util/FileMonitor.java index 799d10f4..6e4f5315 100755 --- a/source/mir/util/FileMonitor.java +++ b/source/mir/util/FileMonitor.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.util; import java.io.File; diff --git a/source/mir/util/GeneratorExpressionFunctions.java b/source/mir/util/GeneratorExpressionFunctions.java index 9f8a7615..1cec25d4 100755 --- a/source/mir/util/GeneratorExpressionFunctions.java +++ b/source/mir/util/GeneratorExpressionFunctions.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,24 +18,22 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.util; -import java.util.List; -import java.util.Map; - -import mir.generator.Generator; -import mir.generator.GeneratorExc; +import java.util.List; +import java.util.Map; + +import mir.generator.Generator; +import mir.generator.GeneratorExc; import mir.generator.GeneratorFailure; public class GeneratorExpressionFunctions { diff --git a/source/mir/util/GeneratorHTMLFunctions.java b/source/mir/util/GeneratorHTMLFunctions.java index b5e0bf6d..1f03ec62 100755 --- a/source/mir/util/GeneratorHTMLFunctions.java +++ b/source/mir/util/GeneratorHTMLFunctions.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.util; import java.util.List; diff --git a/source/mir/util/GeneratorIntegerFunctions.java b/source/mir/util/GeneratorIntegerFunctions.java index 19d3b047..e323866e 100755 --- a/source/mir/util/GeneratorIntegerFunctions.java +++ b/source/mir/util/GeneratorIntegerFunctions.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.util; import java.util.List; diff --git a/source/mir/util/GeneratorListFunctions.java b/source/mir/util/GeneratorListFunctions.java index fa7f0c16..039d2025 100755 --- a/source/mir/util/GeneratorListFunctions.java +++ b/source/mir/util/GeneratorListFunctions.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.util; import java.util.List; diff --git a/source/mir/util/GeneratorRegularExpressionFunctions.java b/source/mir/util/GeneratorRegularExpressionFunctions.java index 63113613..ed6d3f0b 100755 --- a/source/mir/util/GeneratorRegularExpressionFunctions.java +++ b/source/mir/util/GeneratorRegularExpressionFunctions.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.util; import java.util.List; diff --git a/source/mir/util/GeneratorStringFunctions.java b/source/mir/util/GeneratorStringFunctions.java index 6d8b3730..a8cd2662 100755 --- a/source/mir/util/GeneratorStringFunctions.java +++ b/source/mir/util/GeneratorStringFunctions.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.util; import java.util.List; diff --git a/source/mir/util/HTMLRoutines.java b/source/mir/util/HTMLRoutines.java index 24211cbb..988d6501 100755 --- a/source/mir/util/HTMLRoutines.java +++ b/source/mir/util/HTMLRoutines.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mir.util; diff --git a/source/mir/util/HTTPParsedRequest.java b/source/mir/util/HTTPParsedRequest.java index 961a40fb..fb22d60b 100755 --- a/source/mir/util/HTTPParsedRequest.java +++ b/source/mir/util/HTTPParsedRequest.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.util; import java.util.Arrays; @@ -38,11 +36,13 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Vector; + import javax.servlet.http.HttpServletRequest; +import mir.log.LoggerWrapper; + import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileUpload; -import mir.log.LoggerWrapper; public class HTTPParsedRequest { static final String MULTIPART_FORMDATA_CONTENTTYPE = "multipart/form-data"; diff --git a/source/mir/util/HTTPRequestParser.java b/source/mir/util/HTTPRequestParser.java index d37ee233..951e458a 100755 --- a/source/mir/util/HTTPRequestParser.java +++ b/source/mir/util/HTTPRequestParser.java @@ -1,89 +1,88 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir 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 of the License, or - * (at your option) any later version. - * - * Mir 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 Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package mir.util; - -import javax.servlet.http.HttpServletRequest; - -public class HTTPRequestParser { - private HttpServletRequest request; - private String encoding; - - public HTTPRequestParser(HttpServletRequest aRequest) { - this(aRequest, aRequest.getCharacterEncoding()); - } - - public HTTPRequestParser(HttpServletRequest aRequest, String anEncoding) { - request = aRequest; - encoding = anEncoding; - } - - public boolean hasParameter(String aName) { - return request.getParameter(aName)!=null; - } - - public String getParameterWithDefault(String aName, String aDefault) { - if (hasParameter(aName)) - return getParameter(aName); - else - return aDefault; - } - - public String getParameter(String aName) { - try { - String result = request.getParameter(aName); -// String requestEncoding = request.getCharacterEncoding(); -// if (requestEncoding==null) -// requestEncoding = "ISO-8859-1"; - -// if (result != null && encoding!=null && !encoding.equals(requestEncoding)) { -// result = new String(result.getBytes(requestEncoding), encoding); -// } - - return result; - } - catch (Throwable t) { - throw new RuntimeException("HTTPRequestParser.getParameter: " + t.getMessage()); - } - } - - public int getIntegerWithDefault(String aName, int aDefault) { - int result = aDefault; - String value = getParameter(aName); - - try { - result = Integer.parseInt(value); - } - catch (Throwable t) { - } - return result; - } -} +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir 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 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ + +package mir.util; + +import javax.servlet.http.HttpServletRequest; + +public class HTTPRequestParser { + private HttpServletRequest request; + private String encoding; + + public HTTPRequestParser(HttpServletRequest aRequest) { + this(aRequest, aRequest.getCharacterEncoding()); + } + + public HTTPRequestParser(HttpServletRequest aRequest, String anEncoding) { + request = aRequest; + encoding = anEncoding; + } + + public boolean hasParameter(String aName) { + return request.getParameter(aName)!=null; + } + + public String getParameterWithDefault(String aName, String aDefault) { + if (hasParameter(aName)) + return getParameter(aName); + else + return aDefault; + } + + public String getParameter(String aName) { + try { + String result = request.getParameter(aName); +// String requestEncoding = request.getCharacterEncoding(); +// if (requestEncoding==null) +// requestEncoding = "ISO-8859-1"; + +// if (result != null && encoding!=null && !encoding.equals(requestEncoding)) { +// result = new String(result.getBytes(requestEncoding), encoding); +// } + + return result; + } + catch (Throwable t) { + throw new RuntimeException("HTTPRequestParser.getParameter: " + t.getMessage()); + } + } + + public int getIntegerWithDefault(String aName, int aDefault) { + int result = aDefault; + String value = getParameter(aName); + + try { + result = Integer.parseInt(value); + } + catch (Throwable t) { + } + return result; + } +} diff --git a/source/mir/util/JDBCStringRoutines.java b/source/mir/util/JDBCStringRoutines.java index a039d109..fcf2bcab 100755 --- a/source/mir/util/JDBCStringRoutines.java +++ b/source/mir/util/JDBCStringRoutines.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.util; /** diff --git a/source/mir/util/NullWriter.java b/source/mir/util/NullWriter.java index 6c7ed900..fe8f0b6d 100755 --- a/source/mir/util/NullWriter.java +++ b/source/mir/util/NullWriter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.util; import java.io.Writer; diff --git a/source/mir/util/ParameterExpander.java b/source/mir/util/ParameterExpander.java index 6f96209f..13787282 100755 --- a/source/mir/util/ParameterExpander.java +++ b/source/mir/util/ParameterExpander.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.util; import java.util.HashMap; diff --git a/source/mir/util/PropertiesManipulator.java b/source/mir/util/PropertiesManipulator.java index daf90ecb..ae88073e 100755 --- a/source/mir/util/PropertiesManipulator.java +++ b/source/mir/util/PropertiesManipulator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.util; import java.io.InputStream; diff --git a/source/mir/util/ResourceBundleGeneratorFunction.java b/source/mir/util/ResourceBundleGeneratorFunction.java index e27ce230..c31b85e9 100755 --- a/source/mir/util/ResourceBundleGeneratorFunction.java +++ b/source/mir/util/ResourceBundleGeneratorFunction.java @@ -1,94 +1,93 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir 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 of the License, or - * (at your option) any later version. - * - * Mir 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 Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package mir.util; - -import java.util.Iterator; -import java.util.List; -import java.util.Locale; -import java.util.Vector; - -import org.apache.struts.util.MessageResources; -import mir.generator.Generator; -import mir.generator.GeneratorExc; - -public class ResourceBundleGeneratorFunction implements Generator.GeneratorFunction { - private List messages; - private List locales; - - public ResourceBundleGeneratorFunction(Locale aLocale, MessageResources aMessages) { - this(new Locale[] { aLocale}, new MessageResources[] {aMessages} ); - } - - public ResourceBundleGeneratorFunction(Locale[] aLocales, MessageResources[] aMessages) { - locales = new Vector(); - messages = new Vector(); - - for(int i=0; iseperateString("a:b:c", ":"); will lead to - * a List with 3 Strings: "a", "b" and "c" - * - * @param aString The string to split - * @param aSeparator - * @return - */ - - public static List splitString(String aString, String aSeparator) { - List result= new Vector(); - int previousPosition = 0; - int position; - int endOfNamePosition; - - if (aString!=null) { - while ( (position = aString.indexOf(aSeparator, previousPosition)) >= 0) { - result.add(aString.substring(previousPosition, position)); - previousPosition = position + aSeparator.length(); - } - result.add(aString.substring(previousPosition, aString.length())); - } - - return result; - } - - /** - * Separates a String into at most 2 parts based on a separator: - *

- * - * - * @param aString - * @param aSeparator - * @return - */ - public static List separateString(String aString, String aSeparator) { - List result= new Vector(); - int previousPosition = 0; - int position; - int endOfNamePosition; - - if((position = aString.indexOf(aSeparator, previousPosition))>=0) { - result.add(aString.substring(previousPosition, position)); - previousPosition = position + aSeparator.length(); - } - - result.add(aString.substring(previousPosition, aString.length())); - - return result; - } +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir 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 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package mir.util; + +import gnu.regexp.RE; +import gnu.regexp.REException; + +import java.util.List; +import java.util.Vector; + +public class StringRoutines { + + private StringRoutines() { + } + + static int indexOfCharacters(String aString, char[] aCharacters, int aFrom) { + int i; + int result=-1; + int position; + + for (i=0; iseperateString("a:b:c", ":"); will lead to + * a List with 3 Strings: "a", "b" and "c" + * + * @param aString The string to split + * @param aSeparator + * @return + */ + + public static List splitString(String aString, String aSeparator) { + List result= new Vector(); + int previousPosition = 0; + int position; + int endOfNamePosition; + + if (aString!=null) { + while ( (position = aString.indexOf(aSeparator, previousPosition)) >= 0) { + result.add(aString.substring(previousPosition, position)); + previousPosition = position + aSeparator.length(); + } + result.add(aString.substring(previousPosition, aString.length())); + } + + return result; + } + + /** + * Separates a String into at most 2 parts based on a separator: + * + * + * + * @param aString + * @param aSeparator + * @return + */ + public static List separateString(String aString, String aSeparator) { + List result= new Vector(); + int previousPosition = 0; + int position; + int endOfNamePosition; + + if((position = aString.indexOf(aSeparator, previousPosition))>=0) { + result.add(aString.substring(previousPosition, position)); + previousPosition = position + aSeparator.length(); + } + + result.add(aString.substring(previousPosition, aString.length())); + + return result; + } } \ No newline at end of file diff --git a/source/mir/util/SubsetIterator.java b/source/mir/util/SubsetIterator.java index 171c681c..b1b14393 100755 --- a/source/mir/util/SubsetIterator.java +++ b/source/mir/util/SubsetIterator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.util; import java.util.List; diff --git a/source/mir/util/URLBuilder.java b/source/mir/util/URLBuilder.java index c36cdf9e..ecb1ef39 100755 --- a/source/mir/util/URLBuilder.java +++ b/source/mir/util/URLBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.util; import java.util.HashMap; diff --git a/source/mir/util/UtilExc.java b/source/mir/util/UtilExc.java index 7810effd..62bb748a 100755 --- a/source/mir/util/UtilExc.java +++ b/source/mir/util/UtilExc.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.util; import multex.Exc; diff --git a/source/mir/util/UtilFailure.java b/source/mir/util/UtilFailure.java index 99902962..2c9ccd49 100755 --- a/source/mir/util/UtilFailure.java +++ b/source/mir/util/UtilFailure.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.util; import multex.Failure; diff --git a/source/mir/util/XMLReader.java b/source/mir/util/XMLReader.java index 23e08234..2947bfe4 100755 --- a/source/mir/util/XMLReader.java +++ b/source/mir/util/XMLReader.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,28 +18,20 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.util; -import java.io.File; import java.io.FileInputStream; -import java.io.StringReader; -import java.io.FileNotFoundException; -import java.io.IOException; import java.io.InputStream; - import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Stack; diff --git a/source/mir/util/XMLReaderTool.java b/source/mir/util/XMLReaderTool.java index df4ba405..2bae6d24 100755 --- a/source/mir/util/XMLReaderTool.java +++ b/source/mir/util/XMLReaderTool.java @@ -1,7 +1,5 @@ -package mir.util; - /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -20,23 +18,23 @@ package mir.util; * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ +package mir.util; import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Set; -import java.util.List; public class XMLReaderTool { diff --git a/source/mir/xml/SaxContext.java b/source/mir/xml/SaxContext.java index 3d8bc7dc..3edb532b 100755 --- a/source/mir/xml/SaxContext.java +++ b/source/mir/xml/SaxContext.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.xml; diff --git a/source/mir/xml/XmlConfigurator.java b/source/mir/xml/XmlConfigurator.java index 711af695..102212bc 100755 --- a/source/mir/xml/XmlConfigurator.java +++ b/source/mir/xml/XmlConfigurator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mir.xml; import java.io.File; diff --git a/source/mir/xml/XmlMatch.java b/source/mir/xml/XmlMatch.java index 7330ac31..b7941928 100755 --- a/source/mir/xml/XmlMatch.java +++ b/source/mir/xml/XmlMatch.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mir.xml; diff --git a/source/mircoders/entity/EntityAudio.java b/source/mircoders/entity/EntityAudio.java index 3a46eed9..ac431b70 100755 --- a/source/mircoders/entity/EntityAudio.java +++ b/source/mircoders/entity/EntityAudio.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,30 +18,27 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.entity; -import java.sql.SQLException; import java.util.Map; import mir.storage.StorageObject; -import mir.storage.StorageObjectFailure; /** * This class handles storage of audio data and meta data * * @author mh - * @version $Id: EntityAudio.java,v 1.10 2003/04/09 02:06:08 zapata Exp $ + * @version $Id: EntityAudio.java,v 1.11 2003/04/21 12:42:53 idfx Exp $ */ diff --git a/source/mircoders/entity/EntityComment.java b/source/mircoders/entity/EntityComment.java index bf4283f9..b5032b47 100755 --- a/source/mircoders/entity/EntityComment.java +++ b/source/mircoders/entity/EntityComment.java @@ -1,131 +1,130 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir 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 of the License, or - * (at your option) any later version. - * - * Mir 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 Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package mircoders.entity; - -import java.util.Map; - -import mir.entity.Entity; -import mir.storage.StorageObject; -import mir.storage.StorageObjectFailure; -import mircoders.storage.DatabaseCommentToMedia; -import mircoders.storage.DatabaseContent; - -/** - * This class maps one line of the comment-table to a java-object. - * - * @author $Author: zapata $ - * @version $Revision: 1.15 $ $Date: 2003/04/10 03:31:46 $ - */ - - -public class EntityComment extends Entity -{ - - public EntityComment() - { - super(); - } - - public EntityComment(StorageObject theStorage) { - this(); - setStorage(theStorage); - } - - - /** - * overridden method setValues to patch creator_main_url - */ - public void setValues(Map theStringValues) - { - if (theStringValues != null) { - if (!theStringValues.containsKey("is_published")) { - theStringValues.put("is_published","0"); - } - - if (theStringValues.containsKey("main_url")){ - if (((String)theStringValues.get("main_url")).equalsIgnoreCase("http://")) { - theStringValues.remove("main_url"); - } - else if ((!((String)theStringValues.get("main_url")).startsWith("http://")) - && ((String)theStringValues.get("main_url")).length()>0) { - theStringValues.put("main_url","http://"+((String)theStringValues.get("main_url"))); - } - } - - } - super.setValues(theStringValues); - } - - /** - * Deattaches media from a comment - * - * @param aCommentId - * @param aMediaId - * @throws StorageObjectFailure - */ - public void dettach(String aCommentId,String aMediaId) throws StorageObjectFailure - { - if (aMediaId!=null){ - try{ - DatabaseCommentToMedia.getInstance().delete(aCommentId, aMediaId); - } - catch (Exception e){ - throwStorageObjectFailure(e, "dettach: failed to get instance"); - } - - DatabaseContent.getInstance().setUnproduced("id="+getValue("to_media")); - } - } - - /** - * - * @param aMediaId - * @throws StorageObjectFailure - */ - - public void attach(String aMediaId) throws StorageObjectFailure - { - if (aMediaId!=null) { - try{ - DatabaseCommentToMedia.getInstance().addMedia(getId(), aMediaId); - } - catch(StorageObjectFailure e){ - throwStorageObjectFailure(e, "attach: could not get the instance"); - } - - DatabaseContent.getInstance().setUnproduced("id="+getValue("to_media")); - } - else { - logger.error("EntityContent: attach without mid"); - } - } -} +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir 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 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ + +package mircoders.entity; + +import java.util.Map; + +import mir.entity.Entity; +import mir.storage.StorageObject; +import mir.storage.StorageObjectFailure; +import mircoders.storage.DatabaseCommentToMedia; +import mircoders.storage.DatabaseContent; + +/** + * This class maps one line of the comment-table to a java-object. + * + * @author $Author: idfx $ + * @version $Revision: 1.16 $ $Date: 2003/04/21 12:42:53 $ + */ + + +public class EntityComment extends Entity +{ + + public EntityComment() + { + super(); + } + + public EntityComment(StorageObject theStorage) { + this(); + setStorage(theStorage); + } + + + /** + * overridden method setValues to patch creator_main_url + */ + public void setValues(Map theStringValues) + { + if (theStringValues != null) { + if (!theStringValues.containsKey("is_published")) { + theStringValues.put("is_published","0"); + } + + if (theStringValues.containsKey("main_url")){ + if (((String)theStringValues.get("main_url")).equalsIgnoreCase("http://")) { + theStringValues.remove("main_url"); + } + else if ((!((String)theStringValues.get("main_url")).startsWith("http://")) + && ((String)theStringValues.get("main_url")).length()>0) { + theStringValues.put("main_url","http://"+((String)theStringValues.get("main_url"))); + } + } + + } + super.setValues(theStringValues); + } + + /** + * Deattaches media from a comment + * + * @param aCommentId + * @param aMediaId + * @throws StorageObjectFailure + */ + public void dettach(String aCommentId,String aMediaId) throws StorageObjectFailure + { + if (aMediaId!=null){ + try{ + DatabaseCommentToMedia.getInstance().delete(aCommentId, aMediaId); + } + catch (Exception e){ + throwStorageObjectFailure(e, "dettach: failed to get instance"); + } + + DatabaseContent.getInstance().setUnproduced("id="+getValue("to_media")); + } + } + + /** + * + * @param aMediaId + * @throws StorageObjectFailure + */ + + public void attach(String aMediaId) throws StorageObjectFailure + { + if (aMediaId!=null) { + try{ + DatabaseCommentToMedia.getInstance().addMedia(getId(), aMediaId); + } + catch(StorageObjectFailure e){ + throwStorageObjectFailure(e, "attach: could not get the instance"); + } + + DatabaseContent.getInstance().setUnproduced("id="+getValue("to_media")); + } + else { + logger.error("EntityContent: attach without mid"); + } + } +} diff --git a/source/mircoders/entity/EntityContent.java b/source/mircoders/entity/EntityContent.java index 46bc838e..5eb2bf58 100755 --- a/source/mircoders/entity/EntityContent.java +++ b/source/mircoders/entity/EntityContent.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.entity; @@ -54,7 +53,7 @@ import freemarker.template.TemplateModelException; * this class implements mapping of one line of the database table content * to a java object * - * @version $Id: EntityContent.java,v 1.18 2003/04/10 03:31:47 zapata Exp $ + * @version $Id: EntityContent.java,v 1.19 2003/04/21 12:42:54 idfx Exp $ * @author mir-coders group * */ diff --git a/source/mircoders/entity/EntityFeature.java b/source/mircoders/entity/EntityFeature.java index 77a200c9..94a02945 100755 --- a/source/mircoders/entity/EntityFeature.java +++ b/source/mircoders/entity/EntityFeature.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.entity; diff --git a/source/mircoders/entity/EntityImages.java b/source/mircoders/entity/EntityImages.java index ea96e811..02ecfcc8 100755 --- a/source/mircoders/entity/EntityImages.java +++ b/source/mircoders/entity/EntityImages.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.entity; @@ -55,7 +54,7 @@ import org.postgresql.largeobject.LargeObjectManager; * Diese Klasse enth?lt die Daten eines MetaObjekts * * @author RK, mh, mir-coders - * @version $Id: EntityImages.java,v 1.19 2003/03/08 17:18:19 idfx Exp $ + * @version $Id: EntityImages.java,v 1.20 2003/04/21 12:42:53 idfx Exp $ */ diff --git a/source/mircoders/entity/EntityLinksImcs.java b/source/mircoders/entity/EntityLinksImcs.java index c714ab1a..26371406 100755 --- a/source/mircoders/entity/EntityLinksImcs.java +++ b/source/mircoders/entity/EntityLinksImcs.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.entity; import java.util.Set; diff --git a/source/mircoders/entity/EntityMedia.java b/source/mircoders/entity/EntityMedia.java index 0784743e..029793a9 100755 --- a/source/mircoders/entity/EntityMedia.java +++ b/source/mircoders/entity/EntityMedia.java @@ -1,77 +1,75 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir 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 of the License, or - * (at your option) any later version. - * - * Mir 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 Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package mircoders.entity; - -import mir.entity.Entity; -import mir.storage.StorageObject; -import mir.storage.StorageObjectExc; -import mir.storage.StorageObjectFailure; -import mircoders.storage.DatabaseMedia; -/** - * Diese Klasse enth?lt die Daten eines MetaObjekts - * - * @author RK - * @version 29.6.1999 - */ - - -public class EntityMedia extends Entity -{ - - public EntityMedia(){ - super(); - } - - public EntityMedia(StorageObject theStorage) - { - this(); - setStorage(theStorage); - } - - /** - * fetches the MediaType entry assiciated w/ this media - * - * @return mir.entity.Entity - */ - public Entity getMediaType() throws StorageObjectFailure { - try { - return ( (DatabaseMedia) theStorageObject).getMediaType(this); - } - catch (StorageObjectFailure e) { - throw new StorageObjectFailure("getMediaType(): ", e); - } - catch (StorageObjectExc e) { - throw new StorageObjectFailure("getMediaType(): ", e); - } - - } -} +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir 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 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package mircoders.entity; + +import mir.entity.Entity; +import mir.storage.StorageObject; +import mir.storage.StorageObjectExc; +import mir.storage.StorageObjectFailure; +import mircoders.storage.DatabaseMedia; +/** + * Diese Klasse enth?lt die Daten eines MetaObjekts + * + * @author RK + * @version 29.6.1999 + */ + + +public class EntityMedia extends Entity +{ + + public EntityMedia(){ + super(); + } + + public EntityMedia(StorageObject theStorage) + { + this(); + setStorage(theStorage); + } + + /** + * fetches the MediaType entry assiciated w/ this media + * + * @return mir.entity.Entity + */ + public Entity getMediaType() throws StorageObjectFailure { + try { + return ( (DatabaseMedia) theStorageObject).getMediaType(this); + } + catch (StorageObjectFailure e) { + throw new StorageObjectFailure("getMediaType(): ", e); + } + catch (StorageObjectExc e) { + throw new StorageObjectFailure("getMediaType(): ", e); + } + + } +} diff --git a/source/mircoders/entity/EntityOther.java b/source/mircoders/entity/EntityOther.java index 4a72359f..0fa0ad8a 100755 --- a/source/mircoders/entity/EntityOther.java +++ b/source/mircoders/entity/EntityOther.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,24 +18,21 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.entity; -import java.sql.SQLException; import java.util.Map; import mir.storage.StorageObject; -import mir.storage.StorageObjectFailure; /** * This class handles storage of other data and meta data diff --git a/source/mircoders/entity/EntityTopics.java b/source/mircoders/entity/EntityTopics.java index 2956d70e..f99d2dba 100755 --- a/source/mircoders/entity/EntityTopics.java +++ b/source/mircoders/entity/EntityTopics.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.entity; diff --git a/source/mircoders/entity/EntityUploadedMedia.java b/source/mircoders/entity/EntityUploadedMedia.java index 13e34d89..2d5e0115 100755 --- a/source/mircoders/entity/EntityUploadedMedia.java +++ b/source/mircoders/entity/EntityUploadedMedia.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,39 +18,37 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.entity; -import java.sql.SQLException; -import java.util.Map; - -import freemarker.template.SimpleList; -import freemarker.template.SimpleScalar; -import freemarker.template.TemplateModel; -import freemarker.template.TemplateModelException; -import mir.entity.Entity; -import mir.log.LoggerWrapper; -import mir.media.MediaHelper; -import mir.media.MirMedia; -import mir.misc.NumberUtils; -import mir.storage.StorageObject; -import mir.storage.StorageObjectFailure; +import java.sql.SQLException; +import java.util.Map; + +import mir.entity.Entity; +import mir.log.LoggerWrapper; +import mir.media.MediaHelper; +import mir.media.MirMedia; +import mir.misc.NumberUtils; +import mir.storage.StorageObject; +import mir.storage.StorageObjectFailure; import mircoders.storage.DatabaseUploadedMedia; +import freemarker.template.SimpleList; +import freemarker.template.SimpleScalar; +import freemarker.template.TemplateModel; +import freemarker.template.TemplateModelException; /** * * @author mh, mir-coders group - * @version $Id: EntityUploadedMedia.java,v 1.25 2003/04/10 03:31:47 zapata Exp $ + * @version $Id: EntityUploadedMedia.java,v 1.26 2003/04/21 12:42:53 idfx Exp $ */ diff --git a/source/mircoders/entity/EntityUsers.java b/source/mircoders/entity/EntityUsers.java index f385a08d..8cf339db 100755 --- a/source/mircoders/entity/EntityUsers.java +++ b/source/mircoders/entity/EntityUsers.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.entity; import mir.entity.Entity; diff --git a/source/mircoders/entity/EntityVideo.java b/source/mircoders/entity/EntityVideo.java index 8497fc95..a0e299e3 100755 --- a/source/mircoders/entity/EntityVideo.java +++ b/source/mircoders/entity/EntityVideo.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,25 +18,21 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.entity; -import java.sql.SQLException; import java.util.Map; import mir.log.LoggerWrapper; import mir.storage.StorageObject; -import mir.storage.StorageObjectFailure; /** * Diese Klasse enth?lt die Daten eines MetaObjekts diff --git a/source/mircoders/global/Abuse.java b/source/mircoders/global/Abuse.java index f67524a6..55eed8cb 100755 --- a/source/mircoders/global/Abuse.java +++ b/source/mircoders/global/Abuse.java @@ -1,36 +1,37 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir 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 of the License, or - * (at your option) any later version. - * - * Mir 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 Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package mircoders.global; - +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir 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 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ + +package mircoders.global; + +import gnu.regexp.RE; + import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; @@ -42,13 +43,11 @@ import java.util.List; import java.util.Map; import java.util.Random; import java.util.Vector; + import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.commons.collections.ExtendedProperties; -import gnu.regexp.RE; - import mir.entity.Entity; import mir.log.LoggerWrapper; import mir.session.HTTPAdapters; @@ -58,598 +57,600 @@ import mir.util.InternetFunctions; import mir.util.StringRoutines; import mircoders.entity.EntityComment; import mircoders.entity.EntityContent; -import mircoders.localizer.MirAdminInterfaceLocalizer; - - -public class Abuse { - private List filters; - private int maxIdentifier; - private LoggerWrapper logger; - private int logSize; - private boolean logEnabled; - private boolean openPostingDisabled; - private boolean openPostingPassword; - private boolean cookieOnBlock; - private String articleBlockAction; - private String commentBlockAction; - private List log; - private String configFile = MirGlobal.config().getStringWithHome("Abuse.Config"); - - - private static final String IP_FILTER_TYPE="ip"; - private static final String REGEXP_FILTER_TYPE="regexp"; - private static String cookieName=MirGlobal.config().getString("Abuse.CookieName"); - private static int cookieMaxAge = 60*60*MirGlobal.config().getInt("Abuse.CookieMaxAge"); - - public Abuse() { - logger = new LoggerWrapper("Global.Abuse"); - filters = new Vector(); - maxIdentifier = 0; - log = new Vector(); - - logSize = 100; - logEnabled = false; - articleBlockAction = ""; - commentBlockAction = ""; - openPostingPassword = false; - openPostingDisabled = false; - cookieOnBlock = false; - - load(); - } - - public boolean checkIpFilter(String anIpAddress) { - synchronized (filters) { - Iterator i = filters.iterator(); - - while (i.hasNext()) { - Filter filter = (Filter) i.next(); - - try { - if ( (filter.getType().equals(IP_FILTER_TYPE)) && - InternetFunctions.isIpAddressInNetwork(anIpAddress, filter.getExpression())) { - logger.debug("ip match on " + filter.getExpression()); - return true; - } - } - catch (Throwable t) { - logger.warn("error while checking ip address " + anIpAddress + " over network " + filter.expression + ": " + t.getMessage()); - } - } - - return false; - } - } - - private boolean checkRegExpFilter(Entity anEntity) { - synchronized (filters) { - Iterator i = filters.iterator(); - - while (i.hasNext()) { - Filter filter = (Filter) i.next(); - - if (filter.getType().equals(REGEXP_FILTER_TYPE)) { - try { - RE regularExpression = new RE(filter.getExpression()); - - Iterator j = anEntity.getFields().iterator(); - while (j.hasNext()) { - String field = anEntity.getValue( (String) j.next()); - - if (field != null && regularExpression.isMatch(field.toLowerCase())) { - logger.debug("regexp match on " + filter.getExpression()); - return true; - } - } - } - catch (Throwable t) { - logger.warn("error while checking entity with regexp " + filter.getExpression() + ": " + t.getMessage()); - } - } - } - - return false; - } - } - - private void setCookie(HttpServletResponse aResponse) { - Random random = new Random(); - - Cookie cookie = new Cookie(cookieName, Integer.toString(random.nextInt(1000000000))); - cookie.setMaxAge(cookieMaxAge); - cookie.setPath("/"); - - if (aResponse!=null) - aResponse.addCookie(cookie); - } - - private boolean checkCookie(List aCookies) { - if (getCookieOnBlock()) { - Iterator i = aCookies.iterator(); - - while (i.hasNext()) { - Cookie cookie = (Cookie) i.next(); - - if (cookie.getName().equals(cookieName)) { - logger.debug("cookie match"); - return true; - } - } - } - - return false; - } - - public void checkComment(EntityComment aComment, Request aRequest, HttpServletResponse aResponse) { - try { - long time = System.currentTimeMillis(); - String address = "0.0.0.0"; - String browser = "unknown"; - Cookie[] cookies = {}; - - HttpServletRequest request = null; - - if (aRequest instanceof HTTPAdapters.HTTPParsedRequestAdapter) { - request = ((HTTPAdapters.HTTPParsedRequestAdapter) aRequest).getRequest(); - } - else if (aRequest instanceof HTTPAdapters.HTTPRequestAdapter) { - request = ((HTTPAdapters.HTTPRequestAdapter) aRequest).getRequest(); - } - if (request!=null) { - browser = (String) request.getHeader("User-Agent"); - address = request.getRemoteAddr(); - cookies = request.getCookies(); - } - - logComment(address, aComment.getId(), new Date(), browser); - - MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = MirGlobal.localizer().adminInterface().simpleCommentOperationForName(commentBlockAction); - - if (checkCookie(Arrays.asList(cookies)) || checkIpFilter(address) || checkRegExpFilter(aComment)) { - operation.perform(null, MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter("comment", aComment)); - setCookie(aResponse); - } - - logger.info("checkComment: " + (System.currentTimeMillis()-time) + "ms"); - } - catch (Throwable t) { - logger.error("Abuse.checkComment: " + t.toString()); - } - } - - public void checkArticle(EntityContent anArticle, HttpServletRequest aRequest, HttpServletResponse aResponse) { - try { - long time = System.currentTimeMillis(); - - logArticle(aRequest.getRemoteAddr(), anArticle.getId(), new Date(), (String) aRequest.getHeader("User-Agent")); - - MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = MirGlobal.localizer().adminInterface().simpleCommentOperationForName(commentBlockAction); - - if (checkCookie(Arrays.asList(aRequest.getCookies())) || checkIpFilter(aRequest.getRemoteAddr()) || checkRegExpFilter(anArticle)) { - operation.perform(null, MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter("content", anArticle)); - setCookie(aResponse); - } - - logger.info("checkArticle: " + (System.currentTimeMillis()-time) + "ms"); - } - catch (Throwable t) { - logger.error("Abuse.checkArticle: " + t.toString()); - } - } - - public boolean getLogEnabled() { - return logEnabled; - } - - public void setLogEnabled(boolean anEnabled) { - logEnabled = anEnabled; - truncateLog(); - } - - public int getLogSize() { - return logSize; - } - - public void setLogSize(int aSize) { - logSize = aSize; - truncateLog(); - } - - public boolean getOpenPostingDisabled() { - return openPostingDisabled; - } - - public void setOpenPostingDisabled(boolean anOpenPostingDisabled) { - openPostingDisabled = anOpenPostingDisabled; - } - - public boolean getOpenPostingPassword() { - return openPostingPassword; - } - - public void setOpenPostingPassword(boolean anOpenPostingPassword) { - openPostingPassword = anOpenPostingPassword; - } - - public boolean getCookieOnBlock() { - return cookieOnBlock; - } - - public void setCookieOnBlock(boolean aCookieOnBlock) { - cookieOnBlock = aCookieOnBlock; - } - - public String getArticleBlockAction() { - return articleBlockAction; - } - - public void setArticleBlockAction(String anAction) { - articleBlockAction = anAction; - } - - public String getCommentBlockAction() { - return commentBlockAction; - } - - public void setCommentBlockAction(String anAction) { - commentBlockAction = anAction; - } - - - public List getLog() { - synchronized(log) { - List result = new Vector(); - - Iterator i = log.iterator(); - while (i.hasNext()) { - LogEntry logEntry = (LogEntry) i.next(); - Map entry = new HashMap(); - - entry.put("ip", logEntry.getIpNumber()); - entry.put("id", logEntry.getId()); - entry.put("timestamp", new DateToMapAdapter(logEntry.getTimeStamp())); - if (logEntry.getIsArticle()) - entry.put("type", "content"); - else - entry.put("type", "comment"); - entry.put("browser", logEntry.getBrowserString()); - - result.add(entry); - } - - return result; - } - } - - public void logComment(String anIp, String anId, Date aTimeStamp, String aBrowser) { - appendLog(new LogEntry(aTimeStamp, anIp, aBrowser, anId, false)); - } - - public void logArticle(String anIp, String anId, Date aTimeStamp, String aBrowser) { - appendLog(new LogEntry(aTimeStamp, anIp, aBrowser, anId, true)); - } - - public void load() { - try { - ExtendedProperties configuration = new ExtendedProperties(); - - try { - configuration = new ExtendedProperties(configFile); - } - catch (FileNotFoundException e) { - } - - getFilterConfig(filters, "abuse.filter", configuration); - - setOpenPostingDisabled(configuration.getString("abuse.openPostingDisabled", "0").equals("1")); - setOpenPostingPassword(configuration.getString("abuse.openPostingPassword", "0").equals("1")); - setCookieOnBlock(configuration.getString("abuse.cookieOnBlock", "0").equals("1")); - setLogEnabled(configuration.getString("abuse.logEnabled", "0").equals("1")); - setLogSize(configuration.getInt("abuse.logSize", 10)); - setArticleBlockAction(configuration.getString("abuse.articleBlockAction", "")); - setCommentBlockAction(configuration.getString("abuse.commentBlockAction", "")); - } - catch (Throwable t) { - throw new RuntimeException(t.toString()); - } - } - public void save() { - try { - ExtendedProperties configuration = new ExtendedProperties(); - - setFilterConfig(filters, "abuse.filter", configuration); - - configuration.addProperty("abuse.openPostingDisabled", getOpenPostingDisabled()?"1":"0"); - configuration.addProperty("abuse.openPostingPassword", getOpenPostingPassword()?"1":"0"); - configuration.addProperty("abuse.cookieOnBlock", getCookieOnBlock()?"1":"0"); - configuration.addProperty("abuse.logEnabled", getLogEnabled()?"1":"0"); - configuration.addProperty("abuse.logSize", Integer.toString(getLogSize())); - configuration.addProperty("abuse.articleBlockAction", getArticleBlockAction()); - configuration.addProperty("abuse.commentBlockAction", getCommentBlockAction()); - - configuration.save(new FileOutputStream(new File(configFile)), "Anti abuse configuration"); - } - catch (Throwable t) { - throw new RuntimeException(t.toString()); - } - } - - public List getFilterTypes() { - List result = new Vector(); - - Map entry = new HashMap(); - entry.put("resource", "ip"); - entry.put("id", IP_FILTER_TYPE); - result.add(entry); - - entry = new HashMap(); - entry.put("resource", "regexp"); - entry.put("id", REGEXP_FILTER_TYPE); - result.add(entry); - - return result; - } - - public List getArticleActions() { - try { - List result = new Vector(); - - Iterator i = MirGlobal.localizer().adminInterface().simpleArticleOperations().iterator(); - while (i.hasNext()) { - MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = - (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next(); - - Map action = new HashMap(); - action.put("resource", operation.getName()); - action.put("identifier", operation.getName()); - - result.add(action); - } - - return result; - } - catch (Throwable t) { - throw new RuntimeException("can't get article actions"); - } - } - - public List getCommentActions() { - try { - List result = new Vector(); - - Iterator i = MirGlobal.localizer().adminInterface().simpleCommentOperations().iterator(); - while (i.hasNext()) { - MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = - (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next(); - - Map action = new HashMap(); - action.put("resource", operation.getName()); - action.put("identifier", operation.getName()); - - result.add(action); - } - - return result; - } - catch (Throwable t) { - throw new RuntimeException("can't get comment actions"); - } - } - - public List getFilters() { - return getFiltersAsMaps(filters); - } - - public void addFilter(String aType, String anExpression) { - addFilter(filters, aType, anExpression); - } - - public void setFilter(String anIdentifier, String aType, String anExpression) { - setFilter(filters, anIdentifier, aType, anExpression); - } - - public void deleteFilter(String anIdentifier) { - deleteFilter(filters, anIdentifier); - } - - public void validateIpFilter(String anIdentifier, String anArticleAction, String aCommentAction) throws Exception { - } - - private List getFiltersAsMaps(List aFilters) { - synchronized(aFilters) { - List result = new Vector(); - - Iterator i = aFilters.iterator(); - while (i.hasNext()) { - Filter filter = (Filter) i.next(); - Map map = new HashMap(); - - map.put("id", filter.getId()); - map.put("expression", filter.getExpression()); - map.put("type", filter.getType()); - - result.add(map); - } - return result; - } - } - - private void addFilter(List aFilters, String aType, String anExpression) { - Filter filter = new Filter(); - - filter.setId(generateId()); - filter.setExpression(anExpression); - filter.setType(aType); - - synchronized (aFilters) { - aFilters.add(filter); - } - } - - private void setFilter(List aFilters, String anIdentifier, String aType, String anExpression) { - synchronized (aFilters) { - Filter filter = findFilter(aFilters, anIdentifier); - - if (filter!=null) { - filter.setExpression(anExpression); - filter.setType(aType); - } - } - } - - private Filter findFilter(List aFilters, String anIdentifier) { - synchronized (aFilters) { - Iterator i = aFilters.iterator(); - while (i.hasNext()) { - Filter filter = (Filter) i.next(); - - if (filter.getId().equals(anIdentifier)) { - return filter; - } - } - } - - return null; - } - - private void deleteFilter(List aFilters, String anIdentifier) { - synchronized (aFilters) { - Filter filter = findFilter(aFilters, anIdentifier); - - if (filter!=null) { - aFilters.remove(filter); - } - } - } - - private String generateId() { - synchronized(this) { - maxIdentifier = maxIdentifier+1; - - return Integer.toString(maxIdentifier); - } - } - - private static class Filter { - private String identifier; - private String expression; - private String type; - - public Filter() { - expression=""; - type=""; - identifier=""; - } - - public String getId() { - return identifier; - } - - public void setId(String anId) { - identifier = anId; - } - - public String getExpression() { - return expression; - } - - public void setExpression(String anExpression) { - expression = anExpression; - } - - public String getType() { - return type; - } - - public void setType(String aType) { - type = aType; - } - } - - private void setFilterConfig(List aFilters, String aConfigKey, ExtendedProperties aConfiguration) { - synchronized(aFilters) { - Iterator i = aFilters.iterator(); - - while (i.hasNext()) { - Filter filter = (Filter) i.next(); - - aConfiguration.addProperty(aConfigKey, filter.getType()+":"+filter.getExpression()); - } - } - } - - private void getFilterConfig(List aFilters, String aConfigKey, ExtendedProperties aConfiguration) { - synchronized(aFilters) { - aFilters.clear(); - - Iterator i = Arrays.asList(aConfiguration.getStringArray(aConfigKey)).iterator(); - - while (i.hasNext()) { - String filter = (String) i.next(); - List parts = StringRoutines.separateString(filter, ":"); - - if (parts.size()==2) { - addFilter( (String) parts.get(0), (String) parts.get(1)); - } - } - } - } - - private static class LogEntry { - private String ipNumber; - private String browserString; - private String id; - private Date timeStamp; - private boolean isArticle; - - public LogEntry(Date aTimeStamp, String anIpNumber, String aBrowserString, String anId, boolean anIsArticle) { - ipNumber = anIpNumber; - browserString = aBrowserString; - id = anId; - isArticle = anIsArticle; - timeStamp=aTimeStamp; - } - - public String getIpNumber() { - return ipNumber; - } - - public String getBrowserString() { - return browserString; - } - - public String getId() { - return id; - } - - public Date getTimeStamp() { - return timeStamp; - } - - public boolean getIsArticle() { - return isArticle; - } - } - - private void truncateLog() { - synchronized(log) { - if (!logEnabled) - log.clear(); - else { - while (log.size()>0 && log.size()>logSize) { - log.remove(0); - } - } - } - }; - - private void appendLog(LogEntry anEntry) { - synchronized (log) { - if (logEnabled) { - log.add(anEntry); - truncateLog(); - } - } - } - +import mircoders.localizer.MirAdminInterfaceLocalizer; + +import org.apache.commons.collections.ExtendedProperties; + + +public class Abuse { + private List filters; + private int maxIdentifier; + private LoggerWrapper logger; + private int logSize; + private boolean logEnabled; + private boolean openPostingDisabled; + private boolean openPostingPassword; + private boolean cookieOnBlock; + private String articleBlockAction; + private String commentBlockAction; + private List log; + private String configFile = MirGlobal.config().getStringWithHome("Abuse.Config"); + + + private static final String IP_FILTER_TYPE="ip"; + private static final String REGEXP_FILTER_TYPE="regexp"; + private static String cookieName=MirGlobal.config().getString("Abuse.CookieName"); + private static int cookieMaxAge = 60*60*MirGlobal.config().getInt("Abuse.CookieMaxAge"); + + public Abuse() { + logger = new LoggerWrapper("Global.Abuse"); + filters = new Vector(); + maxIdentifier = 0; + log = new Vector(); + + logSize = 100; + logEnabled = false; + articleBlockAction = ""; + commentBlockAction = ""; + openPostingPassword = false; + openPostingDisabled = false; + cookieOnBlock = false; + + load(); + } + + public boolean checkIpFilter(String anIpAddress) { + synchronized (filters) { + Iterator i = filters.iterator(); + + while (i.hasNext()) { + Filter filter = (Filter) i.next(); + + try { + if ( (filter.getType().equals(IP_FILTER_TYPE)) && + InternetFunctions.isIpAddressInNetwork(anIpAddress, filter.getExpression())) { + logger.debug("ip match on " + filter.getExpression()); + return true; + } + } + catch (Throwable t) { + logger.warn("error while checking ip address " + anIpAddress + " over network " + filter.expression + ": " + t.getMessage()); + } + } + + return false; + } + } + + private boolean checkRegExpFilter(Entity anEntity) { + synchronized (filters) { + Iterator i = filters.iterator(); + + while (i.hasNext()) { + Filter filter = (Filter) i.next(); + + if (filter.getType().equals(REGEXP_FILTER_TYPE)) { + try { + RE regularExpression = new RE(filter.getExpression()); + + Iterator j = anEntity.getFields().iterator(); + while (j.hasNext()) { + String field = anEntity.getValue( (String) j.next()); + + if (field != null && regularExpression.isMatch(field.toLowerCase())) { + logger.debug("regexp match on " + filter.getExpression()); + return true; + } + } + } + catch (Throwable t) { + logger.warn("error while checking entity with regexp " + filter.getExpression() + ": " + t.getMessage()); + } + } + } + + return false; + } + } + + private void setCookie(HttpServletResponse aResponse) { + Random random = new Random(); + + Cookie cookie = new Cookie(cookieName, Integer.toString(random.nextInt(1000000000))); + cookie.setMaxAge(cookieMaxAge); + cookie.setPath("/"); + + if (aResponse!=null) + aResponse.addCookie(cookie); + } + + private boolean checkCookie(List aCookies) { + if (getCookieOnBlock()) { + Iterator i = aCookies.iterator(); + + while (i.hasNext()) { + Cookie cookie = (Cookie) i.next(); + + if (cookie.getName().equals(cookieName)) { + logger.debug("cookie match"); + return true; + } + } + } + + return false; + } + + public void checkComment(EntityComment aComment, Request aRequest, HttpServletResponse aResponse) { + try { + long time = System.currentTimeMillis(); + String address = "0.0.0.0"; + String browser = "unknown"; + Cookie[] cookies = {}; + + HttpServletRequest request = null; + + if (aRequest instanceof HTTPAdapters.HTTPParsedRequestAdapter) { + request = ((HTTPAdapters.HTTPParsedRequestAdapter) aRequest).getRequest(); + } + else if (aRequest instanceof HTTPAdapters.HTTPRequestAdapter) { + request = ((HTTPAdapters.HTTPRequestAdapter) aRequest).getRequest(); + } + if (request!=null) { + browser = (String) request.getHeader("User-Agent"); + address = request.getRemoteAddr(); + cookies = request.getCookies(); + } + + logComment(address, aComment.getId(), new Date(), browser); + + MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = MirGlobal.localizer().adminInterface().simpleCommentOperationForName(commentBlockAction); + + if (checkCookie(Arrays.asList(cookies)) || checkIpFilter(address) || checkRegExpFilter(aComment)) { + operation.perform(null, MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter("comment", aComment)); + setCookie(aResponse); + } + + logger.info("checkComment: " + (System.currentTimeMillis()-time) + "ms"); + } + catch (Throwable t) { + logger.error("Abuse.checkComment: " + t.toString()); + } + } + + public void checkArticle(EntityContent anArticle, HttpServletRequest aRequest, HttpServletResponse aResponse) { + try { + long time = System.currentTimeMillis(); + + logArticle(aRequest.getRemoteAddr(), anArticle.getId(), new Date(), (String) aRequest.getHeader("User-Agent")); + + MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = MirGlobal.localizer().adminInterface().simpleCommentOperationForName(commentBlockAction); + + if (checkCookie(Arrays.asList(aRequest.getCookies())) || checkIpFilter(aRequest.getRemoteAddr()) || checkRegExpFilter(anArticle)) { + operation.perform(null, MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter("content", anArticle)); + setCookie(aResponse); + } + + logger.info("checkArticle: " + (System.currentTimeMillis()-time) + "ms"); + } + catch (Throwable t) { + logger.error("Abuse.checkArticle: " + t.toString()); + } + } + + public boolean getLogEnabled() { + return logEnabled; + } + + public void setLogEnabled(boolean anEnabled) { + logEnabled = anEnabled; + truncateLog(); + } + + public int getLogSize() { + return logSize; + } + + public void setLogSize(int aSize) { + logSize = aSize; + truncateLog(); + } + + public boolean getOpenPostingDisabled() { + return openPostingDisabled; + } + + public void setOpenPostingDisabled(boolean anOpenPostingDisabled) { + openPostingDisabled = anOpenPostingDisabled; + } + + public boolean getOpenPostingPassword() { + return openPostingPassword; + } + + public void setOpenPostingPassword(boolean anOpenPostingPassword) { + openPostingPassword = anOpenPostingPassword; + } + + public boolean getCookieOnBlock() { + return cookieOnBlock; + } + + public void setCookieOnBlock(boolean aCookieOnBlock) { + cookieOnBlock = aCookieOnBlock; + } + + public String getArticleBlockAction() { + return articleBlockAction; + } + + public void setArticleBlockAction(String anAction) { + articleBlockAction = anAction; + } + + public String getCommentBlockAction() { + return commentBlockAction; + } + + public void setCommentBlockAction(String anAction) { + commentBlockAction = anAction; + } + + + public List getLog() { + synchronized(log) { + List result = new Vector(); + + Iterator i = log.iterator(); + while (i.hasNext()) { + LogEntry logEntry = (LogEntry) i.next(); + Map entry = new HashMap(); + + entry.put("ip", logEntry.getIpNumber()); + entry.put("id", logEntry.getId()); + entry.put("timestamp", new DateToMapAdapter(logEntry.getTimeStamp())); + if (logEntry.getIsArticle()) + entry.put("type", "content"); + else + entry.put("type", "comment"); + entry.put("browser", logEntry.getBrowserString()); + + result.add(entry); + } + + return result; + } + } + + public void logComment(String anIp, String anId, Date aTimeStamp, String aBrowser) { + appendLog(new LogEntry(aTimeStamp, anIp, aBrowser, anId, false)); + } + + public void logArticle(String anIp, String anId, Date aTimeStamp, String aBrowser) { + appendLog(new LogEntry(aTimeStamp, anIp, aBrowser, anId, true)); + } + + public void load() { + try { + ExtendedProperties configuration = new ExtendedProperties(); + + try { + configuration = new ExtendedProperties(configFile); + } + catch (FileNotFoundException e) { + } + + getFilterConfig(filters, "abuse.filter", configuration); + + setOpenPostingDisabled(configuration.getString("abuse.openPostingDisabled", "0").equals("1")); + setOpenPostingPassword(configuration.getString("abuse.openPostingPassword", "0").equals("1")); + setCookieOnBlock(configuration.getString("abuse.cookieOnBlock", "0").equals("1")); + setLogEnabled(configuration.getString("abuse.logEnabled", "0").equals("1")); + setLogSize(configuration.getInt("abuse.logSize", 10)); + setArticleBlockAction(configuration.getString("abuse.articleBlockAction", "")); + setCommentBlockAction(configuration.getString("abuse.commentBlockAction", "")); + } + catch (Throwable t) { + throw new RuntimeException(t.toString()); + } + } + public void save() { + try { + ExtendedProperties configuration = new ExtendedProperties(); + + setFilterConfig(filters, "abuse.filter", configuration); + + configuration.addProperty("abuse.openPostingDisabled", getOpenPostingDisabled()?"1":"0"); + configuration.addProperty("abuse.openPostingPassword", getOpenPostingPassword()?"1":"0"); + configuration.addProperty("abuse.cookieOnBlock", getCookieOnBlock()?"1":"0"); + configuration.addProperty("abuse.logEnabled", getLogEnabled()?"1":"0"); + configuration.addProperty("abuse.logSize", Integer.toString(getLogSize())); + configuration.addProperty("abuse.articleBlockAction", getArticleBlockAction()); + configuration.addProperty("abuse.commentBlockAction", getCommentBlockAction()); + + configuration.save(new FileOutputStream(new File(configFile)), "Anti abuse configuration"); + } + catch (Throwable t) { + throw new RuntimeException(t.toString()); + } + } + + public List getFilterTypes() { + List result = new Vector(); + + Map entry = new HashMap(); + entry.put("resource", "ip"); + entry.put("id", IP_FILTER_TYPE); + result.add(entry); + + entry = new HashMap(); + entry.put("resource", "regexp"); + entry.put("id", REGEXP_FILTER_TYPE); + result.add(entry); + + return result; + } + + public List getArticleActions() { + try { + List result = new Vector(); + + Iterator i = MirGlobal.localizer().adminInterface().simpleArticleOperations().iterator(); + while (i.hasNext()) { + MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = + (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next(); + + Map action = new HashMap(); + action.put("resource", operation.getName()); + action.put("identifier", operation.getName()); + + result.add(action); + } + + return result; + } + catch (Throwable t) { + throw new RuntimeException("can't get article actions"); + } + } + + public List getCommentActions() { + try { + List result = new Vector(); + + Iterator i = MirGlobal.localizer().adminInterface().simpleCommentOperations().iterator(); + while (i.hasNext()) { + MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = + (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next(); + + Map action = new HashMap(); + action.put("resource", operation.getName()); + action.put("identifier", operation.getName()); + + result.add(action); + } + + return result; + } + catch (Throwable t) { + throw new RuntimeException("can't get comment actions"); + } + } + + public List getFilters() { + return getFiltersAsMaps(filters); + } + + public void addFilter(String aType, String anExpression) { + addFilter(filters, aType, anExpression); + } + + public void setFilter(String anIdentifier, String aType, String anExpression) { + setFilter(filters, anIdentifier, aType, anExpression); + } + + public void deleteFilter(String anIdentifier) { + deleteFilter(filters, anIdentifier); + } + + public void validateIpFilter(String anIdentifier, String anArticleAction, String aCommentAction) throws Exception { + } + + private List getFiltersAsMaps(List aFilters) { + synchronized(aFilters) { + List result = new Vector(); + + Iterator i = aFilters.iterator(); + while (i.hasNext()) { + Filter filter = (Filter) i.next(); + Map map = new HashMap(); + + map.put("id", filter.getId()); + map.put("expression", filter.getExpression()); + map.put("type", filter.getType()); + + result.add(map); + } + return result; + } + } + + private void addFilter(List aFilters, String aType, String anExpression) { + Filter filter = new Filter(); + + filter.setId(generateId()); + filter.setExpression(anExpression); + filter.setType(aType); + + synchronized (aFilters) { + aFilters.add(filter); + } + } + + private void setFilter(List aFilters, String anIdentifier, String aType, String anExpression) { + synchronized (aFilters) { + Filter filter = findFilter(aFilters, anIdentifier); + + if (filter!=null) { + filter.setExpression(anExpression); + filter.setType(aType); + } + } + } + + private Filter findFilter(List aFilters, String anIdentifier) { + synchronized (aFilters) { + Iterator i = aFilters.iterator(); + while (i.hasNext()) { + Filter filter = (Filter) i.next(); + + if (filter.getId().equals(anIdentifier)) { + return filter; + } + } + } + + return null; + } + + private void deleteFilter(List aFilters, String anIdentifier) { + synchronized (aFilters) { + Filter filter = findFilter(aFilters, anIdentifier); + + if (filter!=null) { + aFilters.remove(filter); + } + } + } + + private String generateId() { + synchronized(this) { + maxIdentifier = maxIdentifier+1; + + return Integer.toString(maxIdentifier); + } + } + + private static class Filter { + private String identifier; + private String expression; + private String type; + + public Filter() { + expression=""; + type=""; + identifier=""; + } + + public String getId() { + return identifier; + } + + public void setId(String anId) { + identifier = anId; + } + + public String getExpression() { + return expression; + } + + public void setExpression(String anExpression) { + expression = anExpression; + } + + public String getType() { + return type; + } + + public void setType(String aType) { + type = aType; + } + } + + private void setFilterConfig(List aFilters, String aConfigKey, ExtendedProperties aConfiguration) { + synchronized(aFilters) { + Iterator i = aFilters.iterator(); + + while (i.hasNext()) { + Filter filter = (Filter) i.next(); + + aConfiguration.addProperty(aConfigKey, filter.getType()+":"+filter.getExpression()); + } + } + } + + private void getFilterConfig(List aFilters, String aConfigKey, ExtendedProperties aConfiguration) { + synchronized(aFilters) { + aFilters.clear(); + + Iterator i = Arrays.asList(aConfiguration.getStringArray(aConfigKey)).iterator(); + + while (i.hasNext()) { + String filter = (String) i.next(); + List parts = StringRoutines.separateString(filter, ":"); + + if (parts.size()==2) { + addFilter( (String) parts.get(0), (String) parts.get(1)); + } + } + } + } + + private static class LogEntry { + private String ipNumber; + private String browserString; + private String id; + private Date timeStamp; + private boolean isArticle; + + public LogEntry(Date aTimeStamp, String anIpNumber, String aBrowserString, String anId, boolean anIsArticle) { + ipNumber = anIpNumber; + browserString = aBrowserString; + id = anId; + isArticle = anIsArticle; + timeStamp=aTimeStamp; + } + + public String getIpNumber() { + return ipNumber; + } + + public String getBrowserString() { + return browserString; + } + + public String getId() { + return id; + } + + public Date getTimeStamp() { + return timeStamp; + } + + public boolean getIsArticle() { + return isArticle; + } + } + + private void truncateLog() { + synchronized(log) { + if (!logEnabled) + log.clear(); + else { + while (log.size()>0 && log.size()>logSize) { + log.remove(0); + } + } + } + }; + + private void appendLog(LogEntry anEntry) { + synchronized (log) { + if (logEnabled) { + log.add(anEntry); + truncateLog(); + } + } + } + } \ No newline at end of file diff --git a/source/mircoders/global/CacheKey.java b/source/mircoders/global/CacheKey.java index 0e10fc80..63fead02 100755 --- a/source/mircoders/global/CacheKey.java +++ b/source/mircoders/global/CacheKey.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.global; diff --git a/source/mircoders/global/JobQueue.java b/source/mircoders/global/JobQueue.java index 375d287e..fe20e67e 100755 --- a/source/mircoders/global/JobQueue.java +++ b/source/mircoders/global/JobQueue.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.global; diff --git a/source/mircoders/global/MRUCache.java b/source/mircoders/global/MRUCache.java index f0c1a4e3..c3d2ee56 100755 --- a/source/mircoders/global/MRUCache.java +++ b/source/mircoders/global/MRUCache.java @@ -1,124 +1,120 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir 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 of the License, or - * (at your option) any later version. - * - * Mir 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 Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package mircoders.global; - - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.Map; - -import mir.config.MirPropertiesConfiguration; -import mir.config.MirPropertiesConfiguration.PropertiesConfigExc; -import mir.log.LoggerWrapper; - -import mircoders.global.CacheKey; - -public class MRUCache { - private Map cache; - private LinkedList mruList; - private int cacheMaxItems; - - private MirPropertiesConfiguration configuration; - private LoggerWrapper logger; - - - - public MRUCache() { - logger = new LoggerWrapper("Global.MRUCache"); - try { - configuration = MirPropertiesConfiguration.instance(); - } - catch (PropertiesConfigExc e) { - throw new RuntimeException("Can't get configuration: " + e.getMessage()); - } - cacheMaxItems=Integer.parseInt(configuration.getString("Global.Cache.Items")); - cache = new HashMap(); - mruList= new LinkedList(); - - } - - /** - * Checks if the cache has an object with the specified key - */ - - public boolean hasObject(CacheKey aCacheKey) { - synchronized (cache) { - logger.info("MRUCache was this big : "+ mruList.size()); - return cache.containsKey(aCacheKey); - } - } - - /** - * Stores an object in the cache by placing it at the top of the - * list If the object is in the cache, it promotes it to the top of - * the list. If the object is not in the cache, it adds it to the - * top of the list, and then checks the max size of the cache versus - * the new size to see if it needs to remove the last element from - * the cache. - */ - - public void storeObject(CacheKey aCacheKey,Object data) { - synchronized (cache) { - if (! hasObject(aCacheKey)){ - // add to the cache - cache.put(aCacheKey,data); - if (mruList.size() >= cacheMaxItems){ - removeObject((CacheKey) mruList.getLast()); - } - } - mruList.remove(aCacheKey); - mruList.addFirst(aCacheKey); - } - } - - public void removeObject(CacheKey aCacheKey){ - synchronized (cache) { - mruList.remove(aCacheKey); - cache.remove(aCacheKey); - } - } - - /** - * Moves requested item to front of cache - */ - - public Object getObject(CacheKey aCacheKey){ - synchronized (cache) { - mruList.remove(aCacheKey); - mruList.addFirst(aCacheKey); - return cache.get(aCacheKey); - } - } -} - - - +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir 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 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package mircoders.global; + + +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Map; + +import mir.config.MirPropertiesConfiguration; +import mir.config.MirPropertiesConfiguration.PropertiesConfigExc; +import mir.log.LoggerWrapper; + +public class MRUCache { + private Map cache; + private LinkedList mruList; + private int cacheMaxItems; + + private MirPropertiesConfiguration configuration; + private LoggerWrapper logger; + + + + public MRUCache() { + logger = new LoggerWrapper("Global.MRUCache"); + try { + configuration = MirPropertiesConfiguration.instance(); + } + catch (PropertiesConfigExc e) { + throw new RuntimeException("Can't get configuration: " + e.getMessage()); + } + cacheMaxItems=Integer.parseInt(configuration.getString("Global.Cache.Items")); + cache = new HashMap(); + mruList= new LinkedList(); + + } + + /** + * Checks if the cache has an object with the specified key + */ + + public boolean hasObject(CacheKey aCacheKey) { + synchronized (cache) { + logger.info("MRUCache was this big : "+ mruList.size()); + return cache.containsKey(aCacheKey); + } + } + + /** + * Stores an object in the cache by placing it at the top of the + * list If the object is in the cache, it promotes it to the top of + * the list. If the object is not in the cache, it adds it to the + * top of the list, and then checks the max size of the cache versus + * the new size to see if it needs to remove the last element from + * the cache. + */ + + public void storeObject(CacheKey aCacheKey,Object data) { + synchronized (cache) { + if (! hasObject(aCacheKey)){ + // add to the cache + cache.put(aCacheKey,data); + if (mruList.size() >= cacheMaxItems){ + removeObject((CacheKey) mruList.getLast()); + } + } + mruList.remove(aCacheKey); + mruList.addFirst(aCacheKey); + } + } + + public void removeObject(CacheKey aCacheKey){ + synchronized (cache) { + mruList.remove(aCacheKey); + cache.remove(aCacheKey); + } + } + + /** + * Moves requested item to front of cache + */ + + public Object getObject(CacheKey aCacheKey){ + synchronized (cache) { + mruList.remove(aCacheKey); + mruList.addFirst(aCacheKey); + return cache.get(aCacheKey); + } + } +} + + + diff --git a/source/mircoders/global/MirGlobal.java b/source/mircoders/global/MirGlobal.java index a28888f4..ea72306d 100755 --- a/source/mircoders/global/MirGlobal.java +++ b/source/mircoders/global/MirGlobal.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.global; diff --git a/source/mircoders/global/ProducerEngine.java b/source/mircoders/global/ProducerEngine.java index ecccfdbd..fff103d1 100755 --- a/source/mircoders/global/ProducerEngine.java +++ b/source/mircoders/global/ProducerEngine.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.global; import java.io.PrintWriter; diff --git a/source/mircoders/localizer/MirAdminInterfaceLocalizer.java b/source/mircoders/localizer/MirAdminInterfaceLocalizer.java index 8afb19f3..35859353 100755 --- a/source/mircoders/localizer/MirAdminInterfaceLocalizer.java +++ b/source/mircoders/localizer/MirAdminInterfaceLocalizer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.localizer; import java.util.List; diff --git a/source/mircoders/localizer/MirCachingLocalizerDecorator.java b/source/mircoders/localizer/MirCachingLocalizerDecorator.java index 0c4a8252..e6d55617 100755 --- a/source/mircoders/localizer/MirCachingLocalizerDecorator.java +++ b/source/mircoders/localizer/MirCachingLocalizerDecorator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.localizer; diff --git a/source/mircoders/localizer/MirDataModelLocalizer.java b/source/mircoders/localizer/MirDataModelLocalizer.java index 54c63c68..3b72b409 100755 --- a/source/mircoders/localizer/MirDataModelLocalizer.java +++ b/source/mircoders/localizer/MirDataModelLocalizer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.localizer; diff --git a/source/mircoders/localizer/MirGeneratorLocalizer.java b/source/mircoders/localizer/MirGeneratorLocalizer.java index 7301d8c5..583391e5 100755 --- a/source/mircoders/localizer/MirGeneratorLocalizer.java +++ b/source/mircoders/localizer/MirGeneratorLocalizer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.localizer; diff --git a/source/mircoders/localizer/MirLocalizer.java b/source/mircoders/localizer/MirLocalizer.java index 8e3cf154..ae9610fb 100755 --- a/source/mircoders/localizer/MirLocalizer.java +++ b/source/mircoders/localizer/MirLocalizer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.localizer; diff --git a/source/mircoders/localizer/MirLocalizerExc.java b/source/mircoders/localizer/MirLocalizerExc.java index 927a9519..a68334aa 100755 --- a/source/mircoders/localizer/MirLocalizerExc.java +++ b/source/mircoders/localizer/MirLocalizerExc.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.localizer; diff --git a/source/mircoders/localizer/MirLocalizerFailure.java b/source/mircoders/localizer/MirLocalizerFailure.java index 6a56e615..8750a4d8 100755 --- a/source/mircoders/localizer/MirLocalizerFailure.java +++ b/source/mircoders/localizer/MirLocalizerFailure.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.localizer; diff --git a/source/mircoders/localizer/MirOpenPostingLocalizer.java b/source/mircoders/localizer/MirOpenPostingLocalizer.java index 6af0292f..66702498 100755 --- a/source/mircoders/localizer/MirOpenPostingLocalizer.java +++ b/source/mircoders/localizer/MirOpenPostingLocalizer.java @@ -1,78 +1,76 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir 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 of the License, or - * (at your option) any later version. - * - * Mir 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 Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package mircoders.localizer; - +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir 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 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package mircoders.localizer; + import mir.session.Request; import mir.session.Session; import mir.session.SessionHandler; import mircoders.entity.EntityComment; -import mircoders.entity.EntityContent; - -public interface MirOpenPostingLocalizer { - - /** - * Class to encapsulate a validation error - * - *

Title:

- *

Description:

- *

Copyright: Copyright (c) 2003

- *

Company:

- * @author not attributable - * @version 1.0 - */ - - /** - * - * @param aRequest - * @param aSession - * @return - * @throws MirLocalizerExc - * @throws MirLocalizerFailure - */ - public SessionHandler getOpenSessionHandler(Request aRequest, Session aSession) throws MirLocalizerExc, MirLocalizerFailure; - - /** - * - * @param aComment - * @throws MirLocalizerExc - * @throws MirLocalizerFailure - */ - public void afterCommentPosting(EntityComment aComment) throws MirLocalizerExc, MirLocalizerFailure; - - /** - * - * @param aContent - * @throws MirLocalizerExc - * @throws MirLocalizerFailure - */ - public void afterContentPosting(EntityContent aContent) throws MirLocalizerExc, MirLocalizerFailure; -} +import mircoders.entity.EntityContent; + +public interface MirOpenPostingLocalizer { + + /** + * Class to encapsulate a validation error + * + *

Title:

+ *

Description:

+ *

Copyright: Copyright (c) 2003

+ *

Company:

+ * @author not attributable + * @version 1.0 + */ + + /** + * + * @param aRequest + * @param aSession + * @return + * @throws MirLocalizerExc + * @throws MirLocalizerFailure + */ + public SessionHandler getOpenSessionHandler(Request aRequest, Session aSession) throws MirLocalizerExc, MirLocalizerFailure; + + /** + * + * @param aComment + * @throws MirLocalizerExc + * @throws MirLocalizerFailure + */ + public void afterCommentPosting(EntityComment aComment) throws MirLocalizerExc, MirLocalizerFailure; + + /** + * + * @param aContent + * @throws MirLocalizerExc + * @throws MirLocalizerFailure + */ + public void afterContentPosting(EntityContent aContent) throws MirLocalizerExc, MirLocalizerFailure; +} diff --git a/source/mircoders/localizer/MirProducerAssistantLocalizer.java b/source/mircoders/localizer/MirProducerAssistantLocalizer.java index e4c57d68..190d18b5 100755 --- a/source/mircoders/localizer/MirProducerAssistantLocalizer.java +++ b/source/mircoders/localizer/MirProducerAssistantLocalizer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.localizer; import java.util.Map; diff --git a/source/mircoders/localizer/MirProducerLocalizer.java b/source/mircoders/localizer/MirProducerLocalizer.java index 0b1e040e..7090d486 100755 --- a/source/mircoders/localizer/MirProducerLocalizer.java +++ b/source/mircoders/localizer/MirProducerLocalizer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.localizer; import java.util.List; diff --git a/source/mircoders/localizer/basic/MirBasicAdminInterfaceLocalizer.java b/source/mircoders/localizer/basic/MirBasicAdminInterfaceLocalizer.java index 74e1b3ef..313b9c75 100755 --- a/source/mircoders/localizer/basic/MirBasicAdminInterfaceLocalizer.java +++ b/source/mircoders/localizer/basic/MirBasicAdminInterfaceLocalizer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.localizer.basic; import java.text.SimpleDateFormat; diff --git a/source/mircoders/localizer/basic/MirBasicCommentPostingSessionHandler.java b/source/mircoders/localizer/basic/MirBasicCommentPostingSessionHandler.java index 0b687368..de797a27 100755 --- a/source/mircoders/localizer/basic/MirBasicCommentPostingSessionHandler.java +++ b/source/mircoders/localizer/basic/MirBasicCommentPostingSessionHandler.java @@ -1,36 +1,34 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir 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 of the License, or - * (at your option) any later version. - * - * Mir 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 Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package mircoders.localizer.basic; - +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir 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 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package mircoders.localizer.basic; + import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; @@ -51,214 +49,214 @@ import mircoders.media.MediaUploadProcessor; import mircoders.module.ModuleComment; import mircoders.storage.DatabaseComment; import mircoders.storage.DatabaseCommentToMedia; -import mircoders.storage.DatabaseContent; - -/** - * - *

Title: Experimental session handler for comment postings

- *

Description:

- *

Copyright: Copyright (c) 2003

- *

Company:

- * @author not attributable - * @version 1.0 - */ - -public class MirBasicCommentPostingSessionHandler extends MirBasicPostingSessionHandler { - protected ModuleComment commentModule; - protected DatabaseCommentToMedia commentToMedia = DatabaseCommentToMedia.getInstance(); - - public MirBasicCommentPostingSessionHandler() { - super(); - - commentModule= new ModuleComment(DatabaseComment.getInstance()); - } - - public void processRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure { - if (aSession.getAttribute("initialRequest")==null) { - initialRequest(aRequest, aSession, aResponse); - aSession.setAttribute("initialRequest", "no"); - } - else { - subsequentRequest(aRequest, aSession, aResponse); - } - }; - - protected void initializeResponseData(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure { - super.initializeResponseData(aRequest, aSession, aResponse); - - Iterator i = DatabaseComment.getInstance().getFields().iterator(); - while (i.hasNext()) { - String field = (String) i.next(); - aResponse.setResponseValue(field, aRequest.getParameter(field)); - } - - }; - - public void initialRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure{ - super.initialRequest(aRequest, aSession, aResponse); - - String articleId = aRequest.getParameter("to_media"); - if (articleId == null) - throw new SessionExc("MirBasicCommentPostingSessionHandler.initialRequest: article id not set!"); - aSession.setAttribute("to_media", articleId); - - aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate")); - } - - public List validate(Request aRequest, Session aSession) throws SessionExc, SessionFailure { - List result = new Vector(); - - testFieldEntered(aRequest, "title", "validationerror.missing", result); - testFieldEntered(aRequest, "description", "validationerror.missing", result); - testFieldEntered(aRequest, "creator", "validationerror.missing", result); - - return result; - } - - public void subsequentRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure { - try { - initializeResponseData(aRequest, aSession, aResponse); - - List validationErrors = validate(aRequest, aSession); - - if (validationErrors != null && validationErrors.size()>0) { - returnValidationErrors(aRequest, aSession, aResponse, validationErrors); - } - else { - EntityComment comment = (EntityComment) commentModule.createNew (); - Iterator i = DatabaseComment.getInstance().getFields().iterator(); -// comment.setValues(commentFields); - - finishComment(aRequest, aSession, comment); - - String id = comment.insert(); - if(id==null){ - afterDuplicateCommentPosting(aRequest, aSession, aResponse, comment); - logger.info("Dupe comment rejected"); - aSession.terminate(); - } - else { - i = aRequest.getUploadedFiles().iterator(); - while (i.hasNext()) { - UploadedFile file = (UploadedFile) i.next(); - processMediaFile(aRequest, aSession, comment, file); - } - - afterCommentPosting(aRequest, aSession, aResponse, comment); - MirGlobal.abuse().checkComment(comment, aRequest, null); - MirGlobal.localizer().openPostings().afterCommentPosting(comment); - logger.info("Comment posted"); - aSession.terminate(); - } - } - } - catch (Throwable t) { - ExceptionFunctions.traceCauseException(t).printStackTrace(); - - throw new SessionFailure("MirBasicCommentPostingSessionHandler.subsequentRequest: " + t.getMessage(), t); - } - } - - public void initializeCommentPosting(Request aRequest, Session aSession, Response aResponse) throws SessionFailure, SessionExc { - String articleId = aRequest.getParameter("to_media"); - if (articleId==null) - articleId = aRequest.getParameter("aid"); - - if (articleId==null) - throw new SessionExc("initializeCommentPosting: article id not set!"); - - aSession.setAttribute("to_media", articleId); - processCommentPosting(aRequest, aSession, aResponse); - }; - - public void returnValidationErrors(Request aRequest, Session aSession, Response aResponse, List aValidationErrors) throws SessionFailure, SessionExc { - aResponse.setResponseValue("errors", aValidationErrors); - aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate")); - }; - - public void processCommentPosting(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure { - if (MirGlobal.abuse().getOpenPostingPassword()) { - String password = generateOnetimePassword(); - aSession.setAttribute("password", password); - aResponse.setResponseValue("password", password); - aResponse.setResponseValue("passwd", password); - } - else { - aResponse.setResponseValue("password", null); - } - - aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate")); - }; - - public void processMediaFile(Request aRequest, Session aSession, EntityComment aComment, UploadedFile aFile) throws SessionExc, SessionFailure { - try { - Entity mediaItem = MediaUploadProcessor.processMediaUpload(aFile, new HashMap()); - finishMedia(aRequest, aSession, aFile, mediaItem); - mediaItem.update(); - commentToMedia.addMedia(aComment.getId(), mediaItem.getId()); - } - catch (Throwable t) { - throw new SessionFailure(t); - } - } - - public void finishMedia(Request aRequest, Session aSession, UploadedFile aFile, Entity aMedia) throws SessionExc, SessionFailure { - } - - public void finishComment(Request aRequest, Session aSession, EntityComment aComment) throws SessionExc, SessionFailure { - if (aSession.getAttribute("to_media") == null) - throw new SessionExc("missing to_media"); - - aComment.setValueForProperty("is_published", "1"); - aComment.setValueForProperty("to_comment_status", "1"); - aComment.setValueForProperty("is_html","0"); - aComment.setValueForProperty("to_media", (String) aSession.getAttribute("to_media")); - }; - - public void addMedia(Request aRequest, Session aSession, EntityComment aComment) throws SessionExc, SessionFailure { - } - - public void afterCommentPosting(Request aRequest, Session aSession, Response aResponse, EntityComment aComment) { - DatabaseContent.getInstance().setUnproduced("id=" + aComment.getValue("to_media")); - aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.DoneTemplate")); - }; - - public void afterDuplicateCommentPosting(Request aRequest, Session aSession, Response aResponse, EntityComment aComment) { - aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.DupeTemplate")); - }; - - public class ValidationError { - private String field; - private String message; - private List parameters; - - public ValidationError(String aField, String aMessage) { - this (aField, aMessage, new String[] {}); - } - - public ValidationError(String aField, String aMessage, Object aParameter) { - this (aField, aMessage, new Object[] {aParameter}); - } - - public ValidationError(String aField, String aMessage, Object[] aParameters) { - field = aField; - message = aMessage; - parameters = Arrays.asList(aParameters); - } - - public String getMessage() { - return message; - } - - public String getField() { - return field; - } - - public List getParameters() { - return parameters; - } - } - - - +import mircoders.storage.DatabaseContent; + +/** + * + *

Title: Experimental session handler for comment postings

+ *

Description:

+ *

Copyright: Copyright (c) 2003

+ *

Company:

+ * @author not attributable + * @version 1.0 + */ + +public class MirBasicCommentPostingSessionHandler extends MirBasicPostingSessionHandler { + protected ModuleComment commentModule; + protected DatabaseCommentToMedia commentToMedia = DatabaseCommentToMedia.getInstance(); + + public MirBasicCommentPostingSessionHandler() { + super(); + + commentModule= new ModuleComment(DatabaseComment.getInstance()); + } + + public void processRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure { + if (aSession.getAttribute("initialRequest")==null) { + initialRequest(aRequest, aSession, aResponse); + aSession.setAttribute("initialRequest", "no"); + } + else { + subsequentRequest(aRequest, aSession, aResponse); + } + }; + + protected void initializeResponseData(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure { + super.initializeResponseData(aRequest, aSession, aResponse); + + Iterator i = DatabaseComment.getInstance().getFields().iterator(); + while (i.hasNext()) { + String field = (String) i.next(); + aResponse.setResponseValue(field, aRequest.getParameter(field)); + } + + }; + + public void initialRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure{ + super.initialRequest(aRequest, aSession, aResponse); + + String articleId = aRequest.getParameter("to_media"); + if (articleId == null) + throw new SessionExc("MirBasicCommentPostingSessionHandler.initialRequest: article id not set!"); + aSession.setAttribute("to_media", articleId); + + aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate")); + } + + public List validate(Request aRequest, Session aSession) throws SessionExc, SessionFailure { + List result = new Vector(); + + testFieldEntered(aRequest, "title", "validationerror.missing", result); + testFieldEntered(aRequest, "description", "validationerror.missing", result); + testFieldEntered(aRequest, "creator", "validationerror.missing", result); + + return result; + } + + public void subsequentRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure { + try { + initializeResponseData(aRequest, aSession, aResponse); + + List validationErrors = validate(aRequest, aSession); + + if (validationErrors != null && validationErrors.size()>0) { + returnValidationErrors(aRequest, aSession, aResponse, validationErrors); + } + else { + EntityComment comment = (EntityComment) commentModule.createNew (); + Iterator i = DatabaseComment.getInstance().getFields().iterator(); +// comment.setValues(commentFields); + + finishComment(aRequest, aSession, comment); + + String id = comment.insert(); + if(id==null){ + afterDuplicateCommentPosting(aRequest, aSession, aResponse, comment); + logger.info("Dupe comment rejected"); + aSession.terminate(); + } + else { + i = aRequest.getUploadedFiles().iterator(); + while (i.hasNext()) { + UploadedFile file = (UploadedFile) i.next(); + processMediaFile(aRequest, aSession, comment, file); + } + + afterCommentPosting(aRequest, aSession, aResponse, comment); + MirGlobal.abuse().checkComment(comment, aRequest, null); + MirGlobal.localizer().openPostings().afterCommentPosting(comment); + logger.info("Comment posted"); + aSession.terminate(); + } + } + } + catch (Throwable t) { + ExceptionFunctions.traceCauseException(t).printStackTrace(); + + throw new SessionFailure("MirBasicCommentPostingSessionHandler.subsequentRequest: " + t.getMessage(), t); + } + } + + public void initializeCommentPosting(Request aRequest, Session aSession, Response aResponse) throws SessionFailure, SessionExc { + String articleId = aRequest.getParameter("to_media"); + if (articleId==null) + articleId = aRequest.getParameter("aid"); + + if (articleId==null) + throw new SessionExc("initializeCommentPosting: article id not set!"); + + aSession.setAttribute("to_media", articleId); + processCommentPosting(aRequest, aSession, aResponse); + }; + + public void returnValidationErrors(Request aRequest, Session aSession, Response aResponse, List aValidationErrors) throws SessionFailure, SessionExc { + aResponse.setResponseValue("errors", aValidationErrors); + aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate")); + }; + + public void processCommentPosting(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure { + if (MirGlobal.abuse().getOpenPostingPassword()) { + String password = generateOnetimePassword(); + aSession.setAttribute("password", password); + aResponse.setResponseValue("password", password); + aResponse.setResponseValue("passwd", password); + } + else { + aResponse.setResponseValue("password", null); + } + + aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate")); + }; + + public void processMediaFile(Request aRequest, Session aSession, EntityComment aComment, UploadedFile aFile) throws SessionExc, SessionFailure { + try { + Entity mediaItem = MediaUploadProcessor.processMediaUpload(aFile, new HashMap()); + finishMedia(aRequest, aSession, aFile, mediaItem); + mediaItem.update(); + commentToMedia.addMedia(aComment.getId(), mediaItem.getId()); + } + catch (Throwable t) { + throw new SessionFailure(t); + } + } + + public void finishMedia(Request aRequest, Session aSession, UploadedFile aFile, Entity aMedia) throws SessionExc, SessionFailure { + } + + public void finishComment(Request aRequest, Session aSession, EntityComment aComment) throws SessionExc, SessionFailure { + if (aSession.getAttribute("to_media") == null) + throw new SessionExc("missing to_media"); + + aComment.setValueForProperty("is_published", "1"); + aComment.setValueForProperty("to_comment_status", "1"); + aComment.setValueForProperty("is_html","0"); + aComment.setValueForProperty("to_media", (String) aSession.getAttribute("to_media")); + }; + + public void addMedia(Request aRequest, Session aSession, EntityComment aComment) throws SessionExc, SessionFailure { + } + + public void afterCommentPosting(Request aRequest, Session aSession, Response aResponse, EntityComment aComment) { + DatabaseContent.getInstance().setUnproduced("id=" + aComment.getValue("to_media")); + aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.DoneTemplate")); + }; + + public void afterDuplicateCommentPosting(Request aRequest, Session aSession, Response aResponse, EntityComment aComment) { + aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.DupeTemplate")); + }; + + public class ValidationError { + private String field; + private String message; + private List parameters; + + public ValidationError(String aField, String aMessage) { + this (aField, aMessage, new String[] {}); + } + + public ValidationError(String aField, String aMessage, Object aParameter) { + this (aField, aMessage, new Object[] {aParameter}); + } + + public ValidationError(String aField, String aMessage, Object[] aParameters) { + field = aField; + message = aMessage; + parameters = Arrays.asList(aParameters); + } + + public String getMessage() { + return message; + } + + public String getField() { + return field; + } + + public List getParameters() { + return parameters; + } + } + + + } \ No newline at end of file diff --git a/source/mircoders/localizer/basic/MirBasicDataModelLocalizer.java b/source/mircoders/localizer/basic/MirBasicDataModelLocalizer.java index 597248bd..2ef0be8b 100755 --- a/source/mircoders/localizer/basic/MirBasicDataModelLocalizer.java +++ b/source/mircoders/localizer/basic/MirBasicDataModelLocalizer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,58 +18,56 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.localizer.basic; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Vector; - -import mir.config.MirPropertiesConfiguration; -import mir.entity.Entity; -import mir.entity.adapter.EntityAdapter; -import mir.entity.adapter.EntityAdapterDefinition; -import mir.entity.adapter.EntityAdapterModel; -import mir.log.LoggerWrapper; -import mir.media.MediaHelper; -import mir.media.MirMedia; -import mir.util.ParameterExpander; -import mir.util.RewindableIterator; -import mircoders.entity.EntityUploadedMedia; -import mircoders.global.MirGlobal; -import mircoders.localizer.MirAdminInterfaceLocalizer; -import mircoders.localizer.MirDataModelLocalizer; -import mircoders.localizer.MirLocalizerExc; -import mircoders.localizer.MirLocalizerFailure; -import mircoders.storage.DatabaseArticleType; -import mircoders.storage.DatabaseAudio; -import mircoders.storage.DatabaseBreaking; -import mircoders.storage.DatabaseComment; -import mircoders.storage.DatabaseCommentStatus; -import mircoders.storage.DatabaseContent; -import mircoders.storage.DatabaseImageType; -import mircoders.storage.DatabaseImages; -import mircoders.storage.DatabaseLanguage; -import mircoders.storage.DatabaseMedia; -import mircoders.storage.DatabaseMediaType; -import mircoders.storage.DatabaseMediafolder; -import mircoders.storage.DatabaseMessages; -import mircoders.storage.DatabaseOther; -import mircoders.storage.DatabaseTopics; -import mircoders.storage.DatabaseUploadedMedia; -import mircoders.storage.DatabaseUsers; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import mir.config.MirPropertiesConfiguration; +import mir.entity.Entity; +import mir.entity.adapter.EntityAdapter; +import mir.entity.adapter.EntityAdapterDefinition; +import mir.entity.adapter.EntityAdapterModel; +import mir.log.LoggerWrapper; +import mir.media.MediaHelper; +import mir.media.MirMedia; +import mir.util.ParameterExpander; +import mir.util.RewindableIterator; +import mircoders.entity.EntityUploadedMedia; +import mircoders.global.MirGlobal; +import mircoders.localizer.MirAdminInterfaceLocalizer; +import mircoders.localizer.MirDataModelLocalizer; +import mircoders.localizer.MirLocalizerExc; +import mircoders.localizer.MirLocalizerFailure; +import mircoders.storage.DatabaseArticleType; +import mircoders.storage.DatabaseAudio; +import mircoders.storage.DatabaseBreaking; +import mircoders.storage.DatabaseComment; +import mircoders.storage.DatabaseCommentStatus; +import mircoders.storage.DatabaseContent; +import mircoders.storage.DatabaseImageType; +import mircoders.storage.DatabaseImages; +import mircoders.storage.DatabaseLanguage; +import mircoders.storage.DatabaseMedia; +import mircoders.storage.DatabaseMediaType; +import mircoders.storage.DatabaseMediafolder; +import mircoders.storage.DatabaseMessages; +import mircoders.storage.DatabaseOther; +import mircoders.storage.DatabaseTopics; +import mircoders.storage.DatabaseUploadedMedia; +import mircoders.storage.DatabaseUsers; import mircoders.storage.DatabaseVideo; public class MirBasicDataModelLocalizer implements MirDataModelLocalizer { diff --git a/source/mircoders/localizer/basic/MirBasicGeneratorLocalizer.java b/source/mircoders/localizer/basic/MirBasicGeneratorLocalizer.java index 666bcf49..c0a9784b 100755 --- a/source/mircoders/localizer/basic/MirBasicGeneratorLocalizer.java +++ b/source/mircoders/localizer/basic/MirBasicGeneratorLocalizer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.localizer.basic; diff --git a/source/mircoders/localizer/basic/MirBasicLocalizer.java b/source/mircoders/localizer/basic/MirBasicLocalizer.java index 50922c48..ad8d2387 100755 --- a/source/mircoders/localizer/basic/MirBasicLocalizer.java +++ b/source/mircoders/localizer/basic/MirBasicLocalizer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.localizer.basic; import mircoders.localizer.MirAdminInterfaceLocalizer; diff --git a/source/mircoders/localizer/basic/MirBasicOpenPostingLocalizer.java b/source/mircoders/localizer/basic/MirBasicOpenPostingLocalizer.java index 919678ca..62e01b1b 100755 --- a/source/mircoders/localizer/basic/MirBasicOpenPostingLocalizer.java +++ b/source/mircoders/localizer/basic/MirBasicOpenPostingLocalizer.java @@ -1,119 +1,117 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir 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 of the License, or - * (at your option) any later version. - * - * Mir 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 Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package mircoders.localizer.basic; - -import java.util.List; -import java.util.Random; - -import mir.config.MirPropertiesConfiguration; -import mir.log.LoggerWrapper; -import mir.session.Request; -import mir.session.Session; -import mir.session.SessionHandler; -import mircoders.entity.EntityComment; -import mircoders.entity.EntityContent; -import mircoders.global.MirGlobal; -import mircoders.global.ProducerEngine; -import mircoders.localizer.MirLocalizerExc; -import mircoders.localizer.MirLocalizerFailure; -import mircoders.localizer.MirOpenPostingLocalizer; - -public class MirBasicOpenPostingLocalizer implements MirOpenPostingLocalizer { - private List afterContentProducerTasks; - private List afterCommentProducerTasks; - protected LoggerWrapper logger; - protected MirPropertiesConfiguration configuration; - - - public MirBasicOpenPostingLocalizer() throws MirLocalizerExc, MirLocalizerFailure { - logger = new LoggerWrapper("Localizer.Basic.OpenPosting"); - - try { - configuration = MirPropertiesConfiguration.instance(); - } - catch (Throwable e) { - throw new MirLocalizerFailure("Can't get configuration: " + e.getMessage(), e); - } - - try { - String contentProducers = MirGlobal.config().getString("Mir.Localizer.OpenPosting.ContentProducers"); - String commentProducers = MirGlobal.config().getString("Mir.Localizer.OpenPosting.CommentProducers"); - - afterContentProducerTasks = ProducerEngine.ProducerTask.parseProducerTaskList(contentProducers); - afterCommentProducerTasks = ProducerEngine.ProducerTask.parseProducerTaskList(commentProducers); - } - catch (Throwable t) { - logger.error("Setting up MirBasicOpenPostingLocalizer failed: " + t.getMessage()); - - throw new MirLocalizerFailure(t); - } - } - - public SessionHandler getOpenSessionHandler(Request aRequest, Session aSession) throws MirLocalizerExc, MirLocalizerFailure { - if (aSession.getAttribute("handler")==null) - aSession.setAttribute("handler", new MirBasicCommentPostingSessionHandler()); - - return (SessionHandler) aSession.getAttribute("handler"); - } - - public void afterContentPosting() { - MirGlobal.producerEngine().addTasks(afterContentProducerTasks); - } - - public void afterContentPosting(EntityContent aContent) { - afterContentPosting(); - } - - public void afterCommentPosting(EntityComment aComment) { - afterCommentPosting(); - } - - public void afterCommentPosting() { - MirGlobal.producerEngine().addTasks(afterCommentProducerTasks); - } - - public String generateOnetimePassword() { - Random r = new Random(); - int random = r.nextInt(); - - long l = System.currentTimeMillis(); - - l = (l*l*l*l)/random; - if (l<0) - l = l * -1; - - String returnString = ""+l; - - return returnString.substring(5); - } - -} +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir 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 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package mircoders.localizer.basic; + +import java.util.List; +import java.util.Random; + +import mir.config.MirPropertiesConfiguration; +import mir.log.LoggerWrapper; +import mir.session.Request; +import mir.session.Session; +import mir.session.SessionHandler; +import mircoders.entity.EntityComment; +import mircoders.entity.EntityContent; +import mircoders.global.MirGlobal; +import mircoders.global.ProducerEngine; +import mircoders.localizer.MirLocalizerExc; +import mircoders.localizer.MirLocalizerFailure; +import mircoders.localizer.MirOpenPostingLocalizer; + +public class MirBasicOpenPostingLocalizer implements MirOpenPostingLocalizer { + private List afterContentProducerTasks; + private List afterCommentProducerTasks; + protected LoggerWrapper logger; + protected MirPropertiesConfiguration configuration; + + + public MirBasicOpenPostingLocalizer() throws MirLocalizerExc, MirLocalizerFailure { + logger = new LoggerWrapper("Localizer.Basic.OpenPosting"); + + try { + configuration = MirPropertiesConfiguration.instance(); + } + catch (Throwable e) { + throw new MirLocalizerFailure("Can't get configuration: " + e.getMessage(), e); + } + + try { + String contentProducers = MirGlobal.config().getString("Mir.Localizer.OpenPosting.ContentProducers"); + String commentProducers = MirGlobal.config().getString("Mir.Localizer.OpenPosting.CommentProducers"); + + afterContentProducerTasks = ProducerEngine.ProducerTask.parseProducerTaskList(contentProducers); + afterCommentProducerTasks = ProducerEngine.ProducerTask.parseProducerTaskList(commentProducers); + } + catch (Throwable t) { + logger.error("Setting up MirBasicOpenPostingLocalizer failed: " + t.getMessage()); + + throw new MirLocalizerFailure(t); + } + } + + public SessionHandler getOpenSessionHandler(Request aRequest, Session aSession) throws MirLocalizerExc, MirLocalizerFailure { + if (aSession.getAttribute("handler")==null) + aSession.setAttribute("handler", new MirBasicCommentPostingSessionHandler()); + + return (SessionHandler) aSession.getAttribute("handler"); + } + + public void afterContentPosting() { + MirGlobal.producerEngine().addTasks(afterContentProducerTasks); + } + + public void afterContentPosting(EntityContent aContent) { + afterContentPosting(); + } + + public void afterCommentPosting(EntityComment aComment) { + afterCommentPosting(); + } + + public void afterCommentPosting() { + MirGlobal.producerEngine().addTasks(afterCommentProducerTasks); + } + + public String generateOnetimePassword() { + Random r = new Random(); + int random = r.nextInt(); + + long l = System.currentTimeMillis(); + + l = (l*l*l*l)/random; + if (l<0) + l = l * -1; + + String returnString = ""+l; + + return returnString.substring(5); + } + +} diff --git a/source/mircoders/localizer/basic/MirBasicPostingSessionHandler.java b/source/mircoders/localizer/basic/MirBasicPostingSessionHandler.java index 245e6b3a..921eb099 100755 --- a/source/mircoders/localizer/basic/MirBasicPostingSessionHandler.java +++ b/source/mircoders/localizer/basic/MirBasicPostingSessionHandler.java @@ -1,36 +1,34 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir 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 of the License, or - * (at your option) any later version. - * - * Mir 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 Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package mircoders.localizer.basic; - +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir 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 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package mircoders.localizer.basic; + import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; @@ -57,316 +55,316 @@ import mircoders.media.MediaUploadProcessor; import mircoders.module.ModuleComment; import mircoders.storage.DatabaseComment; import mircoders.storage.DatabaseCommentToMedia; -import mircoders.storage.DatabaseContent; - -/** - * - *

Title: Experimental session handler for comment postings

- *

Description:

- *

Copyright: Copyright (c) 2003

- *

Company:

- * @author not attributable - * @version 1.0 - */ - -public class MirBasicPostingSessionHandler implements SessionHandler { - protected LoggerWrapper logger; - protected MirPropertiesConfiguration configuration; - protected ModuleComment commentModule; - protected DatabaseCommentToMedia commentToMedia = DatabaseCommentToMedia.getInstance(); - - public MirBasicPostingSessionHandler() { - logger = new LoggerWrapper("Localizer.OpenPosting"); - try { - configuration = MirPropertiesConfiguration.instance(); - } - catch (Throwable t) { - logger.fatal("Cannot load configuration: " + t.toString()); - - throw new RuntimeException("Cannot load configuration: " + t.toString()); - } - commentModule= new ModuleComment(DatabaseComment.getInstance()); - } - - public void processRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure { - if (aSession.getAttribute("initialRequest")==null) { - initialRequest(aRequest, aSession, aResponse); - aSession.setAttribute("initialRequest", "no"); - } - else { - subsequentRequest(aRequest, aSession, aResponse); - } - }; - - protected Map getIntersectingValues(Request aRequest, StorageObject aStorage) throws SessionExc, SessionFailure { - Map result = new HashMap(); - - Iterator i = aStorage.getFields().iterator(); - - while (i.hasNext()) { - String fieldName = (String) i.next(); - Object value = aRequest.getParameter(fieldName); - if (value != null) - result.put(fieldName, value); - } - - return result; - } - - - protected String generateOnetimePassword() { - Random r = new Random(); - int random = r.nextInt(); - - long l = System.currentTimeMillis(); - - l = (l*l*l*l)/random; - if (l<0) - l = l * -1; - - String returnString = ""+l; - - return returnString.substring(5); - } - - protected void initializeResponseData(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure { - if (MirGlobal.abuse().getOpenPostingPassword()) { - String password = (String) aSession.getAttribute("password"); - if (password==null) { - password = generateOnetimePassword(); - aSession.setAttribute("password", password); - } - aResponse.setResponseValue("password", password); - } - else { - aResponse.setResponseValue("password", null); - aSession.deleteAttribute("password"); - } - - aResponse.setResponseValue("errors", null); - }; - - protected void initialRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure{ - Iterator i = DatabaseComment.getInstance().getFields().iterator(); - while (i.hasNext()) { - aResponse.setResponseValue( (String) i.next(), null); - } - - String articleId = aRequest.getParameter("to_media"); - - if (articleId == null) - throw new SessionExc("MirBasicPostingSessionHandler.initialRequest: article id not set!"); - - aSession.setAttribute("to_media", articleId); - - initializeResponseData(aRequest, aSession, aResponse); - - try { - aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate")); - } - catch (Throwable e) { - throw new SessionFailure("Can't get configuration: " + e.getMessage(), e); - } - - } - - protected boolean testFieldEntered(Request aRequest, String aFieldName, String anErrorMessageResource, List aValidationResults) { - Object value = aRequest.getParameter(aFieldName); - if (value==null || !(value instanceof String) || ((String) value).trim().length()==0) { - logger.debug(" missing field " + aFieldName + " value = " + value); - aValidationResults.add(new ValidationError(aFieldName, anErrorMessageResource)); - return false; - } - else - return true; - } - - protected boolean testFieldIsNumeric(Request aRequest, String aFieldName, String anErrorMessageResource, List aValidationResults) { - Object value = aRequest.getParameter(aFieldName); - if (value!=null) { - try { - Integer.parseInt((String) value); - return true; - } - catch (Throwable t) { - logger.debug(" field not numeric: " + aFieldName + " value = " + value); - aValidationResults.add(new ValidationError(aFieldName, anErrorMessageResource)); - return false; - } - } - return true; - } - - public void validate(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure { - - } - - public List validate(Request aRequest, Session aSession) throws SessionExc, SessionFailure { - List result = new Vector(); - - testFieldEntered(aRequest, "title", "validationerror.missing", result); - testFieldEntered(aRequest, "description", "validationerror.missing", result); - testFieldEntered(aRequest, "creator", "validationerror.missing", result); - - return result; - } - - public void subsequentRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure { - try { - Map commentFields = new HashMap(); - - Iterator i = DatabaseContent.getInstance().getFields().iterator(); - while (i.hasNext()) { - String field = (String) i.next(); - aResponse.setResponseValue(field, aRequest.getParameter(field)); - if (aRequest.getParameter(field)!=null) { - commentFields.put(field, aRequest.getParameter(field)); - } - } - - initializeResponseData(aRequest, aSession, aResponse); - - List validationErrors = validate(aRequest, aSession); - - if (validationErrors != null && validationErrors.size()>0) { - returnValidationErrors(aRequest, aSession, aResponse, validationErrors); - } - else { -// finish(aRequest, aSession, aResponse); - - EntityComment comment = (EntityComment) commentModule.createNew (); -// comment.setValues(getIntersectingValues(aRequest, )); - - finishComment(aRequest, aSession, comment); - - String id = comment.insert(); - if(id==null){ - afterDuplicateCommentPosting(aRequest, aSession, aResponse, comment); - logger.info("Dupe comment rejected"); - aSession.terminate(); - } - else { - i = aRequest.getUploadedFiles().iterator(); - while (i.hasNext()) { - UploadedFile file = (UploadedFile) i.next(); - processMediaFile(aRequest, aSession, comment, file); - } - - afterCommentPosting(aRequest, aSession, aResponse, comment); - MirGlobal.abuse().checkComment(comment, aRequest, null); - MirGlobal.localizer().openPostings().afterCommentPosting(comment); - logger.info("Comment posted"); - aSession.terminate(); - } - } - } - catch (Throwable t) { - ExceptionFunctions.traceCauseException(t).printStackTrace(); - - throw new SessionFailure("MirBasicPostingSessionHandler.subsequentRequest: " + t.getMessage(), t); - } - } - - public void initializeCommentPosting(Request aRequest, Session aSession, Response aResponse) throws SessionFailure, SessionExc { - String articleId = aRequest.getParameter("to_media"); - if (articleId==null) - articleId = aRequest.getParameter("aid"); - - if (articleId==null) - throw new SessionExc("initializeCommentPosting: article id not set!"); - - aSession.setAttribute("to_media", articleId); - processCommentPosting(aRequest, aSession, aResponse); - }; - - public void returnValidationErrors(Request aRequest, Session aSession, Response aResponse, List aValidationErrors) throws SessionFailure, SessionExc { - aResponse.setResponseValue("errors", aValidationErrors); - aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate")); - }; - - public void processCommentPosting(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure { - if (MirGlobal.abuse().getOpenPostingPassword()) { - String password = generateOnetimePassword(); - aSession.setAttribute("password", password); - aResponse.setResponseValue("password", password); - aResponse.setResponseValue("passwd", password); - } - else { - aResponse.setResponseValue("password", null); - } - - aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate")); - }; - - public void processMediaFile(Request aRequest, Session aSession, EntityComment aComment, UploadedFile aFile) throws SessionExc, SessionFailure { - try { - Entity mediaItem = MediaUploadProcessor.processMediaUpload(aFile, new HashMap()); - finishMedia(aRequest, aSession, aFile, mediaItem); - mediaItem.update(); - commentToMedia.addMedia(aComment.getId(), mediaItem.getId()); - } - catch (Throwable t) { - throw new SessionFailure(t); - } - } - - public void finishMedia(Request aRequest, Session aSession, UploadedFile aFile, Entity aMedia) throws SessionExc, SessionFailure { - } - - public void finishComment(Request aRequest, Session aSession, EntityComment aComment) throws SessionExc, SessionFailure { - if (aSession.getAttribute("to_media") == null) - throw new SessionExc("missing to_media"); - - aComment.setValueForProperty("is_published", "1"); - aComment.setValueForProperty("to_comment_status", "1"); - aComment.setValueForProperty("is_html","0"); - aComment.setValueForProperty("to_media", (String) aSession.getAttribute("to_media")); - }; - - public void addMedia(Request aRequest, Session aSession, EntityComment aComment) throws SessionExc, SessionFailure { - } - - public void afterCommentPosting(Request aRequest, Session aSession, Response aResponse, EntityComment aComment) { - DatabaseContent.getInstance().setUnproduced("id=" + aComment.getValue("to_media")); - aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.DoneTemplate")); - }; - - public void afterDuplicateCommentPosting(Request aRequest, Session aSession, Response aResponse, EntityComment aComment) { - aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.DupeTemplate")); - }; - - public class ValidationError { - private String field; - private String message; - private List parameters; - - public ValidationError(String aField, String aMessage) { - this (aField, aMessage, new String[] {}); - } - - public ValidationError(String aField, String aMessage, Object aParameter) { - this (aField, aMessage, new Object[] {aParameter}); - } - - public ValidationError(String aField, String aMessage, Object[] aParameters) { - field = aField; - message = aMessage; - parameters = Arrays.asList(aParameters); - } - - public String getMessage() { - return message; - } - - public String getField() { - return field; - } - - public List getParameters() { - return parameters; - } - } - - - -} +import mircoders.storage.DatabaseContent; + +/** + * + *

Title: Experimental session handler for comment postings

+ *

Description:

+ *

Copyright: Copyright (c) 2003

+ *

Company:

+ * @author not attributable + * @version 1.0 + */ + +public class MirBasicPostingSessionHandler implements SessionHandler { + protected LoggerWrapper logger; + protected MirPropertiesConfiguration configuration; + protected ModuleComment commentModule; + protected DatabaseCommentToMedia commentToMedia = DatabaseCommentToMedia.getInstance(); + + public MirBasicPostingSessionHandler() { + logger = new LoggerWrapper("Localizer.OpenPosting"); + try { + configuration = MirPropertiesConfiguration.instance(); + } + catch (Throwable t) { + logger.fatal("Cannot load configuration: " + t.toString()); + + throw new RuntimeException("Cannot load configuration: " + t.toString()); + } + commentModule= new ModuleComment(DatabaseComment.getInstance()); + } + + public void processRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure { + if (aSession.getAttribute("initialRequest")==null) { + initialRequest(aRequest, aSession, aResponse); + aSession.setAttribute("initialRequest", "no"); + } + else { + subsequentRequest(aRequest, aSession, aResponse); + } + }; + + protected Map getIntersectingValues(Request aRequest, StorageObject aStorage) throws SessionExc, SessionFailure { + Map result = new HashMap(); + + Iterator i = aStorage.getFields().iterator(); + + while (i.hasNext()) { + String fieldName = (String) i.next(); + Object value = aRequest.getParameter(fieldName); + if (value != null) + result.put(fieldName, value); + } + + return result; + } + + + protected String generateOnetimePassword() { + Random r = new Random(); + int random = r.nextInt(); + + long l = System.currentTimeMillis(); + + l = (l*l*l*l)/random; + if (l<0) + l = l * -1; + + String returnString = ""+l; + + return returnString.substring(5); + } + + protected void initializeResponseData(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure { + if (MirGlobal.abuse().getOpenPostingPassword()) { + String password = (String) aSession.getAttribute("password"); + if (password==null) { + password = generateOnetimePassword(); + aSession.setAttribute("password", password); + } + aResponse.setResponseValue("password", password); + } + else { + aResponse.setResponseValue("password", null); + aSession.deleteAttribute("password"); + } + + aResponse.setResponseValue("errors", null); + }; + + protected void initialRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure{ + Iterator i = DatabaseComment.getInstance().getFields().iterator(); + while (i.hasNext()) { + aResponse.setResponseValue( (String) i.next(), null); + } + + String articleId = aRequest.getParameter("to_media"); + + if (articleId == null) + throw new SessionExc("MirBasicPostingSessionHandler.initialRequest: article id not set!"); + + aSession.setAttribute("to_media", articleId); + + initializeResponseData(aRequest, aSession, aResponse); + + try { + aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate")); + } + catch (Throwable e) { + throw new SessionFailure("Can't get configuration: " + e.getMessage(), e); + } + + } + + protected boolean testFieldEntered(Request aRequest, String aFieldName, String anErrorMessageResource, List aValidationResults) { + Object value = aRequest.getParameter(aFieldName); + if (value==null || !(value instanceof String) || ((String) value).trim().length()==0) { + logger.debug(" missing field " + aFieldName + " value = " + value); + aValidationResults.add(new ValidationError(aFieldName, anErrorMessageResource)); + return false; + } + else + return true; + } + + protected boolean testFieldIsNumeric(Request aRequest, String aFieldName, String anErrorMessageResource, List aValidationResults) { + Object value = aRequest.getParameter(aFieldName); + if (value!=null) { + try { + Integer.parseInt((String) value); + return true; + } + catch (Throwable t) { + logger.debug(" field not numeric: " + aFieldName + " value = " + value); + aValidationResults.add(new ValidationError(aFieldName, anErrorMessageResource)); + return false; + } + } + return true; + } + + public void validate(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure { + + } + + public List validate(Request aRequest, Session aSession) throws SessionExc, SessionFailure { + List result = new Vector(); + + testFieldEntered(aRequest, "title", "validationerror.missing", result); + testFieldEntered(aRequest, "description", "validationerror.missing", result); + testFieldEntered(aRequest, "creator", "validationerror.missing", result); + + return result; + } + + public void subsequentRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure { + try { + Map commentFields = new HashMap(); + + Iterator i = DatabaseContent.getInstance().getFields().iterator(); + while (i.hasNext()) { + String field = (String) i.next(); + aResponse.setResponseValue(field, aRequest.getParameter(field)); + if (aRequest.getParameter(field)!=null) { + commentFields.put(field, aRequest.getParameter(field)); + } + } + + initializeResponseData(aRequest, aSession, aResponse); + + List validationErrors = validate(aRequest, aSession); + + if (validationErrors != null && validationErrors.size()>0) { + returnValidationErrors(aRequest, aSession, aResponse, validationErrors); + } + else { +// finish(aRequest, aSession, aResponse); + + EntityComment comment = (EntityComment) commentModule.createNew (); +// comment.setValues(getIntersectingValues(aRequest, )); + + finishComment(aRequest, aSession, comment); + + String id = comment.insert(); + if(id==null){ + afterDuplicateCommentPosting(aRequest, aSession, aResponse, comment); + logger.info("Dupe comment rejected"); + aSession.terminate(); + } + else { + i = aRequest.getUploadedFiles().iterator(); + while (i.hasNext()) { + UploadedFile file = (UploadedFile) i.next(); + processMediaFile(aRequest, aSession, comment, file); + } + + afterCommentPosting(aRequest, aSession, aResponse, comment); + MirGlobal.abuse().checkComment(comment, aRequest, null); + MirGlobal.localizer().openPostings().afterCommentPosting(comment); + logger.info("Comment posted"); + aSession.terminate(); + } + } + } + catch (Throwable t) { + ExceptionFunctions.traceCauseException(t).printStackTrace(); + + throw new SessionFailure("MirBasicPostingSessionHandler.subsequentRequest: " + t.getMessage(), t); + } + } + + public void initializeCommentPosting(Request aRequest, Session aSession, Response aResponse) throws SessionFailure, SessionExc { + String articleId = aRequest.getParameter("to_media"); + if (articleId==null) + articleId = aRequest.getParameter("aid"); + + if (articleId==null) + throw new SessionExc("initializeCommentPosting: article id not set!"); + + aSession.setAttribute("to_media", articleId); + processCommentPosting(aRequest, aSession, aResponse); + }; + + public void returnValidationErrors(Request aRequest, Session aSession, Response aResponse, List aValidationErrors) throws SessionFailure, SessionExc { + aResponse.setResponseValue("errors", aValidationErrors); + aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate")); + }; + + public void processCommentPosting(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure { + if (MirGlobal.abuse().getOpenPostingPassword()) { + String password = generateOnetimePassword(); + aSession.setAttribute("password", password); + aResponse.setResponseValue("password", password); + aResponse.setResponseValue("passwd", password); + } + else { + aResponse.setResponseValue("password", null); + } + + aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate")); + }; + + public void processMediaFile(Request aRequest, Session aSession, EntityComment aComment, UploadedFile aFile) throws SessionExc, SessionFailure { + try { + Entity mediaItem = MediaUploadProcessor.processMediaUpload(aFile, new HashMap()); + finishMedia(aRequest, aSession, aFile, mediaItem); + mediaItem.update(); + commentToMedia.addMedia(aComment.getId(), mediaItem.getId()); + } + catch (Throwable t) { + throw new SessionFailure(t); + } + } + + public void finishMedia(Request aRequest, Session aSession, UploadedFile aFile, Entity aMedia) throws SessionExc, SessionFailure { + } + + public void finishComment(Request aRequest, Session aSession, EntityComment aComment) throws SessionExc, SessionFailure { + if (aSession.getAttribute("to_media") == null) + throw new SessionExc("missing to_media"); + + aComment.setValueForProperty("is_published", "1"); + aComment.setValueForProperty("to_comment_status", "1"); + aComment.setValueForProperty("is_html","0"); + aComment.setValueForProperty("to_media", (String) aSession.getAttribute("to_media")); + }; + + public void addMedia(Request aRequest, Session aSession, EntityComment aComment) throws SessionExc, SessionFailure { + } + + public void afterCommentPosting(Request aRequest, Session aSession, Response aResponse, EntityComment aComment) { + DatabaseContent.getInstance().setUnproduced("id=" + aComment.getValue("to_media")); + aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.DoneTemplate")); + }; + + public void afterDuplicateCommentPosting(Request aRequest, Session aSession, Response aResponse, EntityComment aComment) { + aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.DupeTemplate")); + }; + + public class ValidationError { + private String field; + private String message; + private List parameters; + + public ValidationError(String aField, String aMessage) { + this (aField, aMessage, new String[] {}); + } + + public ValidationError(String aField, String aMessage, Object aParameter) { + this (aField, aMessage, new Object[] {aParameter}); + } + + public ValidationError(String aField, String aMessage, Object[] aParameters) { + field = aField; + message = aMessage; + parameters = Arrays.asList(aParameters); + } + + public String getMessage() { + return message; + } + + public String getField() { + return field; + } + + public List getParameters() { + return parameters; + } + } + + + +} diff --git a/source/mircoders/localizer/basic/MirBasicProducerAssistantLocalizer.java b/source/mircoders/localizer/basic/MirBasicProducerAssistantLocalizer.java index 0f9144ec..ba162c1e 100755 --- a/source/mircoders/localizer/basic/MirBasicProducerAssistantLocalizer.java +++ b/source/mircoders/localizer/basic/MirBasicProducerAssistantLocalizer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,36 +18,34 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.localizer.basic; -import java.util.GregorianCalendar; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import mir.config.MirPropertiesConfiguration; -import mir.entity.adapter.EntityAdapter; -import mir.entity.adapter.EntityIteratorAdapter; -import mir.log.LoggerWrapper; -import mir.misc.StringUtil; -import mir.util.DateToMapAdapter; -import mir.util.GeneratorExpressionFunctions; -import mir.util.GeneratorHTMLFunctions; -import mir.util.GeneratorIntegerFunctions; -import mir.util.GeneratorListFunctions; -import mir.util.GeneratorStringFunctions; -import mircoders.global.MirGlobal; +import java.util.GregorianCalendar; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import mir.config.MirPropertiesConfiguration; +import mir.entity.adapter.EntityAdapter; +import mir.entity.adapter.EntityIteratorAdapter; +import mir.log.LoggerWrapper; +import mir.misc.StringUtil; +import mir.util.DateToMapAdapter; +import mir.util.GeneratorExpressionFunctions; +import mir.util.GeneratorHTMLFunctions; +import mir.util.GeneratorIntegerFunctions; +import mir.util.GeneratorListFunctions; +import mir.util.GeneratorStringFunctions; +import mircoders.global.MirGlobal; import mircoders.localizer.MirProducerAssistantLocalizer; public class MirBasicProducerAssistantLocalizer implements MirProducerAssistantLocalizer { diff --git a/source/mircoders/localizer/basic/MirBasicProducerLocalizer.java b/source/mircoders/localizer/basic/MirBasicProducerLocalizer.java index 423fe65e..a54ba004 100755 --- a/source/mircoders/localizer/basic/MirBasicProducerLocalizer.java +++ b/source/mircoders/localizer/basic/MirBasicProducerLocalizer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.localizer.basic; import java.io.File; @@ -105,7 +103,7 @@ public class MirBasicProducerLocalizer implements MirProducerLocalizer { } catch (Throwable t) { logger.error("MirBasicProducerLocalizer.factories(): Unable to setup factories: "+t.getMessage()); - t.printStackTrace(logger.asPrintWriter(logger.DEBUG_MESSAGE)); + t.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE)); } } diff --git a/source/mircoders/localizer/basic/MirBasicWriterEngine.java b/source/mircoders/localizer/basic/MirBasicWriterEngine.java index 14f43f4f..dbcb3553 100755 --- a/source/mircoders/localizer/basic/MirBasicWriterEngine.java +++ b/source/mircoders/localizer/basic/MirBasicWriterEngine.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.localizer.basic; import java.io.File; diff --git a/source/mircoders/media/ImageProcessor.java b/source/mircoders/media/ImageProcessor.java index e069d056..1d953736 100755 --- a/source/mircoders/media/ImageProcessor.java +++ b/source/mircoders/media/ImageProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.media; diff --git a/source/mircoders/media/MediaHandlerAudio.java b/source/mircoders/media/MediaHandlerAudio.java index 6f91273e..a3201655 100755 --- a/source/mircoders/media/MediaHandlerAudio.java +++ b/source/mircoders/media/MediaHandlerAudio.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.media; @@ -40,7 +39,7 @@ import mir.media.MirMedia; * @see mir.media.MediaHandlerGeneric * @see mir.media.MirMedia * @author mh - * @version $Id: MediaHandlerAudio.java,v 1.7 2003/01/25 17:50:35 idfx Exp $ + * @version $Id: MediaHandlerAudio.java,v 1.8 2003/04/21 12:42:48 idfx Exp $ */ public class MediaHandlerAudio extends MediaHandlerGeneric implements MirMedia diff --git a/source/mircoders/media/MediaHandlerGeneric.java b/source/mircoders/media/MediaHandlerGeneric.java index eb53cd96..bb0ad5d8 100755 --- a/source/mircoders/media/MediaHandlerGeneric.java +++ b/source/mircoders/media/MediaHandlerGeneric.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.media; import java.io.File; @@ -64,7 +62,7 @@ import freemarker.template.SimpleList; * * @see mir.media.MirMedia * @author mh - * @version $Id: MediaHandlerGeneric.java,v 1.18 2003/03/09 19:14:21 idfx Exp $ + * @version $Id: MediaHandlerGeneric.java,v 1.19 2003/04/21 12:42:48 idfx Exp $ */ public class MediaHandlerGeneric implements MirMedia diff --git a/source/mircoders/media/MediaHandlerImages.java b/source/mircoders/media/MediaHandlerImages.java index 5edb12ed..3b0c3be1 100755 --- a/source/mircoders/media/MediaHandlerImages.java +++ b/source/mircoders/media/MediaHandlerImages.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,18 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - - package mircoders.media; import java.io.File; @@ -61,7 +58,7 @@ import freemarker.template.SimpleList; * * @see mir.media.MirMedia * @author mh - * @version $Id: MediaHandlerImages.java,v 1.21 2003/03/09 19:14:21 idfx Exp $ + * @version $Id: MediaHandlerImages.java,v 1.22 2003/04/21 12:42:48 idfx Exp $ */ diff --git a/source/mircoders/media/MediaHandlerImagesExtern.java b/source/mircoders/media/MediaHandlerImagesExtern.java index 8c303562..e9eb66a6 100755 --- a/source/mircoders/media/MediaHandlerImagesExtern.java +++ b/source/mircoders/media/MediaHandlerImagesExtern.java @@ -1,192 +1,190 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir 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 of the License, or - * (at your option) any later version. - * - * Mir 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 Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package mircoders.media; - - -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; - -import mir.config.MirPropertiesConfiguration; -import mir.entity.Entity; -import mir.log.LoggerWrapper; -import mir.media.MediaExc; -import mir.media.MediaFailure; -import mir.misc.StringUtil; -import mircoders.storage.DatabaseUploadedMedia; - - -/** - * Image handler that stores images outside of the database. Will be replaced by the new - * media handling system. - * @author Zapata - * @version 1.0 - */ - -public class MediaHandlerImagesExtern extends MediaHandlerGeneric -{ - private int maxIconSize; - private float minDescaleRatio; - private int minDescaleReduction; - - public MediaHandlerImagesExtern() { - - logger = new LoggerWrapper("Media.Images.Extern"); - try { - MirPropertiesConfiguration configuration = MirPropertiesConfiguration.instance(); - } - catch (Throwable t) { - logger.fatal("MediaHandlerImagesExtern: can't get configuration"); - - throw new RuntimeException(t.toString()); - } - - maxIconSize = configuration.getInt("Producer.Image.MaxIconSize"); - minDescaleRatio = configuration.getFloat("Producer.Image.MinDescalePercentage")/100; - minDescaleReduction = configuration.getInt("Producer.Image.MinDescaleReduction"); - } - - public void produce(Entity anImageEntity, Entity mediaTypeEnt) throws MediaExc, MediaFailure { - try { - String date = anImageEntity.getValue("date"); - String datePath = StringUtil.webdbDate2path(date); - String ext = "." + mediaTypeEnt.getValue("name"); - String filePath = datePath + anImageEntity.getId() + ext; - String iconFilePath = MirPropertiesConfiguration.instance().getString("Producer.StorageRoot") + getIconStoragePath() + filePath; - String imageFilePath = getStoragePath() + File.separator + filePath; - - File imageFile = new File(imageFilePath); - File iconFile = new File(iconFilePath); - - if (!imageFile.exists()) { - throw new MediaExc("error in MediaHandlerImagesExtern.produce(): " + filePath + " does not exist!"); - } - else { - ImageProcessor processor = new ImageProcessor(imageFile, "JPEG"); - - processor.descaleImage(maxIconSize, minDescaleRatio, minDescaleReduction); - File dir = new File(iconFile.getParent()); - if (dir!=null && !dir.exists()){ - dir.mkdirs(); - } - processor.writeScaledData(iconFile); - - logger.info(processor.getWidth()+"x"+processor.getHeight()); - - anImageEntity.setValueForProperty("img_height", new Integer(processor.getHeight()).toString()); - anImageEntity.setValueForProperty("img_width", new Integer(processor.getWidth()).toString()); - - anImageEntity.setValueForProperty("icon_height", new Integer(processor.getScaledHeight()).toString()); - anImageEntity.setValueForProperty("icon_width", new Integer(processor.getScaledWidth()).toString()); - - anImageEntity.setValueForProperty("icon_path", getIconStoragePath()+filePath); - anImageEntity.setValueForProperty("publish_path", filePath); - - anImageEntity.update(); - } - } - catch(Throwable t) { - logger.error("MediaHandlerImagesExtern.produce: " + t.getMessage()); - t.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE)); - throw new MediaFailure(t.getMessage(), t); - } - } - - - public InputStream getIcon(Entity anImageEntity) throws MediaExc, MediaFailure { - try { - Entity mediaType = DatabaseUploadedMedia.getInstance().getMediaType( - anImageEntity); - - String date = anImageEntity.getValue("date"); - String datePath = StringUtil.webdbDate2path(date); - String ext = "." + mediaType.getValue("name"); - String filePath = MirPropertiesConfiguration.instance().getString("Producer.StorageRoot") + - getIconStoragePath() + datePath + anImageEntity.getId() + ext; - - return new FileInputStream(new File(filePath)); - } - catch (Throwable t) { - throw new MediaFailure(t); - } - } - - public String getStoragePath() - { - return configuration.getString("Producer.Image.Path"); - } - - public String getIconStoragePath() - { - return configuration.getString("Producer.Image.IconPath"); - } - - public String getPublishHost() - { - return StringUtil.removeSlash(configuration.getString("Producer.Image.Host")); - } - - public String getTinyIconName() - { - return configuration.getString("Producer.Icon.TinyImage"); - } - - public String getBigIconName() - { - return configuration.getString("Producer.Icon.BigImage"); - } - - public String getIconAltName() - { - return "Image"; - } - - public boolean isVideo() - { - return false; - } - - public boolean isAudio() - { - return false; - } - - public boolean isImage () - { - return true; - } - - public String getDescr(Entity mediaType) - { - return "image/jpeg"; - } -} +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir 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 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package mircoders.media; + + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; + +import mir.config.MirPropertiesConfiguration; +import mir.entity.Entity; +import mir.log.LoggerWrapper; +import mir.media.MediaExc; +import mir.media.MediaFailure; +import mir.misc.StringUtil; +import mircoders.storage.DatabaseUploadedMedia; + + +/** + * Image handler that stores images outside of the database. Will be replaced by the new + * media handling system. + * @author Zapata + * @version 1.0 + */ + +public class MediaHandlerImagesExtern extends MediaHandlerGeneric +{ + private int maxIconSize; + private float minDescaleRatio; + private int minDescaleReduction; + + public MediaHandlerImagesExtern() { + + logger = new LoggerWrapper("Media.Images.Extern"); + try { + MirPropertiesConfiguration configuration = MirPropertiesConfiguration.instance(); + } + catch (Throwable t) { + logger.fatal("MediaHandlerImagesExtern: can't get configuration"); + + throw new RuntimeException(t.toString()); + } + + maxIconSize = configuration.getInt("Producer.Image.MaxIconSize"); + minDescaleRatio = configuration.getFloat("Producer.Image.MinDescalePercentage")/100; + minDescaleReduction = configuration.getInt("Producer.Image.MinDescaleReduction"); + } + + public void produce(Entity anImageEntity, Entity mediaTypeEnt) throws MediaExc, MediaFailure { + try { + String date = anImageEntity.getValue("date"); + String datePath = StringUtil.webdbDate2path(date); + String ext = "." + mediaTypeEnt.getValue("name"); + String filePath = datePath + anImageEntity.getId() + ext; + String iconFilePath = MirPropertiesConfiguration.instance().getString("Producer.StorageRoot") + getIconStoragePath() + filePath; + String imageFilePath = getStoragePath() + File.separator + filePath; + + File imageFile = new File(imageFilePath); + File iconFile = new File(iconFilePath); + + if (!imageFile.exists()) { + throw new MediaExc("error in MediaHandlerImagesExtern.produce(): " + filePath + " does not exist!"); + } + else { + ImageProcessor processor = new ImageProcessor(imageFile, "JPEG"); + + processor.descaleImage(maxIconSize, minDescaleRatio, minDescaleReduction); + File dir = new File(iconFile.getParent()); + if (dir!=null && !dir.exists()){ + dir.mkdirs(); + } + processor.writeScaledData(iconFile); + + logger.info(processor.getWidth()+"x"+processor.getHeight()); + + anImageEntity.setValueForProperty("img_height", new Integer(processor.getHeight()).toString()); + anImageEntity.setValueForProperty("img_width", new Integer(processor.getWidth()).toString()); + + anImageEntity.setValueForProperty("icon_height", new Integer(processor.getScaledHeight()).toString()); + anImageEntity.setValueForProperty("icon_width", new Integer(processor.getScaledWidth()).toString()); + + anImageEntity.setValueForProperty("icon_path", getIconStoragePath()+filePath); + anImageEntity.setValueForProperty("publish_path", filePath); + + anImageEntity.update(); + } + } + catch(Throwable t) { + logger.error("MediaHandlerImagesExtern.produce: " + t.getMessage()); + t.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE)); + throw new MediaFailure(t.getMessage(), t); + } + } + + + public InputStream getIcon(Entity anImageEntity) throws MediaExc, MediaFailure { + try { + Entity mediaType = DatabaseUploadedMedia.getInstance().getMediaType( + anImageEntity); + + String date = anImageEntity.getValue("date"); + String datePath = StringUtil.webdbDate2path(date); + String ext = "." + mediaType.getValue("name"); + String filePath = MirPropertiesConfiguration.instance().getString("Producer.StorageRoot") + + getIconStoragePath() + datePath + anImageEntity.getId() + ext; + + return new FileInputStream(new File(filePath)); + } + catch (Throwable t) { + throw new MediaFailure(t); + } + } + + public String getStoragePath() + { + return configuration.getString("Producer.Image.Path"); + } + + public String getIconStoragePath() + { + return configuration.getString("Producer.Image.IconPath"); + } + + public String getPublishHost() + { + return StringUtil.removeSlash(configuration.getString("Producer.Image.Host")); + } + + public String getTinyIconName() + { + return configuration.getString("Producer.Icon.TinyImage"); + } + + public String getBigIconName() + { + return configuration.getString("Producer.Icon.BigImage"); + } + + public String getIconAltName() + { + return "Image"; + } + + public boolean isVideo() + { + return false; + } + + public boolean isAudio() + { + return false; + } + + public boolean isImage () + { + return true; + } + + public String getDescr(Entity mediaType) + { + return "image/jpeg"; + } +} diff --git a/source/mircoders/media/MediaHandlerImagesJpeg.java b/source/mircoders/media/MediaHandlerImagesJpeg.java index f1c7ca75..76c46644 100755 --- a/source/mircoders/media/MediaHandlerImagesJpeg.java +++ b/source/mircoders/media/MediaHandlerImagesJpeg.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,18 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - - package mircoders.media; import mir.entity.Entity; @@ -45,7 +42,7 @@ import mir.media.MirMedia; * @see mir.media.MirMedia * @see mircoders.media.MediaHandlerImages * @author mh, mir-coders group - * @version $Id: MediaHandlerImagesJpeg.java,v 1.4 2003/01/25 17:50:35 idfx Exp $ + * @version $Id: MediaHandlerImagesJpeg.java,v 1.5 2003/04/21 12:42:48 idfx Exp $ */ diff --git a/source/mircoders/media/MediaHandlerImagesPng.java b/source/mircoders/media/MediaHandlerImagesPng.java index e60ceaa8..bf281fd0 100755 --- a/source/mircoders/media/MediaHandlerImagesPng.java +++ b/source/mircoders/media/MediaHandlerImagesPng.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,18 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - - package mircoders.media; import mir.entity.Entity; @@ -45,7 +42,7 @@ import mir.media.MirMedia; * @see mir.media.MirMedia * @see mircoders.media.MediaHandlerImages * @author mh ,mir-coders - * @version $Id: MediaHandlerImagesPng.java,v 1.5 2003/01/25 17:50:35 idfx Exp $ + * @version $Id: MediaHandlerImagesPng.java,v 1.6 2003/04/21 12:42:48 idfx Exp $ */ diff --git a/source/mircoders/media/MediaHandlerMp3.java b/source/mircoders/media/MediaHandlerMp3.java index 984de731..f69cec8b 100755 --- a/source/mircoders/media/MediaHandlerMp3.java +++ b/source/mircoders/media/MediaHandlerMp3.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.media; import java.io.StringReader; @@ -67,7 +65,7 @@ import freemarker.template.SimpleList; * * @see mir.media.MirMedia * @author mh - * @version $Id: MediaHandlerMp3.java,v 1.14 2003/03/09 19:14:21 idfx Exp $ + * @version $Id: MediaHandlerMp3.java,v 1.15 2003/04/21 12:42:48 idfx Exp $ */ public class MediaHandlerMp3 extends MediaHandlerAudio implements MirMedia diff --git a/source/mircoders/media/MediaHandlerRealAudio.java b/source/mircoders/media/MediaHandlerRealAudio.java index 47c758d3..62dc5a2b 100755 --- a/source/mircoders/media/MediaHandlerRealAudio.java +++ b/source/mircoders/media/MediaHandlerRealAudio.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.media; import java.io.StringReader; @@ -53,7 +51,7 @@ import freemarker.template.SimpleList; * @see mir.media.MediaHandlerGeneric * @see mir.media.MirMedia * @author john , mh - * @version $Id: MediaHandlerRealAudio.java,v 1.18 2003/03/09 19:14:21 idfx Exp $ + * @version $Id: MediaHandlerRealAudio.java,v 1.19 2003/04/21 12:42:48 idfx Exp $ */ diff --git a/source/mircoders/media/MediaHandlerRealVideo.java b/source/mircoders/media/MediaHandlerRealVideo.java index 1fada7ee..947a9053 100755 --- a/source/mircoders/media/MediaHandlerRealVideo.java +++ b/source/mircoders/media/MediaHandlerRealVideo.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.media; import java.io.File; @@ -54,7 +52,7 @@ import freemarker.template.SimpleList; * @see mir.media.MediaHandlerGeneric * @see mir.media.MirMedia * @author john , mh - * @version $Id: MediaHandlerRealVideo.java,v 1.18 2003/03/09 19:14:21 idfx Exp $ + * @version $Id: MediaHandlerRealVideo.java,v 1.19 2003/04/21 12:42:48 idfx Exp $ */ diff --git a/source/mircoders/media/MediaHandlerVideo.java b/source/mircoders/media/MediaHandlerVideo.java index 195205e4..681d002b 100755 --- a/source/mircoders/media/MediaHandlerVideo.java +++ b/source/mircoders/media/MediaHandlerVideo.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.media; import mir.media.MirMedia; @@ -42,7 +40,7 @@ import mir.media.MirMedia; * @see mir.media.MediaHandlerGeneric * @see mir.media.MirMedia * @author john - * @version $Id: MediaHandlerVideo.java,v 1.8 2003/04/09 02:06:09 zapata Exp $ + * @version $Id: MediaHandlerVideo.java,v 1.9 2003/04/21 12:42:48 idfx Exp $ */ public class MediaHandlerVideo extends MediaHandlerGeneric implements MirMedia diff --git a/source/mircoders/media/MediaUploadProcessor.java b/source/mircoders/media/MediaUploadProcessor.java index 2f81916b..f7318635 100755 --- a/source/mircoders/media/MediaUploadProcessor.java +++ b/source/mircoders/media/MediaUploadProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.media; import java.util.GregorianCalendar; @@ -43,7 +41,6 @@ import mir.media.MirMedia; import mir.misc.StringUtil; import mir.session.UploadedFile; import mir.storage.Database; - import mircoders.module.ModuleMediaType; public class MediaUploadProcessor { diff --git a/source/mircoders/media/UnsupportedMediaFormatExc.java b/source/mircoders/media/UnsupportedMediaFormatExc.java index 57237e3c..7efdfb28 100755 --- a/source/mircoders/media/UnsupportedMediaFormatExc.java +++ b/source/mircoders/media/UnsupportedMediaFormatExc.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.media; import mir.media.MediaExc; diff --git a/source/mircoders/module/ModuleArticleType.java b/source/mircoders/module/ModuleArticleType.java index 38050c2b..a535c7f9 100755 --- a/source/mircoders/module/ModuleArticleType.java +++ b/source/mircoders/module/ModuleArticleType.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.module; import mir.log.LoggerWrapper; diff --git a/source/mircoders/module/ModuleBreaking.java b/source/mircoders/module/ModuleBreaking.java index e90f2652..ff7bcdeb 100755 --- a/source/mircoders/module/ModuleBreaking.java +++ b/source/mircoders/module/ModuleBreaking.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.module; import mir.entity.EntityList; diff --git a/source/mircoders/module/ModuleComment.java b/source/mircoders/module/ModuleComment.java index 7e66c259..9055e9e6 100755 --- a/source/mircoders/module/ModuleComment.java +++ b/source/mircoders/module/ModuleComment.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.module; import java.util.Map; diff --git a/source/mircoders/module/ModuleCommentStatus.java b/source/mircoders/module/ModuleCommentStatus.java index 5ddd9bdf..8ca45388 100755 --- a/source/mircoders/module/ModuleCommentStatus.java +++ b/source/mircoders/module/ModuleCommentStatus.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.module; import mir.log.LoggerWrapper; diff --git a/source/mircoders/module/ModuleContent.java b/source/mircoders/module/ModuleContent.java index cd4142e5..e3cb48f1 100755 --- a/source/mircoders/module/ModuleContent.java +++ b/source/mircoders/module/ModuleContent.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.module; diff --git a/source/mircoders/module/ModuleImages.java b/source/mircoders/module/ModuleImages.java index cfcfcfd2..5ba38643 100755 --- a/source/mircoders/module/ModuleImages.java +++ b/source/mircoders/module/ModuleImages.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.module; import mir.log.LoggerWrapper; diff --git a/source/mircoders/module/ModuleLanguage.java b/source/mircoders/module/ModuleLanguage.java index 6287258b..28ad53a8 100755 --- a/source/mircoders/module/ModuleLanguage.java +++ b/source/mircoders/module/ModuleLanguage.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.module; import mir.log.LoggerWrapper; diff --git a/source/mircoders/module/ModuleLinksImcs.java b/source/mircoders/module/ModuleLinksImcs.java index a72185a3..8ddd3c78 100755 --- a/source/mircoders/module/ModuleLinksImcs.java +++ b/source/mircoders/module/ModuleLinksImcs.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.module; import mir.log.LoggerWrapper; diff --git a/source/mircoders/module/ModuleMediaType.java b/source/mircoders/module/ModuleMediaType.java index 9aac62c4..317ff246 100755 --- a/source/mircoders/module/ModuleMediaType.java +++ b/source/mircoders/module/ModuleMediaType.java @@ -1,72 +1,102 @@ -package mircoders.module; - -import java.util.List; - -import mir.entity.Entity; -import mir.entity.EntityList; -import mir.log.LoggerWrapper; -import mir.module.AbstractModule; -import mir.module.ModuleExc; -import mir.module.ModuleFailure; -import mir.storage.StorageObject; -import mir.util.JDBCStringRoutines; -import mir.util.StringRoutines; -import mircoders.storage.DatabaseMediaType; - -public class ModuleMediaType extends AbstractModule { - static LoggerWrapper logger = new LoggerWrapper("Module.Content"); - - public ModuleMediaType() { - this (DatabaseMediaType.getInstance()); - } - - public ModuleMediaType(StorageObject aStorage) { - this.theStorage = aStorage; - } - - public Entity findMediaTypeForMimeType(String aMimeType) throws ModuleExc, ModuleFailure { - List contentTypeParts = StringRoutines.splitString(aMimeType, "/"); - - if (contentTypeParts.size()!=2) { - throw new InvalidMimeTypeExc("Invalid mimetype: " + aMimeType, aMimeType); - } - String mimeTypeMajor = (String) contentTypeParts.get(0); - - EntityList mediaTypes; - - mediaTypes = DatabaseMediaType.getInstance().selectByWhereClause("mime_type = '"+JDBCStringRoutines.escapeStringLiteral(aMimeType)+"'"); - if (mediaTypes.size() == 0) { - mediaTypes = DatabaseMediaType.getInstance().selectByWhereClause("mime_type = '"+JDBCStringRoutines.escapeStringLiteral(mimeTypeMajor+"/*")+"'"); - } - if (mediaTypes.size() == 0) { - throw new UnsupportedMimeTypeExc("Unsupported mimetype: " + aMimeType, aMimeType); - } - - return (Entity) mediaTypes.get(0); - } - - public static class MimeTypeExc extends ModuleExc { - private String mimeType; - - public MimeTypeExc(String aMessage, String aMimeType) { - super (aMessage); - mimeType = aMimeType; - } - - public String getMimeType() { - return mimeType; - } - } - - public static class UnsupportedMimeTypeExc extends MimeTypeExc { - public UnsupportedMimeTypeExc(String aMessage, String aMimeType) { - super(aMessage, aMimeType); - } - } - - public static class InvalidMimeTypeExc extends MimeTypeExc { - public InvalidMimeTypeExc(String aMessage, String aMimeType) { - super(aMessage, aMimeType); - } - } +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir 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 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ + +package mircoders.module; + +import java.util.List; + +import mir.entity.Entity; +import mir.entity.EntityList; +import mir.log.LoggerWrapper; +import mir.module.AbstractModule; +import mir.module.ModuleExc; +import mir.module.ModuleFailure; +import mir.storage.StorageObject; +import mir.util.JDBCStringRoutines; +import mir.util.StringRoutines; +import mircoders.storage.DatabaseMediaType; + +public class ModuleMediaType extends AbstractModule { + static LoggerWrapper logger = new LoggerWrapper("Module.Content"); + + public ModuleMediaType() { + this (DatabaseMediaType.getInstance()); + } + + public ModuleMediaType(StorageObject aStorage) { + this.theStorage = aStorage; + } + + public Entity findMediaTypeForMimeType(String aMimeType) throws ModuleExc, ModuleFailure { + List contentTypeParts = StringRoutines.splitString(aMimeType, "/"); + + if (contentTypeParts.size()!=2) { + throw new InvalidMimeTypeExc("Invalid mimetype: " + aMimeType, aMimeType); + } + String mimeTypeMajor = (String) contentTypeParts.get(0); + + EntityList mediaTypes; + + mediaTypes = DatabaseMediaType.getInstance().selectByWhereClause("mime_type = '"+JDBCStringRoutines.escapeStringLiteral(aMimeType)+"'"); + if (mediaTypes.size() == 0) { + mediaTypes = DatabaseMediaType.getInstance().selectByWhereClause("mime_type = '"+JDBCStringRoutines.escapeStringLiteral(mimeTypeMajor+"/*")+"'"); + } + if (mediaTypes.size() == 0) { + throw new UnsupportedMimeTypeExc("Unsupported mimetype: " + aMimeType, aMimeType); + } + + return (Entity) mediaTypes.get(0); + } + + public static class MimeTypeExc extends ModuleExc { + private String mimeType; + + public MimeTypeExc(String aMessage, String aMimeType) { + super (aMessage); + mimeType = aMimeType; + } + + public String getMimeType() { + return mimeType; + } + } + + public static class UnsupportedMimeTypeExc extends MimeTypeExc { + public UnsupportedMimeTypeExc(String aMessage, String aMimeType) { + super(aMessage, aMimeType); + } + } + + public static class InvalidMimeTypeExc extends MimeTypeExc { + public InvalidMimeTypeExc(String aMessage, String aMimeType) { + super(aMessage, aMimeType); + } + } } \ No newline at end of file diff --git a/source/mircoders/module/ModuleMediafolder.java b/source/mircoders/module/ModuleMediafolder.java index 6a7ead45..562a8b6c 100755 --- a/source/mircoders/module/ModuleMediafolder.java +++ b/source/mircoders/module/ModuleMediafolder.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.module; /** diff --git a/source/mircoders/module/ModuleMessage.java b/source/mircoders/module/ModuleMessage.java index 624f8979..bd04bd25 100755 --- a/source/mircoders/module/ModuleMessage.java +++ b/source/mircoders/module/ModuleMessage.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.module; import mir.log.LoggerWrapper; diff --git a/source/mircoders/module/ModuleTopics.java b/source/mircoders/module/ModuleTopics.java index 6cdce27f..84c61494 100755 --- a/source/mircoders/module/ModuleTopics.java +++ b/source/mircoders/module/ModuleTopics.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.module; import java.util.Map; diff --git a/source/mircoders/module/ModuleUploadedMedia.java b/source/mircoders/module/ModuleUploadedMedia.java index 55864247..95a3fee0 100755 --- a/source/mircoders/module/ModuleUploadedMedia.java +++ b/source/mircoders/module/ModuleUploadedMedia.java @@ -1,55 +1,54 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir 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 of the License, or - * (at your option) any later version. - * - * Mir 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 Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package mircoders.module; - -import mir.log.LoggerWrapper; -import mir.module.AbstractModule; -import mir.storage.StorageObject; - -/** - * - *

Title:

- *

Description:

- *

Copyright: Copyright (c) 2003

- *

Company:

- * @author the mir coders - * @version 1.0 - */ - -public class ModuleUploadedMedia extends AbstractModule -{ - static LoggerWrapper logger = new LoggerWrapper("Module.UploadedMedia"); - - public ModuleUploadedMedia(StorageObject aStorage) { - theStorage = aStorage; - } +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir 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 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ + +package mircoders.module; + +import mir.log.LoggerWrapper; +import mir.module.AbstractModule; +import mir.storage.StorageObject; + +/** + * + *

Title:

+ *

Description:

+ *

Copyright: Copyright (c) 2003

+ *

Company:

+ * @author the mir coders + * @version 1.0 + */ + +public class ModuleUploadedMedia extends AbstractModule +{ + static LoggerWrapper logger = new LoggerWrapper("Module.UploadedMedia"); + + public ModuleUploadedMedia(StorageObject aStorage) { + theStorage = aStorage; + } } \ No newline at end of file diff --git a/source/mircoders/module/ModuleUsers.java b/source/mircoders/module/ModuleUsers.java index 0e401058..6a89ec96 100755 --- a/source/mircoders/module/ModuleUsers.java +++ b/source/mircoders/module/ModuleUsers.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.module; diff --git a/source/mircoders/pdf/PDFGenerator.java b/source/mircoders/pdf/PDFGenerator.java index 4347b3a7..2176f340 100755 --- a/source/mircoders/pdf/PDFGenerator.java +++ b/source/mircoders/pdf/PDFGenerator.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,40 +18,46 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.pdf; -import mir.log.LoggerWrapper; +import gnu.regexp.RE; +import gnu.regexp.REException; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.net.MalformedURLException; - -import gnu.regexp.RE; -import gnu.regexp.REException; - -import com.lowagie.text.*; -import com.lowagie.text.pdf.*; - +import mir.config.MirPropertiesConfiguration; +import mir.config.MirPropertiesConfiguration.PropertiesConfigExc; import mir.entity.EntityList; - +import mir.log.LoggerWrapper; import mircoders.entity.EntityContent; import mircoders.entity.EntityImages; import mircoders.storage.DatabaseContentToMedia; -import mir.config.MirPropertiesConfiguration; -import mir.config.MirPropertiesConfiguration.PropertiesConfigExc; +import com.lowagie.text.BadElementException; +import com.lowagie.text.Document; +import com.lowagie.text.DocumentException; +import com.lowagie.text.Element; +import com.lowagie.text.Font; +import com.lowagie.text.Image; +import com.lowagie.text.PageSize; +import com.lowagie.text.Paragraph; +import com.lowagie.text.Phrase; +import com.lowagie.text.pdf.BaseFont; +import com.lowagie.text.pdf.ColumnText; +import com.lowagie.text.pdf.PdfContentByte; +import com.lowagie.text.pdf.PdfTemplate; +import com.lowagie.text.pdf.PdfWriter; diff --git a/source/mircoders/producer/ContentMarkingProducerNode.java b/source/mircoders/producer/ContentMarkingProducerNode.java index aba7408f..cb100d85 100755 --- a/source/mircoders/producer/ContentMarkingProducerNode.java +++ b/source/mircoders/producer/ContentMarkingProducerNode.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.producer; import java.util.Map; diff --git a/source/mircoders/producer/ContentModifyingProducerNode.java b/source/mircoders/producer/ContentModifyingProducerNode.java index 5fd0b7b4..61e01559 100755 --- a/source/mircoders/producer/ContentModifyingProducerNode.java +++ b/source/mircoders/producer/ContentModifyingProducerNode.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.producer; import java.util.Map; diff --git a/source/mircoders/producer/IndexingProducerNode.java b/source/mircoders/producer/IndexingProducerNode.java index 79dc5505..8fc3f5bc 100755 --- a/source/mircoders/producer/IndexingProducerNode.java +++ b/source/mircoders/producer/IndexingProducerNode.java @@ -1,4 +1,5 @@ -/* Copyright (C) 2001, 2002 The Mir-coders group +/* + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -17,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.producer; diff --git a/source/mircoders/producer/MediaGeneratingProducerNode.java b/source/mircoders/producer/MediaGeneratingProducerNode.java index 539a17b2..042a10d1 100755 --- a/source/mircoders/producer/MediaGeneratingProducerNode.java +++ b/source/mircoders/producer/MediaGeneratingProducerNode.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.producer; diff --git a/source/mircoders/producer/PDFGeneratingProducerNode.java b/source/mircoders/producer/PDFGeneratingProducerNode.java index d58add99..4a6e7208 100755 --- a/source/mircoders/producer/PDFGeneratingProducerNode.java +++ b/source/mircoders/producer/PDFGeneratingProducerNode.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.producer; diff --git a/source/mircoders/producer/PDFPreFormattingProducerNode.java b/source/mircoders/producer/PDFPreFormattingProducerNode.java index 7dd8d809..86ad9a91 100755 --- a/source/mircoders/producer/PDFPreFormattingProducerNode.java +++ b/source/mircoders/producer/PDFPreFormattingProducerNode.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.producer; diff --git a/source/mircoders/producer/UnIndexingProducerNode.java b/source/mircoders/producer/UnIndexingProducerNode.java index 35da0bc6..5a5a2426 100755 --- a/source/mircoders/producer/UnIndexingProducerNode.java +++ b/source/mircoders/producer/UnIndexingProducerNode.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.producer; import java.util.Map; diff --git a/source/mircoders/producer/reader/SupplementalProducerNodeBuilders.java b/source/mircoders/producer/reader/SupplementalProducerNodeBuilders.java index 29995953..4c688f38 100755 --- a/source/mircoders/producer/reader/SupplementalProducerNodeBuilders.java +++ b/source/mircoders/producer/reader/SupplementalProducerNodeBuilders.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.producer.reader; import java.util.Map; diff --git a/source/mircoders/search/AudioSearchTerm.java b/source/mircoders/search/AudioSearchTerm.java index c20ba389..7887a96c 100755 --- a/source/mircoders/search/AudioSearchTerm.java +++ b/source/mircoders/search/AudioSearchTerm.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.search; diff --git a/source/mircoders/search/ContentSearchTerm.java b/source/mircoders/search/ContentSearchTerm.java index 318b665f..20aadbb2 100755 --- a/source/mircoders/search/ContentSearchTerm.java +++ b/source/mircoders/search/ContentSearchTerm.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,21 +18,20 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.search; -import java.util.StringTokenizer; import java.util.Map; +import java.util.StringTokenizer; import javax.servlet.http.HttpServletRequest; diff --git a/source/mircoders/search/ImagesSearchTerm.java b/source/mircoders/search/ImagesSearchTerm.java index 839d6d67..e0bdb672 100755 --- a/source/mircoders/search/ImagesSearchTerm.java +++ b/source/mircoders/search/ImagesSearchTerm.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,23 +18,22 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.search; -import java.util.StringTokenizer; +import java.util.List; import java.util.Map; +import java.util.StringTokenizer; import java.util.Vector; -import java.util.List; import javax.servlet.http.HttpServletRequest; diff --git a/source/mircoders/search/IndexUtil.java b/source/mircoders/search/IndexUtil.java index ec15787b..90d52c0d 100755 --- a/source/mircoders/search/IndexUtil.java +++ b/source/mircoders/search/IndexUtil.java @@ -1,4 +1,5 @@ -/* Copyright (C) 2001, 2002 The Mir-coders group +/* + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -17,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.search; diff --git a/source/mircoders/search/KeywordSearchTerm.java b/source/mircoders/search/KeywordSearchTerm.java index 413ff724..63bdb6de 100755 --- a/source/mircoders/search/KeywordSearchTerm.java +++ b/source/mircoders/search/KeywordSearchTerm.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,28 +18,27 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.search; import java.util.Map; + import javax.servlet.http.HttpServletRequest; +import mir.entity.Entity; import org.apache.lucene.document.Document; import org.apache.lucene.document.Field; -import mir.entity.Entity; - public class KeywordSearchTerm extends SearchTerm{ diff --git a/source/mircoders/search/MediaSearchTerm.java b/source/mircoders/search/MediaSearchTerm.java index 9d74b42e..38ee4a0e 100755 --- a/source/mircoders/search/MediaSearchTerm.java +++ b/source/mircoders/search/MediaSearchTerm.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.search; @@ -36,13 +35,9 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import mir.entity.Entity; -import mir.entity.EntityList; import mir.storage.StorageObjectFailure; -import mircoders.entity.EntityContent; -import mircoders.storage.DatabaseContentToMedia; import org.apache.lucene.document.Document; -import org.apache.lucene.document.Field; public class MediaSearchTerm extends SearchTerm{ diff --git a/source/mircoders/search/SearchTerm.java b/source/mircoders/search/SearchTerm.java index c4be6de3..ed79f14c 100755 --- a/source/mircoders/search/SearchTerm.java +++ b/source/mircoders/search/SearchTerm.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.search; diff --git a/source/mircoders/search/TextSearchTerm.java b/source/mircoders/search/TextSearchTerm.java index 166e3ec2..c64145cb 100755 --- a/source/mircoders/search/TextSearchTerm.java +++ b/source/mircoders/search/TextSearchTerm.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.search; diff --git a/source/mircoders/search/TopicSearchTerm.java b/source/mircoders/search/TopicSearchTerm.java index 9fae9ac3..30a4ad38 100755 --- a/source/mircoders/search/TopicSearchTerm.java +++ b/source/mircoders/search/TopicSearchTerm.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.search; import java.util.Map; diff --git a/source/mircoders/search/UnIndexedSearchTerm.java b/source/mircoders/search/UnIndexedSearchTerm.java index 1155141e..930cfe4f 100755 --- a/source/mircoders/search/UnIndexedSearchTerm.java +++ b/source/mircoders/search/UnIndexedSearchTerm.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.search; import java.util.Map; diff --git a/source/mircoders/search/UnStoredSearchTerm.java b/source/mircoders/search/UnStoredSearchTerm.java index 5fca930f..8ed8c108 100755 --- a/source/mircoders/search/UnStoredSearchTerm.java +++ b/source/mircoders/search/UnStoredSearchTerm.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.search; import java.util.Map; diff --git a/source/mircoders/search/VideoSearchTerm.java b/source/mircoders/search/VideoSearchTerm.java index 14c01231..6ea040dd 100755 --- a/source/mircoders/search/VideoSearchTerm.java +++ b/source/mircoders/search/VideoSearchTerm.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.search; diff --git a/source/mircoders/servlet/ServletHelper.java b/source/mircoders/servlet/ServletHelper.java index c6dfce4a..63e8f8be 100755 --- a/source/mircoders/servlet/ServletHelper.java +++ b/source/mircoders/servlet/ServletHelper.java @@ -1,43 +1,39 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir 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 of the License, or - * (at your option) any later version. - * - * Mir 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 Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package mircoders.servlet; - +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir 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 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package mircoders.servlet; + import java.io.PrintWriter; import java.util.HashMap; import java.util.Locale; import java.util.Map; -import org.apache.struts.util.MessageResources; - import mir.entity.adapter.EntityIteratorAdapter; import mir.generator.Generator; import mir.log.LoggerWrapper; @@ -45,90 +41,92 @@ import mir.servlet.ServletModuleExc; import mir.servlet.ServletModuleFailure; import mir.util.CachingRewindableIterator; import mir.util.ResourceBundleGeneratorFunction; -import mircoders.global.MirGlobal; - - - -public class ServletHelper { - static LoggerWrapper logger = new LoggerWrapper("ServletModule.Helper"); - - - public static Map makeGenerationData(Locale[] aLocales) throws ServletModuleExc { - return makeGenerationData(aLocales, "bundles.adminlocal", "bundles.admin"); - } - - public static Map makeGenerationData(Locale[] aLocales, String aBundle) throws ServletModuleExc { - return makeGenerationData(aLocales, aBundle, aBundle); - } - - public static Map makeGenerationData(Locale[] aLocales, String aBundle, String aDefaultBundle) throws ServletModuleExc { - - try { - Map result = new HashMap(); - - MirGlobal.localizer().producerAssistant().initializeGenerationValueSet(result); - - result.put("returnurl", null); - - Object languages = - new CachingRewindableIterator( - new EntityIteratorAdapter( "", "id", 30, - MirGlobal.localizer().dataModel().adapterModel(), "language")); - Object topics = - new CachingRewindableIterator( - new EntityIteratorAdapter("", "id", 30, - MirGlobal.localizer().dataModel().adapterModel(), "topic")); - - Object articleTypes = - new CachingRewindableIterator( - new EntityIteratorAdapter( "", "id", 30, - MirGlobal.localizer().dataModel().adapterModel(), "articleType")); - - Object commentStatuses = - new CachingRewindableIterator( - new EntityIteratorAdapter( "", "id", 30, - MirGlobal.localizer().dataModel().adapterModel(), "commentStatus")); - - result.put("commentstatuses", commentStatuses); - result.put("articletypes", articleTypes); - result.put("languages", languages); - result.put("topics", topics); - - result.put( "lang", - new ResourceBundleGeneratorFunction( aLocales, - new MessageResources[] { MessageResources.getMessageResources(aBundle), - MessageResources.getMessageResources(aDefaultBundle)})); - - return result; - } - catch (Throwable t) { - throw new ServletModuleFailure(t); - } - } - - public static void generateResponse(PrintWriter aWriter, Map aGenerationData, String aGenerator) throws ServletModuleExc { - Generator generator; - - try { - generator = MirGlobal.localizer().generators().makeAdminGeneratorLibrary().makeGenerator(aGenerator); - - generator.generate(aWriter, aGenerationData, logger); - } - catch (Throwable t) { - throw new ServletModuleFailure(t); - } - } - - public static void generateOpenPostingResponse(PrintWriter aWriter, Map aGenerationData, String aGenerator) throws ServletModuleExc { - Generator generator; - - try { - generator = MirGlobal.localizer().generators().makeOpenPostingGeneratorLibrary().makeGenerator(aGenerator); - - generator.generate(aWriter, aGenerationData, logger); - } - catch (Throwable t) { - throw new ServletModuleFailure(t); - } - } -} +import mircoders.global.MirGlobal; + +import org.apache.struts.util.MessageResources; + + + +public class ServletHelper { + static LoggerWrapper logger = new LoggerWrapper("ServletModule.Helper"); + + + public static Map makeGenerationData(Locale[] aLocales) throws ServletModuleExc { + return makeGenerationData(aLocales, "bundles.adminlocal", "bundles.admin"); + } + + public static Map makeGenerationData(Locale[] aLocales, String aBundle) throws ServletModuleExc { + return makeGenerationData(aLocales, aBundle, aBundle); + } + + public static Map makeGenerationData(Locale[] aLocales, String aBundle, String aDefaultBundle) throws ServletModuleExc { + + try { + Map result = new HashMap(); + + MirGlobal.localizer().producerAssistant().initializeGenerationValueSet(result); + + result.put("returnurl", null); + + Object languages = + new CachingRewindableIterator( + new EntityIteratorAdapter( "", "id", 30, + MirGlobal.localizer().dataModel().adapterModel(), "language")); + Object topics = + new CachingRewindableIterator( + new EntityIteratorAdapter("", "id", 30, + MirGlobal.localizer().dataModel().adapterModel(), "topic")); + + Object articleTypes = + new CachingRewindableIterator( + new EntityIteratorAdapter( "", "id", 30, + MirGlobal.localizer().dataModel().adapterModel(), "articleType")); + + Object commentStatuses = + new CachingRewindableIterator( + new EntityIteratorAdapter( "", "id", 30, + MirGlobal.localizer().dataModel().adapterModel(), "commentStatus")); + + result.put("commentstatuses", commentStatuses); + result.put("articletypes", articleTypes); + result.put("languages", languages); + result.put("topics", topics); + + result.put( "lang", + new ResourceBundleGeneratorFunction( aLocales, + new MessageResources[] { MessageResources.getMessageResources(aBundle), + MessageResources.getMessageResources(aDefaultBundle)})); + + return result; + } + catch (Throwable t) { + throw new ServletModuleFailure(t); + } + } + + public static void generateResponse(PrintWriter aWriter, Map aGenerationData, String aGenerator) throws ServletModuleExc { + Generator generator; + + try { + generator = MirGlobal.localizer().generators().makeAdminGeneratorLibrary().makeGenerator(aGenerator); + + generator.generate(aWriter, aGenerationData, logger); + } + catch (Throwable t) { + throw new ServletModuleFailure(t); + } + } + + public static void generateOpenPostingResponse(PrintWriter aWriter, Map aGenerationData, String aGenerator) throws ServletModuleExc { + Generator generator; + + try { + generator = MirGlobal.localizer().generators().makeOpenPostingGeneratorLibrary().makeGenerator(aGenerator); + + generator.generate(aWriter, aGenerationData, logger); + } + catch (Throwable t) { + throw new ServletModuleFailure(t); + } + } +} diff --git a/source/mircoders/servlet/ServletModuleAbuse.java b/source/mircoders/servlet/ServletModuleAbuse.java index faf1e815..00a101b8 100755 --- a/source/mircoders/servlet/ServletModuleAbuse.java +++ b/source/mircoders/servlet/ServletModuleAbuse.java @@ -1,181 +1,181 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir 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 of the License, or - * (at your option) any later version. - * - * Mir 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 Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package mircoders.servlet; - -import java.util.Locale; -import java.util.Map; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import mir.log.LoggerWrapper; -import mir.servlet.ServletModule; -import mir.servlet.ServletModuleFailure; -import mir.util.HTTPRequestParser; -import mir.util.URLBuilder; -import mircoders.global.MirGlobal; - -public class ServletModuleAbuse extends ServletModule { - private static ServletModuleAbuse instance = new ServletModuleAbuse(); - public static ServletModule getInstance() { return instance; } - - private ServletModuleAbuse() { - logger = new LoggerWrapper("ServletModule.Abuse"); - defaultAction = "showsettings"; - } - - public void editfilter(HttpServletRequest aRequest, HttpServletResponse aResponse) { - HTTPRequestParser requestParser = new HTTPRequestParser(aRequest); - - String type=requestParser.getParameterWithDefault("type", ""); - String id=requestParser.getParameterWithDefault("id", ""); - String expression=requestParser.getParameterWithDefault("expression", ""); - - if (id.equals("")) { - MirGlobal.abuse().addFilter(type, expression); - } - else { - MirGlobal.abuse().setFilter(id, type, expression); - } - - MirGlobal.abuse().save(); - - showfilters(aRequest, aResponse); - } - - public void deletefilter(HttpServletRequest aRequest, HttpServletResponse aResponse) { - HTTPRequestParser requestParser = new HTTPRequestParser(aRequest); - - String id=requestParser.getParameterWithDefault("id", ""); - MirGlobal.abuse().deleteFilter(id); - - MirGlobal.abuse().save(); - - showfilters(aRequest, aResponse); - } - - public void showfilters(HttpServletRequest aRequest, HttpServletResponse aResponse) { - URLBuilder urlBuilder = new URLBuilder(); - - try { - Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)}); - - urlBuilder.setValue("module", "Abuse"); - urlBuilder.setValue("do", "showfilters"); - responseData.put("thisurl", urlBuilder.getQuery()); - - responseData.put("filters", MirGlobal.abuse().getFilters()); - responseData.put("filtertypes", MirGlobal.abuse().getFilterTypes()); - - ServletHelper.generateResponse(aResponse.getWriter(), responseData, "abuse.filters.template"); - } - catch (Throwable e) { - throw new ServletModuleFailure(e); - } - } - - - public void showsettings(HttpServletRequest aRequest, HttpServletResponse aResponse) { - URLBuilder urlBuilder = new URLBuilder(); - - try { - Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)}); - - urlBuilder.setValue("module", "Abuse"); - urlBuilder.setValue("do", "showsettings"); - - responseData.put("thisurl", urlBuilder.getQuery()); - - responseData.put("articleactions", MirGlobal.abuse().getArticleActions()); - responseData.put("commentactions", MirGlobal.abuse().getCommentActions()); - - responseData.put("disableop", new Boolean(MirGlobal.abuse().getOpenPostingDisabled())); - responseData.put("passwordop", new Boolean(MirGlobal.abuse().getOpenPostingPassword())); - responseData.put("logenabled", new Boolean(MirGlobal.abuse().getLogEnabled())); - responseData.put("logsize", Integer.toString(MirGlobal.abuse().getLogSize())); - responseData.put("usecookies", new Boolean(MirGlobal.abuse().getCookieOnBlock())); - responseData.put("articleaction", MirGlobal.abuse().getArticleBlockAction()); - responseData.put("commentaction", MirGlobal.abuse().getCommentBlockAction()); - - ServletHelper.generateResponse(aResponse.getWriter(), responseData, "abuse.template"); - } - catch (Throwable e) { - throw new ServletModuleFailure(e); - } - } - - public void savesettings(HttpServletRequest aRequest, HttpServletResponse aResponse) { - try { - HTTPRequestParser parser = new HTTPRequestParser(aRequest); - - MirGlobal.abuse().setOpenPostingDisabled(parser.getParameterWithDefault("disableop", "").equals("1")); - MirGlobal.abuse().setOpenPostingPassword(parser.getParameterWithDefault("passwordop", "").equals("1")); - MirGlobal.abuse().setLogEnabled(parser.getParameterWithDefault("logenabled", "").equals("1")); - - try { - MirGlobal.abuse().setLogSize(parser.getIntegerWithDefault("logsize", MirGlobal.abuse().getLogSize())); - } - catch (Throwable t) { - } - - MirGlobal.abuse().setCookieOnBlock(parser.getParameterWithDefault("usecookies", "").equals("1")); - - MirGlobal.abuse().setArticleBlockAction(parser.getParameter("articleaction")); - MirGlobal.abuse().setCommentBlockAction(parser.getParameter("commentaction")); - - MirGlobal.abuse().save(); - - showsettings(aRequest, aResponse); - } - catch (Throwable e) { - throw new ServletModuleFailure(e); - } - } - - public void showlog(HttpServletRequest aRequest, HttpServletResponse aResponse) { - URLBuilder urlBuilder = new URLBuilder(); - int count; - - try { - Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)}); - urlBuilder.setValue("module", "Abuse"); - urlBuilder.setValue("do", "showlog"); - responseData.put("thisurl", urlBuilder.getQuery()); - - responseData.put("log", MirGlobal.abuse().getLog()); - - ServletHelper.generateResponse(aResponse.getWriter(), responseData, "abuse.log.template"); - } - catch (Throwable e) { - throw new ServletModuleFailure(e); - } - } +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir 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 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ + +package mircoders.servlet; + +import java.util.Locale; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import mir.log.LoggerWrapper; +import mir.servlet.ServletModule; +import mir.servlet.ServletModuleFailure; +import mir.util.HTTPRequestParser; +import mir.util.URLBuilder; +import mircoders.global.MirGlobal; + +public class ServletModuleAbuse extends ServletModule { + private static ServletModuleAbuse instance = new ServletModuleAbuse(); + public static ServletModule getInstance() { return instance; } + + private ServletModuleAbuse() { + logger = new LoggerWrapper("ServletModule.Abuse"); + defaultAction = "showsettings"; + } + + public void editfilter(HttpServletRequest aRequest, HttpServletResponse aResponse) { + HTTPRequestParser requestParser = new HTTPRequestParser(aRequest); + + String type=requestParser.getParameterWithDefault("type", ""); + String id=requestParser.getParameterWithDefault("id", ""); + String expression=requestParser.getParameterWithDefault("expression", ""); + + if (id.equals("")) { + MirGlobal.abuse().addFilter(type, expression); + } + else { + MirGlobal.abuse().setFilter(id, type, expression); + } + + MirGlobal.abuse().save(); + + showfilters(aRequest, aResponse); + } + + public void deletefilter(HttpServletRequest aRequest, HttpServletResponse aResponse) { + HTTPRequestParser requestParser = new HTTPRequestParser(aRequest); + + String id=requestParser.getParameterWithDefault("id", ""); + MirGlobal.abuse().deleteFilter(id); + + MirGlobal.abuse().save(); + + showfilters(aRequest, aResponse); + } + + public void showfilters(HttpServletRequest aRequest, HttpServletResponse aResponse) { + URLBuilder urlBuilder = new URLBuilder(); + + try { + Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)}); + + urlBuilder.setValue("module", "Abuse"); + urlBuilder.setValue("do", "showfilters"); + responseData.put("thisurl", urlBuilder.getQuery()); + + responseData.put("filters", MirGlobal.abuse().getFilters()); + responseData.put("filtertypes", MirGlobal.abuse().getFilterTypes()); + + ServletHelper.generateResponse(aResponse.getWriter(), responseData, "abuse.filters.template"); + } + catch (Throwable e) { + throw new ServletModuleFailure(e); + } + } + + + public void showsettings(HttpServletRequest aRequest, HttpServletResponse aResponse) { + URLBuilder urlBuilder = new URLBuilder(); + + try { + Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)}); + + urlBuilder.setValue("module", "Abuse"); + urlBuilder.setValue("do", "showsettings"); + + responseData.put("thisurl", urlBuilder.getQuery()); + + responseData.put("articleactions", MirGlobal.abuse().getArticleActions()); + responseData.put("commentactions", MirGlobal.abuse().getCommentActions()); + + responseData.put("disableop", new Boolean(MirGlobal.abuse().getOpenPostingDisabled())); + responseData.put("passwordop", new Boolean(MirGlobal.abuse().getOpenPostingPassword())); + responseData.put("logenabled", new Boolean(MirGlobal.abuse().getLogEnabled())); + responseData.put("logsize", Integer.toString(MirGlobal.abuse().getLogSize())); + responseData.put("usecookies", new Boolean(MirGlobal.abuse().getCookieOnBlock())); + responseData.put("articleaction", MirGlobal.abuse().getArticleBlockAction()); + responseData.put("commentaction", MirGlobal.abuse().getCommentBlockAction()); + + ServletHelper.generateResponse(aResponse.getWriter(), responseData, "abuse.template"); + } + catch (Throwable e) { + throw new ServletModuleFailure(e); + } + } + + public void savesettings(HttpServletRequest aRequest, HttpServletResponse aResponse) { + try { + HTTPRequestParser parser = new HTTPRequestParser(aRequest); + + MirGlobal.abuse().setOpenPostingDisabled(parser.getParameterWithDefault("disableop", "").equals("1")); + MirGlobal.abuse().setOpenPostingPassword(parser.getParameterWithDefault("passwordop", "").equals("1")); + MirGlobal.abuse().setLogEnabled(parser.getParameterWithDefault("logenabled", "").equals("1")); + + try { + MirGlobal.abuse().setLogSize(parser.getIntegerWithDefault("logsize", MirGlobal.abuse().getLogSize())); + } + catch (Throwable t) { + } + + MirGlobal.abuse().setCookieOnBlock(parser.getParameterWithDefault("usecookies", "").equals("1")); + + MirGlobal.abuse().setArticleBlockAction(parser.getParameter("articleaction")); + MirGlobal.abuse().setCommentBlockAction(parser.getParameter("commentaction")); + + MirGlobal.abuse().save(); + + showsettings(aRequest, aResponse); + } + catch (Throwable e) { + throw new ServletModuleFailure(e); + } + } + + public void showlog(HttpServletRequest aRequest, HttpServletResponse aResponse) { + URLBuilder urlBuilder = new URLBuilder(); + int count; + + try { + Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)}); + urlBuilder.setValue("module", "Abuse"); + urlBuilder.setValue("do", "showlog"); + responseData.put("thisurl", urlBuilder.getQuery()); + + responseData.put("log", MirGlobal.abuse().getLog()); + + ServletHelper.generateResponse(aResponse.getWriter(), responseData, "abuse.log.template"); + } + catch (Throwable e) { + throw new ServletModuleFailure(e); + } + } } \ No newline at end of file diff --git a/source/mircoders/servlet/ServletModuleAdmin.java b/source/mircoders/servlet/ServletModuleAdmin.java index 533ff79c..eb35ba8e 100755 --- a/source/mircoders/servlet/ServletModuleAdmin.java +++ b/source/mircoders/servlet/ServletModuleAdmin.java @@ -1,71 +1,70 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir 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 of the License, or - * (at your option) any later version. - * - * Mir 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 Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package mircoders.servlet; - -import java.util.Locale; -import java.util.Map; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import mir.log.LoggerWrapper; -import mir.servlet.ServletModule; -import mir.servlet.ServletModuleFailure; -import mir.util.URLBuilder; - -public class ServletModuleAdmin extends ServletModule -{ - private static ServletModuleAdmin instance = new ServletModuleAdmin(); - public static ServletModule getInstance() { return instance; } - - private ServletModuleAdmin() { - logger = new LoggerWrapper("ServletModule.Admin"); - defaultAction = "showSuperUserMenu"; - } - - public void superusermenu(HttpServletRequest aRequest, HttpServletResponse aResponse) { - URLBuilder urlBuilder = new URLBuilder(); - int count; - - try { - Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)}); - urlBuilder.setValue("module", "Admin"); - urlBuilder.setValue("do", "superusermenu"); - - responseData.put("thisurl" , urlBuilder.getQuery()); - - ServletHelper.generateResponse(aResponse.getWriter(), responseData, "superusermenu.template"); - } - catch (Throwable e) { - throw new ServletModuleFailure(e); - } - } -} +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir 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 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package mircoders.servlet; + +import java.util.Locale; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import mir.log.LoggerWrapper; +import mir.servlet.ServletModule; +import mir.servlet.ServletModuleFailure; +import mir.util.URLBuilder; + +public class ServletModuleAdmin extends ServletModule +{ + private static ServletModuleAdmin instance = new ServletModuleAdmin(); + public static ServletModule getInstance() { return instance; } + + private ServletModuleAdmin() { + logger = new LoggerWrapper("ServletModule.Admin"); + defaultAction = "showSuperUserMenu"; + } + + public void superusermenu(HttpServletRequest aRequest, HttpServletResponse aResponse) { + URLBuilder urlBuilder = new URLBuilder(); + int count; + + try { + Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)}); + urlBuilder.setValue("module", "Admin"); + urlBuilder.setValue("do", "superusermenu"); + + responseData.put("thisurl" , urlBuilder.getQuery()); + + ServletHelper.generateResponse(aResponse.getWriter(), responseData, "superusermenu.template"); + } + catch (Throwable e) { + throw new ServletModuleFailure(e); + } + } +} diff --git a/source/mircoders/servlet/ServletModuleArticleType.java b/source/mircoders/servlet/ServletModuleArticleType.java index db5db6ce..826d4f80 100755 --- a/source/mircoders/servlet/ServletModuleArticleType.java +++ b/source/mircoders/servlet/ServletModuleArticleType.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.servlet; import mir.config.MirPropertiesConfiguration; diff --git a/source/mircoders/servlet/ServletModuleAudio.java b/source/mircoders/servlet/ServletModuleAudio.java index 9b0a9edc..91a46462 100755 --- a/source/mircoders/servlet/ServletModuleAudio.java +++ b/source/mircoders/servlet/ServletModuleAudio.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.servlet; import mir.config.MirPropertiesConfiguration; diff --git a/source/mircoders/servlet/ServletModuleBreaking.java b/source/mircoders/servlet/ServletModuleBreaking.java index 6a7afa60..536d6dac 100755 --- a/source/mircoders/servlet/ServletModuleBreaking.java +++ b/source/mircoders/servlet/ServletModuleBreaking.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,32 +18,32 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.servlet; -import java.net.URLEncoder; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import freemarker.template.SimpleHash; -import mir.config.MirPropertiesConfiguration; -import mir.entity.EntityList; -import mir.log.LoggerWrapper; -import mir.misc.HTMLTemplateProcessor; -import mir.servlet.ServletModule; -import mir.servlet.ServletModuleFailure; -import mircoders.module.ModuleBreaking; +import java.net.URLEncoder; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import mir.config.MirPropertiesConfiguration; +import mir.entity.EntityList; +import mir.log.LoggerWrapper; +import mir.misc.HTMLTemplateProcessor; +import mir.servlet.ServletModule; +import mir.servlet.ServletModuleFailure; +import mircoders.module.ModuleBreaking; import mircoders.storage.DatabaseBreaking; +import freemarker.template.SimpleHash; /* * ServletModuleBreaking - diff --git a/source/mircoders/servlet/ServletModuleComment.java b/source/mircoders/servlet/ServletModuleComment.java index 7fb3b819..89ad6ae4 100755 --- a/source/mircoders/servlet/ServletModuleComment.java +++ b/source/mircoders/servlet/ServletModuleComment.java @@ -1,316 +1,316 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir 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 of the License, or - * (at your option) any later version. - * - * Mir 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 Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package mircoders.servlet; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import mir.config.MirPropertiesConfiguration; -import mir.entity.adapter.EntityAdapterModel; -import mir.entity.adapter.EntityIteratorAdapter; -import mir.log.LoggerWrapper; -import mir.servlet.ServletModule; -import mir.servlet.ServletModuleExc; -import mir.servlet.ServletModuleFailure; -import mir.util.CachingRewindableIterator; -import mir.util.HTTPRequestParser; -import mir.util.JDBCStringRoutines; -import mir.util.SQLQueryBuilder; -import mir.util.URLBuilder; -import mircoders.entity.EntityComment; -import mircoders.global.MirGlobal; -import mircoders.module.ModuleComment; -import mircoders.module.ModuleContent; -import mircoders.storage.DatabaseComment; -import mircoders.storage.DatabaseContent; - -/* - * ServletModuleComment - controls navigation for Comments - * - * - * @author RK - */ - -public class ServletModuleComment extends ServletModule -{ - private ModuleContent moduleContent; - - private static ServletModuleComment instance = new ServletModuleComment(); - public static ServletModule getInstance() { return instance; } - - private ServletModuleComment() { - logger = new LoggerWrapper("ServletModule.Comment"); - try { - configuration = MirPropertiesConfiguration.instance(); - templateListString = configuration.getString("ServletModule.Comment.ListTemplate"); - templateObjektString = configuration.getString("ServletModule.Comment.ObjektTemplate"); - templateConfirmString = configuration.getString("ServletModule.Comment.ConfirmTemplate"); - - mainModule = new ModuleComment(DatabaseComment.getInstance()); - moduleContent = new ModuleContent(DatabaseContent.getInstance()); - } - catch (Exception e) { - logger.error("servletmodule comment could not be initialized:" + e.getMessage()); - } - } - - public void edit(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc - { - String idParam = req.getParameter("id"); - - if (idParam == null) - throw new ServletModuleExc("Invalid call: id not supplied "); - - showComment(idParam, req, res); - } - - public void showComment(String anId, HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc { - try { - HTTPRequestParser requestParser = new HTTPRequestParser(aRequest); - Map responseData = ServletHelper.makeGenerationData(new Locale[] {getLocale(aRequest), getFallbackLocale(aRequest)}); - EntityAdapterModel model = MirGlobal.localizer().dataModel().adapterModel(); - Map comment; - URLBuilder urlBuilder = new URLBuilder(); - - urlBuilder.setValue("module", "Comment"); - urlBuilder.setValue("do", "edit"); - urlBuilder.setValue("id", anId); - urlBuilder.setValue("returnurl", requestParser.getParameter("returnurl")); - - if (anId != null) { - responseData.put("new", Boolean.FALSE); - comment = model.makeEntityAdapter("comment", mainModule.getById(anId)); - } - else { - List fields = DatabaseComment.getInstance().getFields(); - responseData.put("new", Boolean.TRUE); - comment = new HashMap(); - Iterator i = fields.iterator(); - while (i.hasNext()) { - comment.put(i.next(), null); - } - -// MirGlobal.localizer().adminInterface().initializeArticle(article); - } - responseData.put("comment", comment); - - responseData.put("returnurl", requestParser.getParameter("returnurl")); - responseData.put("thisurl", urlBuilder.getQuery()); - - ServletHelper.generateResponse(aResponse.getWriter(), responseData, templateObjektString); - } - catch (Throwable e) { - throw new ServletModuleFailure(e); - } - } - - public void attach(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc - { - String mediaIdParam = req.getParameter("mid"); - String commentId = req.getParameter("commentid"); - - if (commentId == null || mediaIdParam==null) throw new ServletModuleExc("smod comment :: attach :: commentid/mid missing"); - - try { - EntityComment comment = (EntityComment) mainModule.getById(commentId); - comment.attach(mediaIdParam); - } - catch(Throwable e) { - throw new ServletModuleFailure(e); - } - - showComment(commentId, req, res); - } - - public void dettach(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc - { - String commentId = req.getParameter("commentid"); - String midParam = req.getParameter("mid"); - if (commentId == null) - throw new ServletModuleExc("smod comment :: dettach :: commentid missing"); - if (midParam == null) - throw new ServletModuleExc("smod comment :: dettach :: mid missing"); - - try { - EntityComment comment = (EntityComment)mainModule.getById(commentId); - comment.dettach(commentId, midParam); - } - catch(Throwable e) { - throw new ServletModuleFailure(e); - } - - showComment(commentId, req, res); - } - - - public void list(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc - { - HTTPRequestParser requestParser = new HTTPRequestParser(aRequest); - - String where = requestParser.getParameter("where"); - String order = requestParser.getParameterWithDefault("order", "webdb_create desc"); - int offset = requestParser.getIntegerWithDefault("offset", 0); - - returnCommentList(aRequest, aResponse, where, order, offset); - } - - public void search(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc - { - HTTPRequestParser requestParser = new HTTPRequestParser(aRequest); - SQLQueryBuilder queryBuilder = new SQLQueryBuilder(); - - String queryField = ""; - String searchField = requestParser.getParameter("searchfield"); - String searchText = requestParser.getParameter("searchtext"); - String searchIsPublished = requestParser.getParameter("searchispublished"); - String searchStatus = requestParser.getParameter("searchstatus"); - String searchOrder = requestParser.getParameter("searchorder"); - - if (searchIsPublished.equals("0")) { - queryBuilder.appendAndCondition("is_published='f'"); - } - else if (searchIsPublished.equals("1")) { - queryBuilder.appendAndCondition("is_published='t'"); - } - - if (searchText.length()>0) { - queryBuilder.appendAndCondition( - "lower("+ searchField + ") like " + - "'%" + JDBCStringRoutines.escapeStringLiteral(searchText.toLowerCase()) + "%'"); - } - - if (searchStatus.length()>0) { - queryBuilder.appendAndCondition("to_comment_status="+Integer.parseInt(searchStatus)); - } - - if (searchOrder.length()>0) { - if (searchOrder.equals("datedesc")) - queryBuilder.appendAscendingOrder("webdb_create"); - else if (searchOrder.equals("dateasc")) - queryBuilder.appendDescendingOrder("webdb_create"); - else if (searchOrder.equals("articletitle")) - queryBuilder.appendAscendingOrder("(select content.title from content where content.id = comment.to_media)"); - else if (searchOrder.equals("creator")) - queryBuilder.appendDescendingOrder("creator"); - } - - returnCommentList(aRequest, aResponse, queryBuilder.getWhereClause(), queryBuilder.getOrderByClause(), 0); - } - - public void articlecomments(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc - { - String articleIdString = req.getParameter("articleid"); - int articleId; - - try { - articleId = Integer.parseInt(articleIdString); - - returnCommentList( req, res, "to_media="+articleId, "webdb_create desc", 0); - } - catch (Throwable e) { - throw new ServletModuleFailure(e); - } - } - - public void returnCommentList(HttpServletRequest aRequest, HttpServletResponse aResponse, - String aWhereClause, String anOrderByClause, int anOffset) throws ServletModuleExc { - - HTTPRequestParser requestParser = new HTTPRequestParser(aRequest); - URLBuilder urlBuilder = new URLBuilder(); - EntityAdapterModel model; - int nrCommentsPerPage = 20; - int count; - - try { - Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)}); - model = MirGlobal.localizer().dataModel().adapterModel(); - - Object commentList = - new CachingRewindableIterator( - new EntityIteratorAdapter( aWhereClause, anOrderByClause, nrCommentsPerPage, - MirGlobal.localizer().dataModel().adapterModel(), "comment", nrCommentsPerPage, anOffset) - ); - - responseData.put("nexturl", null); - responseData.put("prevurl", null); - - count=mainModule.getSize(aWhereClause); - - urlBuilder.setValue("module", "Comment"); - urlBuilder.setValue("do", "list"); - urlBuilder.setValue("where", aWhereClause); - urlBuilder.setValue("order", anOrderByClause); - - urlBuilder.setValue("searchfield", requestParser.getParameter("searchfield")); - urlBuilder.setValue("searchtext", requestParser.getParameter("searchtext")); - urlBuilder.setValue("searchispublished", requestParser.getParameter("searchispublished")); - urlBuilder.setValue("searchstatus", requestParser.getParameter("searchstatus")); - urlBuilder.setValue("searchorder", requestParser.getParameter("searchorder")); - - responseData.put("searchfield", requestParser.getParameter("searchfield")); - responseData.put("searchtext", requestParser.getParameter("searchtext")); - responseData.put("searchispublished", requestParser.getParameter("searchispublished")); - responseData.put("searchstatus", requestParser.getParameter("searchstatus")); - responseData.put("searchorder", requestParser.getParameter("searchorder")); - - urlBuilder.setValue("offset", anOffset); - responseData.put("offset" , new Integer(anOffset).toString()); - responseData.put("thisurl" , urlBuilder.getQuery()); - - if (count>=anOffset+nrCommentsPerPage) { - urlBuilder.setValue("offset", anOffset + nrCommentsPerPage); - responseData.put("nexturl" , urlBuilder.getQuery()); - } - - if (anOffset>0) { - urlBuilder.setValue("offset", Math.max(anOffset - nrCommentsPerPage, 0)); - responseData.put("prevurl" , urlBuilder.getQuery()); - } - - responseData.put("comments", commentList); - responseData.put("from" , Integer.toString(anOffset+1)); - responseData.put("count", Integer.toString(count)); - responseData.put("to", Integer.toString(Math.min(anOffset+nrCommentsPerPage, count))); - - ServletHelper.generateResponse(aResponse.getWriter(), responseData, "commentlist.template"); - } - catch (Throwable e) { - throw new ServletModuleFailure(e); - } - } -} - +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir 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 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ + +package mircoders.servlet; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import mir.config.MirPropertiesConfiguration; +import mir.entity.adapter.EntityAdapterModel; +import mir.entity.adapter.EntityIteratorAdapter; +import mir.log.LoggerWrapper; +import mir.servlet.ServletModule; +import mir.servlet.ServletModuleExc; +import mir.servlet.ServletModuleFailure; +import mir.util.CachingRewindableIterator; +import mir.util.HTTPRequestParser; +import mir.util.JDBCStringRoutines; +import mir.util.SQLQueryBuilder; +import mir.util.URLBuilder; +import mircoders.entity.EntityComment; +import mircoders.global.MirGlobal; +import mircoders.module.ModuleComment; +import mircoders.module.ModuleContent; +import mircoders.storage.DatabaseComment; +import mircoders.storage.DatabaseContent; + +/* + * ServletModuleComment - controls navigation for Comments + * + * + * @author RK + */ + +public class ServletModuleComment extends ServletModule +{ + private ModuleContent moduleContent; + + private static ServletModuleComment instance = new ServletModuleComment(); + public static ServletModule getInstance() { return instance; } + + private ServletModuleComment() { + logger = new LoggerWrapper("ServletModule.Comment"); + try { + configuration = MirPropertiesConfiguration.instance(); + templateListString = configuration.getString("ServletModule.Comment.ListTemplate"); + templateObjektString = configuration.getString("ServletModule.Comment.ObjektTemplate"); + templateConfirmString = configuration.getString("ServletModule.Comment.ConfirmTemplate"); + + mainModule = new ModuleComment(DatabaseComment.getInstance()); + moduleContent = new ModuleContent(DatabaseContent.getInstance()); + } + catch (Exception e) { + logger.error("servletmodule comment could not be initialized:" + e.getMessage()); + } + } + + public void edit(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc + { + String idParam = req.getParameter("id"); + + if (idParam == null) + throw new ServletModuleExc("Invalid call: id not supplied "); + + showComment(idParam, req, res); + } + + public void showComment(String anId, HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc { + try { + HTTPRequestParser requestParser = new HTTPRequestParser(aRequest); + Map responseData = ServletHelper.makeGenerationData(new Locale[] {getLocale(aRequest), getFallbackLocale(aRequest)}); + EntityAdapterModel model = MirGlobal.localizer().dataModel().adapterModel(); + Map comment; + URLBuilder urlBuilder = new URLBuilder(); + + urlBuilder.setValue("module", "Comment"); + urlBuilder.setValue("do", "edit"); + urlBuilder.setValue("id", anId); + urlBuilder.setValue("returnurl", requestParser.getParameter("returnurl")); + + if (anId != null) { + responseData.put("new", Boolean.FALSE); + comment = model.makeEntityAdapter("comment", mainModule.getById(anId)); + } + else { + List fields = DatabaseComment.getInstance().getFields(); + responseData.put("new", Boolean.TRUE); + comment = new HashMap(); + Iterator i = fields.iterator(); + while (i.hasNext()) { + comment.put(i.next(), null); + } + +// MirGlobal.localizer().adminInterface().initializeArticle(article); + } + responseData.put("comment", comment); + + responseData.put("returnurl", requestParser.getParameter("returnurl")); + responseData.put("thisurl", urlBuilder.getQuery()); + + ServletHelper.generateResponse(aResponse.getWriter(), responseData, templateObjektString); + } + catch (Throwable e) { + throw new ServletModuleFailure(e); + } + } + + public void attach(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc + { + String mediaIdParam = req.getParameter("mid"); + String commentId = req.getParameter("commentid"); + + if (commentId == null || mediaIdParam==null) throw new ServletModuleExc("smod comment :: attach :: commentid/mid missing"); + + try { + EntityComment comment = (EntityComment) mainModule.getById(commentId); + comment.attach(mediaIdParam); + } + catch(Throwable e) { + throw new ServletModuleFailure(e); + } + + showComment(commentId, req, res); + } + + public void dettach(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc + { + String commentId = req.getParameter("commentid"); + String midParam = req.getParameter("mid"); + if (commentId == null) + throw new ServletModuleExc("smod comment :: dettach :: commentid missing"); + if (midParam == null) + throw new ServletModuleExc("smod comment :: dettach :: mid missing"); + + try { + EntityComment comment = (EntityComment)mainModule.getById(commentId); + comment.dettach(commentId, midParam); + } + catch(Throwable e) { + throw new ServletModuleFailure(e); + } + + showComment(commentId, req, res); + } + + + public void list(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc + { + HTTPRequestParser requestParser = new HTTPRequestParser(aRequest); + + String where = requestParser.getParameter("where"); + String order = requestParser.getParameterWithDefault("order", "webdb_create desc"); + int offset = requestParser.getIntegerWithDefault("offset", 0); + + returnCommentList(aRequest, aResponse, where, order, offset); + } + + public void search(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc + { + HTTPRequestParser requestParser = new HTTPRequestParser(aRequest); + SQLQueryBuilder queryBuilder = new SQLQueryBuilder(); + + String queryField = ""; + String searchField = requestParser.getParameter("searchfield"); + String searchText = requestParser.getParameter("searchtext"); + String searchIsPublished = requestParser.getParameter("searchispublished"); + String searchStatus = requestParser.getParameter("searchstatus"); + String searchOrder = requestParser.getParameter("searchorder"); + + if (searchIsPublished.equals("0")) { + queryBuilder.appendAndCondition("is_published='f'"); + } + else if (searchIsPublished.equals("1")) { + queryBuilder.appendAndCondition("is_published='t'"); + } + + if (searchText.length()>0) { + queryBuilder.appendAndCondition( + "lower("+ searchField + ") like " + + "'%" + JDBCStringRoutines.escapeStringLiteral(searchText.toLowerCase()) + "%'"); + } + + if (searchStatus.length()>0) { + queryBuilder.appendAndCondition("to_comment_status="+Integer.parseInt(searchStatus)); + } + + if (searchOrder.length()>0) { + if (searchOrder.equals("datedesc")) + queryBuilder.appendAscendingOrder("webdb_create"); + else if (searchOrder.equals("dateasc")) + queryBuilder.appendDescendingOrder("webdb_create"); + else if (searchOrder.equals("articletitle")) + queryBuilder.appendAscendingOrder("(select content.title from content where content.id = comment.to_media)"); + else if (searchOrder.equals("creator")) + queryBuilder.appendDescendingOrder("creator"); + } + + returnCommentList(aRequest, aResponse, queryBuilder.getWhereClause(), queryBuilder.getOrderByClause(), 0); + } + + public void articlecomments(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc + { + String articleIdString = req.getParameter("articleid"); + int articleId; + + try { + articleId = Integer.parseInt(articleIdString); + + returnCommentList( req, res, "to_media="+articleId, "webdb_create desc", 0); + } + catch (Throwable e) { + throw new ServletModuleFailure(e); + } + } + + public void returnCommentList(HttpServletRequest aRequest, HttpServletResponse aResponse, + String aWhereClause, String anOrderByClause, int anOffset) throws ServletModuleExc { + + HTTPRequestParser requestParser = new HTTPRequestParser(aRequest); + URLBuilder urlBuilder = new URLBuilder(); + EntityAdapterModel model; + int nrCommentsPerPage = 20; + int count; + + try { + Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)}); + model = MirGlobal.localizer().dataModel().adapterModel(); + + Object commentList = + new CachingRewindableIterator( + new EntityIteratorAdapter( aWhereClause, anOrderByClause, nrCommentsPerPage, + MirGlobal.localizer().dataModel().adapterModel(), "comment", nrCommentsPerPage, anOffset) + ); + + responseData.put("nexturl", null); + responseData.put("prevurl", null); + + count=mainModule.getSize(aWhereClause); + + urlBuilder.setValue("module", "Comment"); + urlBuilder.setValue("do", "list"); + urlBuilder.setValue("where", aWhereClause); + urlBuilder.setValue("order", anOrderByClause); + + urlBuilder.setValue("searchfield", requestParser.getParameter("searchfield")); + urlBuilder.setValue("searchtext", requestParser.getParameter("searchtext")); + urlBuilder.setValue("searchispublished", requestParser.getParameter("searchispublished")); + urlBuilder.setValue("searchstatus", requestParser.getParameter("searchstatus")); + urlBuilder.setValue("searchorder", requestParser.getParameter("searchorder")); + + responseData.put("searchfield", requestParser.getParameter("searchfield")); + responseData.put("searchtext", requestParser.getParameter("searchtext")); + responseData.put("searchispublished", requestParser.getParameter("searchispublished")); + responseData.put("searchstatus", requestParser.getParameter("searchstatus")); + responseData.put("searchorder", requestParser.getParameter("searchorder")); + + urlBuilder.setValue("offset", anOffset); + responseData.put("offset" , new Integer(anOffset).toString()); + responseData.put("thisurl" , urlBuilder.getQuery()); + + if (count>=anOffset+nrCommentsPerPage) { + urlBuilder.setValue("offset", anOffset + nrCommentsPerPage); + responseData.put("nexturl" , urlBuilder.getQuery()); + } + + if (anOffset>0) { + urlBuilder.setValue("offset", Math.max(anOffset - nrCommentsPerPage, 0)); + responseData.put("prevurl" , urlBuilder.getQuery()); + } + + responseData.put("comments", commentList); + responseData.put("from" , Integer.toString(anOffset+1)); + responseData.put("count", Integer.toString(count)); + responseData.put("to", Integer.toString(Math.min(anOffset+nrCommentsPerPage, count))); + + ServletHelper.generateResponse(aResponse.getWriter(), responseData, "commentlist.template"); + } + catch (Throwable e) { + throw new ServletModuleFailure(e); + } + } +} + diff --git a/source/mircoders/servlet/ServletModuleCommentStatus.java b/source/mircoders/servlet/ServletModuleCommentStatus.java index d2adaac5..2f13787e 100755 --- a/source/mircoders/servlet/ServletModuleCommentStatus.java +++ b/source/mircoders/servlet/ServletModuleCommentStatus.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.servlet; import mir.config.MirPropertiesConfiguration; diff --git a/source/mircoders/servlet/ServletModuleContent.java b/source/mircoders/servlet/ServletModuleContent.java index 272f0413..cfc02e73 100755 --- a/source/mircoders/servlet/ServletModuleContent.java +++ b/source/mircoders/servlet/ServletModuleContent.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,33 +18,29 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.servlet; -import java.util.Arrays; import java.util.GregorianCalendar; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.apache.lucene.index.IndexReader; -import freemarker.template.SimpleHash; - import mir.entity.adapter.EntityAdapterModel; import mir.entity.adapter.EntityIteratorAdapter; import mir.log.LoggerWrapper; @@ -67,11 +63,15 @@ import mircoders.storage.DatabaseContent; import mircoders.storage.DatabaseContentToMedia; import mircoders.storage.DatabaseContentToTopics; +import org.apache.lucene.index.IndexReader; + +import freemarker.template.SimpleHash; + /* * ServletModuleContent - * deliver html for the article admin form. * - * @version $Id: ServletModuleContent.java,v 1.49 2003/04/21 00:24:06 zapata Exp $ + * @version $Id: ServletModuleContent.java,v 1.50 2003/04/21 12:42:51 idfx Exp $ * @author rk, mir-coders * */ diff --git a/source/mircoders/servlet/ServletModuleFileEdit.java b/source/mircoders/servlet/ServletModuleFileEdit.java index 1698666f..2fef2b9b 100755 --- a/source/mircoders/servlet/ServletModuleFileEdit.java +++ b/source/mircoders/servlet/ServletModuleFileEdit.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.servlet; @@ -39,9 +38,10 @@ import java.io.StringReader; import java.io.StringWriter; import java.util.Arrays; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Vector; -import java.util.Locale; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -58,8 +58,8 @@ import mir.util.URLBuilder; * Allows one to do a basic edit of a file in a directory specified * in the config file. * - * @author $Author: zapata $ - * @version $Revision: 1.9 $ $Date: 2003/04/09 02:06:09 $ + * @author $Author: idfx $ + * @version $Revision: 1.10 $ $Date: 2003/04/21 12:42:51 $ * */ diff --git a/source/mircoders/servlet/ServletModuleHidden.java b/source/mircoders/servlet/ServletModuleHidden.java index 6da2e3cc..f1d80021 100755 --- a/source/mircoders/servlet/ServletModuleHidden.java +++ b/source/mircoders/servlet/ServletModuleHidden.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.servlet; import javax.servlet.http.HttpServletRequest; diff --git a/source/mircoders/servlet/ServletModuleImages.java b/source/mircoders/servlet/ServletModuleImages.java index 07dd4776..1e1c9ec9 100755 --- a/source/mircoders/servlet/ServletModuleImages.java +++ b/source/mircoders/servlet/ServletModuleImages.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.servlet; import mir.log.LoggerWrapper; @@ -40,7 +38,7 @@ import mircoders.storage.DatabaseImages; /* * ServletModuleImages - * - * @version $Id: ServletModuleImages.java,v 1.25 2003/01/25 17:50:36 idfx Exp $ + * @version $Id: ServletModuleImages.java,v 1.26 2003/04/21 12:42:51 idfx Exp $ * @author RK, the mir-coders group */ diff --git a/source/mircoders/servlet/ServletModuleLanguage.java b/source/mircoders/servlet/ServletModuleLanguage.java index ed28fb3d..724d73f2 100755 --- a/source/mircoders/servlet/ServletModuleLanguage.java +++ b/source/mircoders/servlet/ServletModuleLanguage.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.servlet; import mir.log.LoggerWrapper; diff --git a/source/mircoders/servlet/ServletModuleLinksImcs.java b/source/mircoders/servlet/ServletModuleLinksImcs.java index 4cca2063..5b19071d 100755 --- a/source/mircoders/servlet/ServletModuleLinksImcs.java +++ b/source/mircoders/servlet/ServletModuleLinksImcs.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.servlet; import java.io.PrintWriter; diff --git a/source/mircoders/servlet/ServletModuleLocalizer.java b/source/mircoders/servlet/ServletModuleLocalizer.java index aa973b34..bc6214b3 100755 --- a/source/mircoders/servlet/ServletModuleLocalizer.java +++ b/source/mircoders/servlet/ServletModuleLocalizer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.servlet; import java.util.List; diff --git a/source/mircoders/servlet/ServletModuleMediafolder.java b/source/mircoders/servlet/ServletModuleMediafolder.java index 022e6be8..ac353500 100755 --- a/source/mircoders/servlet/ServletModuleMediafolder.java +++ b/source/mircoders/servlet/ServletModuleMediafolder.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.servlet; /** diff --git a/source/mircoders/servlet/ServletModuleMessage.java b/source/mircoders/servlet/ServletModuleMessage.java index 8d10cf47..efd1e6b1 100755 --- a/source/mircoders/servlet/ServletModuleMessage.java +++ b/source/mircoders/servlet/ServletModuleMessage.java @@ -1,116 +1,115 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir 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 of the License, or - * (at your option) any later version. - * - * Mir 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 Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package mircoders.servlet; - -import java.net.URLEncoder; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import freemarker.template.SimpleHash; -import mir.entity.EntityList; -import mir.log.LoggerWrapper; -import mir.misc.HTMLTemplateProcessor; -import mir.servlet.ServletModule; -import mir.servlet.ServletModuleExc; -import mir.servlet.ServletModuleFailure; -import mir.storage.StorageObjectFailure; -import mircoders.module.ModuleMessage; -import mircoders.storage.DatabaseMessages; - -/** - * Title: ServletModuleMessage - * Description: - * Copyright: Copyright (c) 2001-2002 - * Company: mir-coders - * @author - * @version 1.0 - */ - - -public class ServletModuleMessage extends ServletModule -{ - - // Singelton / Kontruktor - - private static ServletModuleMessage instance = new ServletModuleMessage(); - public static ServletModule getInstance() { return instance; } - - private ServletModuleMessage() { - super(); - logger = new LoggerWrapper("ServletModule.Messages"); - - templateListString = configuration.getString("ServletModule.Messages.ListTemplate"); - templateObjektString = configuration.getString("ServletModule.Messages.ObjektTemplate"); - templateConfirmString = configuration.getString("ServletModule.Messages.ConfirmTemplate"); - - try { - mainModule = new ModuleMessage(DatabaseMessages.getInstance()); - } - catch (StorageObjectFailure e) { - logger.error("initialization of ServletModuleMessage failed!: " + e.getMessage()); - - throw new ServletModuleFailure(e); - } - } - - public void list(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc - { -// fetch and deliver - try { - SimpleHash mergeData = new SimpleHash(); - String offset = req.getParameter("offset"); - if (offset==null || offset.equals("")) offset="0"; - mergeData.put("offset",offset); - EntityList theList = mainModule.getByWhereClause(null, "webdb_create desc", (new Integer(offset)).intValue()); - mergeData.put("contentlist",theList); - if(theList.getOrder()!=null) { - mergeData.put("order", theList.getOrder()); - mergeData.put("order_encoded", URLEncoder.encode(theList.getOrder())); - } - mergeData.put("count", (new Integer(theList.getCount())).toString()); - mergeData.put("from", (new Integer(theList.getFrom())).toString()); - mergeData.put("to", (new Integer(theList.getTo())).toString()); - if (theList.hasNextBatch()) - mergeData.put("next", (new Integer(theList.getNextBatch())).toString()); - if (theList.hasPrevBatch()) - mergeData.put("prev", (new Integer(theList.getPrevBatch())).toString()); - - HTMLTemplateProcessor.process(res, templateListString, mergeData, res.getWriter(), getLocale(req), getFallbackLocale(req)); - - } - catch (Throwable e) { - throw new ServletModuleFailure(e); - } - } - - -} +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir 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 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ +package mircoders.servlet; + +import java.net.URLEncoder; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import mir.entity.EntityList; +import mir.log.LoggerWrapper; +import mir.misc.HTMLTemplateProcessor; +import mir.servlet.ServletModule; +import mir.servlet.ServletModuleExc; +import mir.servlet.ServletModuleFailure; +import mir.storage.StorageObjectFailure; +import mircoders.module.ModuleMessage; +import mircoders.storage.DatabaseMessages; +import freemarker.template.SimpleHash; + +/** + * Title: ServletModuleMessage + * Description: + * Copyright: Copyright (c) 2001-2002 + * Company: mir-coders + * @author + * @version 1.0 + */ + + +public class ServletModuleMessage extends ServletModule +{ + + // Singelton / Kontruktor + + private static ServletModuleMessage instance = new ServletModuleMessage(); + public static ServletModule getInstance() { return instance; } + + private ServletModuleMessage() { + super(); + logger = new LoggerWrapper("ServletModule.Messages"); + + templateListString = configuration.getString("ServletModule.Messages.ListTemplate"); + templateObjektString = configuration.getString("ServletModule.Messages.ObjektTemplate"); + templateConfirmString = configuration.getString("ServletModule.Messages.ConfirmTemplate"); + + try { + mainModule = new ModuleMessage(DatabaseMessages.getInstance()); + } + catch (StorageObjectFailure e) { + logger.error("initialization of ServletModuleMessage failed!: " + e.getMessage()); + + throw new ServletModuleFailure(e); + } + } + + public void list(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc + { +// fetch and deliver + try { + SimpleHash mergeData = new SimpleHash(); + String offset = req.getParameter("offset"); + if (offset==null || offset.equals("")) offset="0"; + mergeData.put("offset",offset); + EntityList theList = mainModule.getByWhereClause(null, "webdb_create desc", (new Integer(offset)).intValue()); + mergeData.put("contentlist",theList); + if(theList.getOrder()!=null) { + mergeData.put("order", theList.getOrder()); + mergeData.put("order_encoded", URLEncoder.encode(theList.getOrder())); + } + mergeData.put("count", (new Integer(theList.getCount())).toString()); + mergeData.put("from", (new Integer(theList.getFrom())).toString()); + mergeData.put("to", (new Integer(theList.getTo())).toString()); + if (theList.hasNextBatch()) + mergeData.put("next", (new Integer(theList.getNextBatch())).toString()); + if (theList.hasPrevBatch()) + mergeData.put("prev", (new Integer(theList.getPrevBatch())).toString()); + + HTMLTemplateProcessor.process(res, templateListString, mergeData, res.getWriter(), getLocale(req), getFallbackLocale(req)); + + } + catch (Throwable e) { + throw new ServletModuleFailure(e); + } + } + + +} diff --git a/source/mircoders/servlet/ServletModuleOpenIndy.java b/source/mircoders/servlet/ServletModuleOpenIndy.java index e68f9fd6..0f0f47aa 100755 --- a/source/mircoders/servlet/ServletModuleOpenIndy.java +++ b/source/mircoders/servlet/ServletModuleOpenIndy.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.servlet; @@ -123,7 +122,7 @@ import mircoders.storage.DatabaseTopics; * open-postings to the newswire * * @author mir-coders group - * @version $Id: ServletModuleOpenIndy.java,v 1.79 2003/04/21 02:58:30 zapata Exp $ + * @version $Id: ServletModuleOpenIndy.java,v 1.80 2003/04/21 12:42:51 idfx Exp $ * */ @@ -505,7 +504,7 @@ public class ServletModuleOpenIndy extends ServletModule deliver(aRequest, aResponse, mergeData, null, postingFormDoneTemplate); } catch (Throwable e) { - e.printStackTrace(logger.asPrintWriter(logger.DEBUG_MESSAGE)); + e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE)); Throwable cause = ExceptionFunctions.traceCauseException(e); if (cause instanceof UnsupportedMediaFormatExc) { @@ -560,7 +559,7 @@ public class ServletModuleOpenIndy extends ServletModule } catch (Throwable t) { logger.error(t.toString()); - t.printStackTrace(logger.asPrintWriter(logger.DEBUG_MESSAGE)); + t.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE)); throw new ServletModuleFailure(t); } diff --git a/source/mircoders/servlet/ServletModuleOtherMedia.java b/source/mircoders/servlet/ServletModuleOtherMedia.java index b7084769..23f71eae 100755 --- a/source/mircoders/servlet/ServletModuleOtherMedia.java +++ b/source/mircoders/servlet/ServletModuleOtherMedia.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.servlet; diff --git a/source/mircoders/servlet/ServletModuleProducer.java b/source/mircoders/servlet/ServletModuleProducer.java index 79562459..b6216603 100755 --- a/source/mircoders/servlet/ServletModuleProducer.java +++ b/source/mircoders/servlet/ServletModuleProducer.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.servlet; import java.io.PrintWriter; @@ -47,7 +45,6 @@ import mir.log.LoggerWrapper; import mir.producer.ProducerFactory; import mir.servlet.ServletModule; import mir.servlet.ServletModuleFailure; -import mir.util.NullWriter; import mir.util.ResourceBundleGeneratorFunction; import mircoders.global.MirGlobal; diff --git a/source/mircoders/servlet/ServletModuleTopics.java b/source/mircoders/servlet/ServletModuleTopics.java index 4e480bdc..d2a39161 100755 --- a/source/mircoders/servlet/ServletModuleTopics.java +++ b/source/mircoders/servlet/ServletModuleTopics.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.servlet; diff --git a/source/mircoders/servlet/ServletModuleUploadedMedia.java b/source/mircoders/servlet/ServletModuleUploadedMedia.java index 27bcf274..d4047553 100755 --- a/source/mircoders/servlet/ServletModuleUploadedMedia.java +++ b/source/mircoders/servlet/ServletModuleUploadedMedia.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.servlet; @@ -38,16 +37,13 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Vector; + import javax.servlet.ServletContext; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import org.apache.commons.fileupload.FileItem; -import freemarker.template.SimpleHash; -import freemarker.template.SimpleList; - import mir.config.MirPropertiesConfiguration; import mir.entity.Entity; import mir.entity.EntityList; @@ -71,11 +67,16 @@ import mircoders.storage.DatabaseComment; import mircoders.storage.DatabaseContent; import mircoders.storage.DatabaseMediafolder; +import org.apache.commons.fileupload.FileItem; + +import freemarker.template.SimpleHash; +import freemarker.template.SimpleList; + /* * ServletModuleBilder - * liefert HTML fuer Bilder * - * @version $Id: ServletModuleUploadedMedia.java,v 1.25 2003/04/21 02:58:30 zapata Exp $ + * @version $Id: ServletModuleUploadedMedia.java,v 1.26 2003/04/21 12:42:51 idfx Exp $ * @author RK, the mir-coders group */ diff --git a/source/mircoders/servlet/ServletModuleUsers.java b/source/mircoders/servlet/ServletModuleUsers.java index 80874323..1d6e2e0e 100755 --- a/source/mircoders/servlet/ServletModuleUsers.java +++ b/source/mircoders/servlet/ServletModuleUsers.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.servlet; diff --git a/source/mircoders/servlet/ServletModuleVideo.java b/source/mircoders/servlet/ServletModuleVideo.java index b8296b5a..d206247c 100755 --- a/source/mircoders/servlet/ServletModuleVideo.java +++ b/source/mircoders/servlet/ServletModuleVideo.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.servlet; diff --git a/source/mircoders/storage/DatabaseArticleType.java b/source/mircoders/storage/DatabaseArticleType.java index 28ed2793..85ff8ede 100755 --- a/source/mircoders/storage/DatabaseArticleType.java +++ b/source/mircoders/storage/DatabaseArticleType.java @@ -1,73 +1,72 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir 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 of the License, or - * (at your option) any later version. - * - * Mir 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 Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package mircoders.storage; - -/** - * Title: - * Description: - * Copyright: Copyright (c) 2001 - * Company: Indymedia - * @author - * @version 1.0 - */ - -import freemarker.template.SimpleList; -import mir.log.LoggerWrapper; -import mir.storage.Database; -import mir.storage.StorageObject; -import mir.storage.StorageObjectFailure; - - -public class DatabaseArticleType extends Database implements StorageObject{ - - private static DatabaseArticleType instance; - private static SimpleList articletypePopupData; - - public synchronized static DatabaseArticleType getInstance() throws StorageObjectFailure { - if (instance == null) { - instance = new DatabaseArticleType(); - instance.myselfDatabase = instance; - } - return instance; - } - - private DatabaseArticleType() throws StorageObjectFailure { - super(); - logger = new LoggerWrapper("Database.ArticleType"); - this.hasTimestamp = false; - this.theTable = "article_type"; - } - - public SimpleList getPopupData() throws StorageObjectFailure { - return getPopupData("name", false); - } -} +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir 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 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ + +package mircoders.storage; + +/** + * Title: + * Description: + * Copyright: Copyright (c) 2001 + * Company: Indymedia + * @author + * @version 1.0 + */ + +import mir.log.LoggerWrapper; +import mir.storage.Database; +import mir.storage.StorageObject; +import mir.storage.StorageObjectFailure; +import freemarker.template.SimpleList; + + +public class DatabaseArticleType extends Database implements StorageObject{ + + private static DatabaseArticleType instance; + private static SimpleList articletypePopupData; + + public synchronized static DatabaseArticleType getInstance() throws StorageObjectFailure { + if (instance == null) { + instance = new DatabaseArticleType(); + instance.myselfDatabase = instance; + } + return instance; + } + + private DatabaseArticleType() throws StorageObjectFailure { + super(); + logger = new LoggerWrapper("Database.ArticleType"); + this.hasTimestamp = false; + this.theTable = "article_type"; + } + + public SimpleList getPopupData() throws StorageObjectFailure { + return getPopupData("name", false); + } +} diff --git a/source/mircoders/storage/DatabaseAudio.java b/source/mircoders/storage/DatabaseAudio.java index b5aa0b7d..fbe24e3a 100755 --- a/source/mircoders/storage/DatabaseAudio.java +++ b/source/mircoders/storage/DatabaseAudio.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.storage; import java.util.GregorianCalendar; diff --git a/source/mircoders/storage/DatabaseBreaking.java b/source/mircoders/storage/DatabaseBreaking.java index f926fd32..c85a317e 100755 --- a/source/mircoders/storage/DatabaseBreaking.java +++ b/source/mircoders/storage/DatabaseBreaking.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; diff --git a/source/mircoders/storage/DatabaseComment.java b/source/mircoders/storage/DatabaseComment.java index 439a6ba1..d9ceef92 100755 --- a/source/mircoders/storage/DatabaseComment.java +++ b/source/mircoders/storage/DatabaseComment.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,28 +18,27 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.Statement; - -import freemarker.template.SimpleList; -import mir.log.LoggerWrapper; -import mir.storage.Database; -import mir.storage.StorageObject; +import java.sql.Connection; +import java.sql.SQLException; +import java.sql.Statement; + +import mir.log.LoggerWrapper; +import mir.storage.Database; +import mir.storage.StorageObject; import mir.storage.StorageObjectFailure; +import freemarker.template.SimpleList; /** * This class implements the access to the comment-table for the diff --git a/source/mircoders/storage/DatabaseCommentStatus.java b/source/mircoders/storage/DatabaseCommentStatus.java index 904cb6cc..349f4cf6 100755 --- a/source/mircoders/storage/DatabaseCommentStatus.java +++ b/source/mircoders/storage/DatabaseCommentStatus.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; diff --git a/source/mircoders/storage/DatabaseCommentToMedia.java b/source/mircoders/storage/DatabaseCommentToMedia.java index 71befbb8..0cf28f8b 100755 --- a/source/mircoders/storage/DatabaseCommentToMedia.java +++ b/source/mircoders/storage/DatabaseCommentToMedia.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; @@ -48,7 +47,7 @@ import mircoders.entity.EntityUploadedMedia; * implements abstract DB connection to the comment_x_media SQL table * * @author RK, mir-coders group - * @version $Id: DatabaseCommentToMedia.java,v 1.1 2003/04/10 03:31:47 zapata Exp $ + * @version $Id: DatabaseCommentToMedia.java,v 1.2 2003/04/21 12:42:47 idfx Exp $ * */ diff --git a/source/mircoders/storage/DatabaseContent.java b/source/mircoders/storage/DatabaseContent.java index ebaeed0e..b3327785 100755 --- a/source/mircoders/storage/DatabaseContent.java +++ b/source/mircoders/storage/DatabaseContent.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; diff --git a/source/mircoders/storage/DatabaseContentToMedia.java b/source/mircoders/storage/DatabaseContentToMedia.java index 1572cb28..c06f91ae 100755 --- a/source/mircoders/storage/DatabaseContentToMedia.java +++ b/source/mircoders/storage/DatabaseContentToMedia.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; @@ -48,7 +47,7 @@ import mircoders.entity.EntityUploadedMedia; * implements abstract DB connection to the content_x_media SQL table * * @author RK, mir-coders group - * @version $Id: DatabaseContentToMedia.java,v 1.17 2003/04/09 02:06:10 zapata Exp $ + * @version $Id: DatabaseContentToMedia.java,v 1.18 2003/04/21 12:42:48 idfx Exp $ * */ diff --git a/source/mircoders/storage/DatabaseContentToTopics.java b/source/mircoders/storage/DatabaseContentToTopics.java index fbf46e22..52e6dbd2 100755 --- a/source/mircoders/storage/DatabaseContentToTopics.java +++ b/source/mircoders/storage/DatabaseContentToTopics.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; diff --git a/source/mircoders/storage/DatabaseImageColor.java b/source/mircoders/storage/DatabaseImageColor.java index 6b0bd9e4..90c7844b 100755 --- a/source/mircoders/storage/DatabaseImageColor.java +++ b/source/mircoders/storage/DatabaseImageColor.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; diff --git a/source/mircoders/storage/DatabaseImageFormat.java b/source/mircoders/storage/DatabaseImageFormat.java index 776b679f..ee0dd72d 100755 --- a/source/mircoders/storage/DatabaseImageFormat.java +++ b/source/mircoders/storage/DatabaseImageFormat.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; diff --git a/source/mircoders/storage/DatabaseImageLayout.java b/source/mircoders/storage/DatabaseImageLayout.java index 677e635c..7b042228 100755 --- a/source/mircoders/storage/DatabaseImageLayout.java +++ b/source/mircoders/storage/DatabaseImageLayout.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; diff --git a/source/mircoders/storage/DatabaseImageType.java b/source/mircoders/storage/DatabaseImageType.java index 2743ba6e..f8875e4d 100755 --- a/source/mircoders/storage/DatabaseImageType.java +++ b/source/mircoders/storage/DatabaseImageType.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.storage; import mir.log.LoggerWrapper; diff --git a/source/mircoders/storage/DatabaseImages.java b/source/mircoders/storage/DatabaseImages.java index 0638f333..7e1f030d 100755 --- a/source/mircoders/storage/DatabaseImages.java +++ b/source/mircoders/storage/DatabaseImages.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; diff --git a/source/mircoders/storage/DatabaseLanguage.java b/source/mircoders/storage/DatabaseLanguage.java index dddac23f..17d7496d 100755 --- a/source/mircoders/storage/DatabaseLanguage.java +++ b/source/mircoders/storage/DatabaseLanguage.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; diff --git a/source/mircoders/storage/DatabaseLinksImcs.java b/source/mircoders/storage/DatabaseLinksImcs.java index 3ca88c3f..85c8144f 100755 --- a/source/mircoders/storage/DatabaseLinksImcs.java +++ b/source/mircoders/storage/DatabaseLinksImcs.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; diff --git a/source/mircoders/storage/DatabaseMedia.java b/source/mircoders/storage/DatabaseMedia.java index 9da7e10d..16d10025 100755 --- a/source/mircoders/storage/DatabaseMedia.java +++ b/source/mircoders/storage/DatabaseMedia.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; diff --git a/source/mircoders/storage/DatabaseMediaType.java b/source/mircoders/storage/DatabaseMediaType.java index c1101bd2..157caf91 100755 --- a/source/mircoders/storage/DatabaseMediaType.java +++ b/source/mircoders/storage/DatabaseMediaType.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.storage; import mir.log.LoggerWrapper; diff --git a/source/mircoders/storage/DatabaseMediafolder.java b/source/mircoders/storage/DatabaseMediafolder.java index 103ee16f..d9eed43f 100755 --- a/source/mircoders/storage/DatabaseMediafolder.java +++ b/source/mircoders/storage/DatabaseMediafolder.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; diff --git a/source/mircoders/storage/DatabaseMessages.java b/source/mircoders/storage/DatabaseMessages.java index 5457e73a..464e232b 100755 --- a/source/mircoders/storage/DatabaseMessages.java +++ b/source/mircoders/storage/DatabaseMessages.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,21 +18,20 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; -import mir.log.LoggerWrapper; -import mir.storage.Database; +import mir.log.LoggerWrapper; +import mir.storage.Database; import mir.storage.StorageObject; diff --git a/source/mircoders/storage/DatabaseOther.java b/source/mircoders/storage/DatabaseOther.java index 3ed15543..cec04983 100755 --- a/source/mircoders/storage/DatabaseOther.java +++ b/source/mircoders/storage/DatabaseOther.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,17 +18,15 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ - package mircoders.storage; diff --git a/source/mircoders/storage/DatabaseRights.java b/source/mircoders/storage/DatabaseRights.java index 772c318f..e0f59956 100755 --- a/source/mircoders/storage/DatabaseRights.java +++ b/source/mircoders/storage/DatabaseRights.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; diff --git a/source/mircoders/storage/DatabaseTopics.java b/source/mircoders/storage/DatabaseTopics.java index 09a15442..f3922614 100755 --- a/source/mircoders/storage/DatabaseTopics.java +++ b/source/mircoders/storage/DatabaseTopics.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; diff --git a/source/mircoders/storage/DatabaseUploadedMedia.java b/source/mircoders/storage/DatabaseUploadedMedia.java index 5d91315a..3d433898 100755 --- a/source/mircoders/storage/DatabaseUploadedMedia.java +++ b/source/mircoders/storage/DatabaseUploadedMedia.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; diff --git a/source/mircoders/storage/DatabaseUsers.java b/source/mircoders/storage/DatabaseUsers.java index 580cc260..8e104b14 100755 --- a/source/mircoders/storage/DatabaseUsers.java +++ b/source/mircoders/storage/DatabaseUsers.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; diff --git a/source/mircoders/storage/DatabaseVideo.java b/source/mircoders/storage/DatabaseVideo.java index 0c720e89..02238c32 100755 --- a/source/mircoders/storage/DatabaseVideo.java +++ b/source/mircoders/storage/DatabaseVideo.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2001, 2002 The Mir-coders group + * Copyright (C) 2001, 2002 The Mir-coders group * * This file is part of Mir. * @@ -18,15 +18,14 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. */ package mircoders.storage; diff --git a/source/tool/BundleTool.java b/source/tool/BundleTool.java index 7f26fa0e..e44345b0 100755 --- a/source/tool/BundleTool.java +++ b/source/tool/BundleTool.java @@ -1,36 +1,35 @@ -/* - * Copyright (C) 2001, 2002 The Mir-coders group - * - * This file is part of Mir. - * - * Mir 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 of the License, or - * (at your option) any later version. - * - * Mir 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 Mir; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * In addition, as a special exception, The Mir-coders gives permission to link - * the code of this program with the com.oreilly.servlet library, any library - * licensed under the Apache Software License, The Sun (tm) Java Advanced - * Imaging library (JAI), The Sun JIMI library (or with modified versions of - * the above that use the same license as the above), and distribute linked - * combinations including the two. You must obey the GNU General Public - * License in all respects for all of the code used other than the above - * mentioned libraries. If you modify this file, you may extend this exception - * to your version of the file, but you are not obligated to do so. If you do - * not wish to do so, delete this exception statement from your version. - */ - -package tool; - +/* + * Copyright (C) 2001, 2002 The Mir-coders group + * + * This file is part of Mir. + * + * Mir 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 of the License, or + * (at your option) any later version. + * + * Mir 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 Mir; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * In addition, as a special exception, The Mir-coders gives permission to link + * the code of this program with any library licensed under the Apache Software License, + * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library + * (or with modified versions of the above that use the same license as the above), + * and distribute linked combinations including the two. You must obey the + * GNU General Public License in all respects for all of the code used other than + * the above mentioned libraries. If you modify this file, you may extend this + * exception to your version of the file, but you are not obligated to do so. + * If you do not wish to do so, delete this exception statement from your version. + */ + +package tool; + import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -38,243 +37,243 @@ import java.io.FileOutputStream; import java.util.Iterator; import mir.util.ExceptionFunctions; -import mir.util.PropertiesManipulator; - -public class BundleTool { - - public static void compare(String aMaster, String aSlave) { - PropertiesManipulator master; - PropertiesManipulator slave; - PropertiesManipulator result; - - try { - master = PropertiesManipulator.readProperties(new FileInputStream(new File(aMaster))); - } - catch (Throwable t) { - System.out.println("Unable to read master properties: " + t.getMessage()); - return; - } - - try { - slave = PropertiesManipulator.readProperties(new FileInputStream(new File(aSlave))); - } - catch (FileNotFoundException t) { - slave = new PropertiesManipulator(); - } - catch (Throwable t) { - System.out.println("Unable to read slave properties: " + t.getMessage()); - return; - } - - int missing=0; - - Iterator i = master.getEntries(); - while (i.hasNext()) { - Object e = i.next(); - - if (e instanceof PropertiesManipulator.Entry) { - String key = ( (PropertiesManipulator.Entry) e).getKey(); - - if (!slave.containsKey(key) || slave.get(key) == null || slave.get(key).length()==0 ) { - if (missing==0) { - System.out.println(aSlave+" is missing:"); - } - System.out.println(" " + key); - missing++; - } - } - } - - if (missing>0) - System.out.println("total missing: " +missing); - - missing=0; - i = slave.getEntries(); - while (i.hasNext()) { - Object e = i.next(); - - if (e instanceof PropertiesManipulator.Entry) { - String key = ( (PropertiesManipulator.Entry) e).getKey(); - - if (!master.containsKey(key)) { - if (missing==0) { - System.out.println(aSlave+" has extra:"); - } - System.out.println(" " + key); - missing++; - } - } - } - if (missing>0) - System.out.println("total extra: " +missing); - } - - public static void align(String aMaster, String aSlave) { - PropertiesManipulator master; - PropertiesManipulator slave; - PropertiesManipulator result; - - try { - master = PropertiesManipulator.readProperties(new FileInputStream(new File(aMaster))); - } - catch (Throwable t) { - System.out.println("Unable to read master properties: " + t.getMessage()); - return; - } - - try { - slave = PropertiesManipulator.readProperties(new FileInputStream(new File(aSlave))); - } - catch (FileNotFoundException t) { - slave = new PropertiesManipulator(); - } - catch (Throwable t) { - System.out.println("Unable to read slave properties: " + t.getMessage()); - return; - } - - result = new PropertiesManipulator(); - - // skip past the header in the slave bundle - Iterator i = slave.getEntries(); - while (i.hasNext()) { - Object e = i.next(); - - if (e instanceof PropertiesManipulator.EmptyLine) { - result.addEmptyLine(); - } - else if (e instanceof PropertiesManipulator.Comment) { - result.addComment( ( (PropertiesManipulator.Comment) e).getComment()); - } - - if (! (e instanceof PropertiesManipulator.Comment)) - break; - } - - boolean insideHeader = true; - i = master.getEntries(); - while (i.hasNext()) { - Object e = i.next(); - - if (!insideHeader && (e instanceof PropertiesManipulator.EmptyLine)) { - result.addEmptyLine(); - } - else if (!insideHeader && e instanceof PropertiesManipulator.Comment) { - result.addComment( ( (PropertiesManipulator.Comment) e).getComment()); - } - else if (e instanceof PropertiesManipulator.Entry) { - String key = ( (PropertiesManipulator.Entry) e).getKey(); - String value = slave.get(key); - - if (value==null || value.length()==0) { - result.addComment("# missing (master value = \"" +master.get(key)+"\")"); - } - - result.addEntry(key, value); - } - - insideHeader = insideHeader && (e instanceof PropertiesManipulator.Comment); - } - - try { - PropertiesManipulator.writeProperties(result, new FileOutputStream(new File(aSlave))); - } - catch (Throwable t) { - System.out.println("Unable to write slave properties: " + t.getMessage()); - return; - } - } - - public static void encode(String aBundle, String anEncoding, String anOutputFile) { - PropertiesManipulator bundle; - - try { - bundle = PropertiesManipulator.readProperties(new FileInputStream(new File(aBundle))); - - PropertiesManipulator.writeProperties(bundle, new FileOutputStream(anOutputFile), anEncoding, false); - } - catch (Throwable t) { - System.out.println("Unable to read master properties: " + t.getMessage()); - return; - } - } - - public static void decode(String aBundle, String anEncoding, String aSourceFile) { - PropertiesManipulator bundle; - - try { - bundle = PropertiesManipulator.readProperties(new FileInputStream(new File(aSourceFile)), anEncoding); - } - catch (Throwable t) { - Throwable s = ExceptionFunctions.traceCauseException(t); - - System.out.println("Unable to read sourcefile: " + s.toString()); - return; - } - try { - PropertiesManipulator.writeProperties(bundle, new FileOutputStream(aBundle)); - } - catch (Throwable t) { - System.out.println("Unable to write bundle: " + t.toString()); - return; - } - } - - public static void main(String[] anArguments) { - String command = "help"; - - if (anArguments.length >= 1) { - command = anArguments[0]; - - if (command.equals("compare")) { - if (anArguments.length==3) { - compare(anArguments[1], anArguments[2]); - - return; - } - } - else if (command.equals("align")) { - if (anArguments.length==3) { - align(anArguments[1], anArguments[2]); - - return; - } - } - else if (command.equals("encode")) { - if (anArguments.length==4) { - encode(anArguments[1], anArguments[2], anArguments[3]); - - return; - } - } - else if (command.equals("decode")) { - if (anArguments.length==4) { - decode(anArguments[1], anArguments[2], anArguments[3]); - - return; - } - } - } - - - - System.out.println("Usage:"); - - System.out.println(" BundleTool align "); - System.out.println(""); - System.out.println(" Reorders keys/values in a slave bundle according to a master bundle."); - System.out.println(""); - System.out.println(" BundleTool compare "); - System.out.println(""); - System.out.println(" Compares availability of bundle keys."); - System.out.println(""); - System.out.println(" BundleTool encode "); - System.out.println(""); - System.out.println(" Encodes the keys/values with a custom encoding."); - System.out.println(""); - System.out.println(" BundleTool decode "); - System.out.println(""); - System.out.println(" Decodes the keys/values with a custom encoding."); - } - +import mir.util.PropertiesManipulator; + +public class BundleTool { + + public static void compare(String aMaster, String aSlave) { + PropertiesManipulator master; + PropertiesManipulator slave; + PropertiesManipulator result; + + try { + master = PropertiesManipulator.readProperties(new FileInputStream(new File(aMaster))); + } + catch (Throwable t) { + System.out.println("Unable to read master properties: " + t.getMessage()); + return; + } + + try { + slave = PropertiesManipulator.readProperties(new FileInputStream(new File(aSlave))); + } + catch (FileNotFoundException t) { + slave = new PropertiesManipulator(); + } + catch (Throwable t) { + System.out.println("Unable to read slave properties: " + t.getMessage()); + return; + } + + int missing=0; + + Iterator i = master.getEntries(); + while (i.hasNext()) { + Object e = i.next(); + + if (e instanceof PropertiesManipulator.Entry) { + String key = ( (PropertiesManipulator.Entry) e).getKey(); + + if (!slave.containsKey(key) || slave.get(key) == null || slave.get(key).length()==0 ) { + if (missing==0) { + System.out.println(aSlave+" is missing:"); + } + System.out.println(" " + key); + missing++; + } + } + } + + if (missing>0) + System.out.println("total missing: " +missing); + + missing=0; + i = slave.getEntries(); + while (i.hasNext()) { + Object e = i.next(); + + if (e instanceof PropertiesManipulator.Entry) { + String key = ( (PropertiesManipulator.Entry) e).getKey(); + + if (!master.containsKey(key)) { + if (missing==0) { + System.out.println(aSlave+" has extra:"); + } + System.out.println(" " + key); + missing++; + } + } + } + if (missing>0) + System.out.println("total extra: " +missing); + } + + public static void align(String aMaster, String aSlave) { + PropertiesManipulator master; + PropertiesManipulator slave; + PropertiesManipulator result; + + try { + master = PropertiesManipulator.readProperties(new FileInputStream(new File(aMaster))); + } + catch (Throwable t) { + System.out.println("Unable to read master properties: " + t.getMessage()); + return; + } + + try { + slave = PropertiesManipulator.readProperties(new FileInputStream(new File(aSlave))); + } + catch (FileNotFoundException t) { + slave = new PropertiesManipulator(); + } + catch (Throwable t) { + System.out.println("Unable to read slave properties: " + t.getMessage()); + return; + } + + result = new PropertiesManipulator(); + + // skip past the header in the slave bundle + Iterator i = slave.getEntries(); + while (i.hasNext()) { + Object e = i.next(); + + if (e instanceof PropertiesManipulator.EmptyLine) { + result.addEmptyLine(); + } + else if (e instanceof PropertiesManipulator.Comment) { + result.addComment( ( (PropertiesManipulator.Comment) e).getComment()); + } + + if (! (e instanceof PropertiesManipulator.Comment)) + break; + } + + boolean insideHeader = true; + i = master.getEntries(); + while (i.hasNext()) { + Object e = i.next(); + + if (!insideHeader && (e instanceof PropertiesManipulator.EmptyLine)) { + result.addEmptyLine(); + } + else if (!insideHeader && e instanceof PropertiesManipulator.Comment) { + result.addComment( ( (PropertiesManipulator.Comment) e).getComment()); + } + else if (e instanceof PropertiesManipulator.Entry) { + String key = ( (PropertiesManipulator.Entry) e).getKey(); + String value = slave.get(key); + + if (value==null || value.length()==0) { + result.addComment("# missing (master value = \"" +master.get(key)+"\")"); + } + + result.addEntry(key, value); + } + + insideHeader = insideHeader && (e instanceof PropertiesManipulator.Comment); + } + + try { + PropertiesManipulator.writeProperties(result, new FileOutputStream(new File(aSlave))); + } + catch (Throwable t) { + System.out.println("Unable to write slave properties: " + t.getMessage()); + return; + } + } + + public static void encode(String aBundle, String anEncoding, String anOutputFile) { + PropertiesManipulator bundle; + + try { + bundle = PropertiesManipulator.readProperties(new FileInputStream(new File(aBundle))); + + PropertiesManipulator.writeProperties(bundle, new FileOutputStream(anOutputFile), anEncoding, false); + } + catch (Throwable t) { + System.out.println("Unable to read master properties: " + t.getMessage()); + return; + } + } + + public static void decode(String aBundle, String anEncoding, String aSourceFile) { + PropertiesManipulator bundle; + + try { + bundle = PropertiesManipulator.readProperties(new FileInputStream(new File(aSourceFile)), anEncoding); + } + catch (Throwable t) { + Throwable s = ExceptionFunctions.traceCauseException(t); + + System.out.println("Unable to read sourcefile: " + s.toString()); + return; + } + try { + PropertiesManipulator.writeProperties(bundle, new FileOutputStream(aBundle)); + } + catch (Throwable t) { + System.out.println("Unable to write bundle: " + t.toString()); + return; + } + } + + public static void main(String[] anArguments) { + String command = "help"; + + if (anArguments.length >= 1) { + command = anArguments[0]; + + if (command.equals("compare")) { + if (anArguments.length==3) { + compare(anArguments[1], anArguments[2]); + + return; + } + } + else if (command.equals("align")) { + if (anArguments.length==3) { + align(anArguments[1], anArguments[2]); + + return; + } + } + else if (command.equals("encode")) { + if (anArguments.length==4) { + encode(anArguments[1], anArguments[2], anArguments[3]); + + return; + } + } + else if (command.equals("decode")) { + if (anArguments.length==4) { + decode(anArguments[1], anArguments[2], anArguments[3]); + + return; + } + } + } + + + + System.out.println("Usage:"); + + System.out.println(" BundleTool align "); + System.out.println(""); + System.out.println(" Reorders keys/values in a slave bundle according to a master bundle."); + System.out.println(""); + System.out.println(" BundleTool compare "); + System.out.println(""); + System.out.println(" Compares availability of bundle keys."); + System.out.println(""); + System.out.println(" BundleTool encode "); + System.out.println(""); + System.out.println(" Encodes the keys/values with a custom encoding."); + System.out.println(""); + System.out.println(" BundleTool decode "); + System.out.println(""); + System.out.println(" Decodes the keys/values with a custom encoding."); + } + } \ No newline at end of file -- 2.11.0