some code cleanup. removed unnecessary semikolons, unused vars, etc.
authorrhindes <rhindes>
Thu, 10 Feb 2005 16:22:20 +0000 (16:22 +0000)
committerrhindes <rhindes>
Thu, 10 Feb 2005 16:22:20 +0000 (16:22 +0000)
200 files changed:
source/Mir.java
source/mir/bundle/CascadingBundleFactory.java
source/mir/bundle/PropertiesBundle.java
source/mir/bundle/PropertiesFileBundleLoader.java
source/mir/config/MirPropertiesConfiguration.java
source/mir/entity/AbstractEntity.java
source/mir/entity/Entity.java
source/mir/entity/EntityBrowser.java
source/mir/entity/EntityList.java
source/mir/entity/StorableObjectEntity.java
source/mir/entity/adapter/EntityAdapter.java
source/mir/entity/adapter/EntityAdapterDefinition.java
source/mir/entity/adapter/EntityAdapterModel.java
source/mir/entity/adapter/EntityIteratorAdapter.java
source/mir/generator/CompositeGeneratorLibrary.java
source/mir/generator/FreemarkerGenerator.java
source/mir/generator/GeneratorHelper.java
source/mir/generator/TALGenerator.java
source/mir/generator/VelocityGenerator.java
source/mir/generator/tal/SimpleTemplateNodeLibraryRegistry.java
source/mir/generator/tal/TALTemplateEngine.java
source/mir/generator/tal/TALTemplateParser.java
source/mir/generator/tal/TALTest.java
source/mir/generator/tal/template/CoreTemplateNodeLibrary.java
source/mir/generator/tal/template/MacroTemplateNodeLibrary.java
source/mir/generator/tal/template/TemplateNodeLibrary.java
source/mir/log/LoggerToWriterAdapter.java
source/mir/log/LoggerWrapper.java
source/mir/log/log4j/LoggerImpl.java
source/mir/misc/FileUtil.java
source/mir/misc/StringUtil.java
source/mir/module/AbstractModule.java
source/mir/producer/AssignmentProducerNode.java
source/mir/producer/BundleProducerNode.java
source/mir/producer/EntityBatchingProducerNode.java
source/mir/producer/EntityDeletingProducerNode.java
source/mir/producer/EntityEnumeratingProducerNode.java
source/mir/producer/EvaluatedAssignmentProducerNode.java
source/mir/producer/ExecuteProgramProducerNode.java
source/mir/producer/ExpandedAssignmentProducerNode.java
source/mir/producer/ExternalDbProducerNode.java
source/mir/producer/FreeQueryProducerNode.java
source/mir/producer/ListEnumeratingProducerNode.java
source/mir/producer/LoopProducerNode.java
source/mir/producer/NodedProducer.java
source/mir/producer/ProducerFactory.java
source/mir/producer/ProducerFailure.java
source/mir/producer/RDFAggregatorProducerNode.java
source/mir/producer/RSSProducerNode.java
source/mir/producer/ValuesMapProducerNode.java
source/mir/producer/reader/DefaultProducerNodeBuilders.java
source/mir/producer/reader/ProducerConfigReader.java
source/mir/producer/reader/ProducerNodeBuilderLibrary.java
source/mir/producer/reader/ScriptedProducerFactory.java
source/mir/rss/RSS091Reader.java
source/mir/rss/RSSData.java
source/mir/rss/RSSReader.java
source/mir/servlet/ServletModule.java
source/mir/session/CommonsUploadedFileAdapter.java
source/mir/session/HTTPAdapters.java
source/mir/session/ValidationHelper.java
source/mir/storage/Database.java
source/mir/storage/StorageObjectFailure.java
source/mir/storage/store/ObjectStore.java
source/mir/storage/store/StoreContainer.java
source/mir/storage/store/test/EntityC1.java
source/mir/util/CachingRewindableIterator.java
source/mir/util/DateTimeFunctions.java
source/mir/util/FileFunctions.java
source/mir/util/GeneratorDateTimeFunctions.java
source/mir/util/GeneratorFormatAdapters.java
source/mir/util/HTTPParsedRequest.java
source/mir/util/HTTPRequestParser.java
source/mir/util/InternetFunctions.java
source/mir/util/ParameterExpander.java
source/mir/util/PropertiesManipulator.java
source/mir/util/ReflectionRoutines.java
source/mir/util/StreamCopier.java
source/mir/util/StringParseRoutines.java
source/mir/util/StringRoutines.java
source/mir/util/StructuredContentParser.java
source/mir/util/SubsetIterator.java
source/mir/util/generator/BundleGeneratorFunction.java
source/mir/util/xml/AbstractSectionHandler.java
source/mir/util/xml/XMLName.java
source/mir/util/xml/XMLParserEngine.java
source/mir/util/xml/XMLParserFailure.java
source/mir/util/xml/XMLReaderTool.java
source/mir/util/xml/XMLSAXParserProvider.java
source/mir/util/xml/html/HTMLParser.java
source/mir/util/xml/html/HTMLScanner.java
source/mir/util/xml/html/HTMLSchemaInformation.java
source/mir/util/xml/html/XMLHTMLParserProvider.java
source/mircoders/abuse/FilterEngine.java
source/mircoders/abuse/IPFilterType.java
source/mircoders/abuse/RegularExpressionFilterType.java
source/mircoders/abuse/ThrottleFilter.java
source/mircoders/accesscontrol/AccessControl.java
source/mircoders/entity/EntityComment.java
source/mircoders/entity/EntityContent.java
source/mircoders/entity/EntityImages.java
source/mircoders/entity/EntityUploadedMedia.java
source/mircoders/entity/EntityVideo.java
source/mircoders/global/Abuse.java
source/mircoders/global/CacheKey.java
source/mircoders/global/DatabaseEngine.java
source/mircoders/global/JobQueue.java
source/mircoders/global/MirGlobal.java
source/mircoders/global/ProducerEngine.java
source/mircoders/localizer/MirAdminInterfaceLocalizer.java
source/mircoders/localizer/MirCachingLocalizerDecorator.java
source/mircoders/localizer/basic/MirBasicAdminInterfaceLocalizer.java
source/mircoders/localizer/basic/MirBasicArticlePostingHandler.java
source/mircoders/localizer/basic/MirBasicChildArticlePostingHandler.java
source/mircoders/localizer/basic/MirBasicCommentPostingHandler.java
source/mircoders/localizer/basic/MirBasicDataModelLocalizer.java
source/mircoders/localizer/basic/MirBasicEmailArticleHandler.java
source/mircoders/localizer/basic/MirBasicGeneratorLocalizer.java
source/mircoders/localizer/basic/MirBasicLocalizer.java
source/mircoders/localizer/basic/MirBasicMediaLocalizer.java
source/mircoders/localizer/basic/MirBasicOpenPostingLocalizer.java
source/mircoders/localizer/basic/MirBasicPostingSessionHandler.java
source/mircoders/localizer/basic/MirBasicProducerAssistantLocalizer.java
source/mircoders/localizer/basic/MirBasicProducerLocalizer.java
source/mircoders/localizer/basic/MirBasicTranslationPostingHandler.java
source/mircoders/localizer/basic/MirBasicUtilityFunctions.java
source/mircoders/localizer/basic/MirBasicWriterEngine.java
source/mircoders/localizer/basic/actions/ArticleTopicAction.java
source/mircoders/media/AbstractMediaHandler.java
source/mircoders/media/MediaHandlerGeneric.java
source/mircoders/media/MediaHandlerMp3.java
source/mircoders/media/MediaHandlerOgg.java
source/mircoders/media/MediaHandlerRealAudio.java
source/mircoders/media/MediaHandlerRealVideo.java
source/mircoders/media/MediaHelper.java
source/mircoders/media/MediaUploadProcessor.java
source/mircoders/media/URLMediaHandler.java
source/mircoders/module/ModuleComment.java
source/mircoders/module/ModuleLanguage.java
source/mircoders/module/ModuleMediaType.java
source/mircoders/module/ModuleUsers.java
source/mircoders/pdf/PDFGenerator.java
source/mircoders/producer/IndexingProducerNode.java
source/mircoders/producer/MediaGeneratingProducerNode.java
source/mircoders/producer/PDFPreFormattingProducerNode.java
source/mircoders/producer/RadicalendarProducerNode.java
source/mircoders/producer/UnIndexingProducerNode.java
source/mircoders/producer/reader/SupplementalProducerNodeBuilders.java
source/mircoders/search/AudioSearchTerm.java
source/mircoders/search/ContentSearchTerm.java
source/mircoders/search/ImagesSearchTerm.java
source/mircoders/search/IndexUtil.java
source/mircoders/search/KeywordSearchTerm.java
source/mircoders/search/MediaSearchTerm.java
source/mircoders/search/SearchTerm.java
source/mircoders/search/TextSearchTerm.java
source/mircoders/search/TopicMatrixSearchTerm.java
source/mircoders/search/TopicSearchTerm.java
source/mircoders/search/UnStoredSearchTerm.java
source/mircoders/search/VideoSearchTerm.java
source/mircoders/servlet/ServletHelper.java
source/mircoders/servlet/ServletModuleAbuse.java
source/mircoders/servlet/ServletModuleAdmin.java
source/mircoders/servlet/ServletModuleComment.java
source/mircoders/servlet/ServletModuleContent.java
source/mircoders/servlet/ServletModuleFileEdit.java
source/mircoders/servlet/ServletModuleHidden.java
source/mircoders/servlet/ServletModuleLocalizer.java
source/mircoders/servlet/ServletModuleMediaType.java
source/mircoders/servlet/ServletModuleOpenIndy.java
source/mircoders/servlet/ServletModuleProducer.java
source/mircoders/servlet/ServletModuleUsers.java
source/mircoders/storage/DatabaseArticleType.java
source/mircoders/storage/DatabaseAudio.java
source/mircoders/storage/DatabaseBreaking.java
source/mircoders/storage/DatabaseComment.java
source/mircoders/storage/DatabaseCommentStatus.java
source/mircoders/storage/DatabaseCommentToMedia.java
source/mircoders/storage/DatabaseContent.java
source/mircoders/storage/DatabaseContentToMedia.java
source/mircoders/storage/DatabaseContentToTopics.java
source/mircoders/storage/DatabaseFilter.java
source/mircoders/storage/DatabaseFilterGroup.java
source/mircoders/storage/DatabaseImageColor.java
source/mircoders/storage/DatabaseImageFormat.java
source/mircoders/storage/DatabaseImageLayout.java
source/mircoders/storage/DatabaseImageType.java
source/mircoders/storage/DatabaseImages.java
source/mircoders/storage/DatabaseLanguage.java
source/mircoders/storage/DatabaseMediaType.java
source/mircoders/storage/DatabaseMediafolder.java
source/mircoders/storage/DatabaseMessages.java
source/mircoders/storage/DatabaseOther.java
source/mircoders/storage/DatabaseRights.java
source/mircoders/storage/DatabaseTopics.java
source/mircoders/storage/DatabaseUploadedMedia.java
source/mircoders/storage/DatabaseUsers.java
source/mircoders/storage/DatabaseVideo.java
source/tool/BundleTool.java
source/tool/ImageTool.java

index 515d1ee..8d29112 100755 (executable)
  * 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.io.StringWriter;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+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.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.UnavailableException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+import javax.servlet.http.HttpSessionBindingEvent;
+import javax.servlet.http.HttpSessionBindingListener;
+
 import mir.bundle.Bundle;
 import mir.config.MirPropertiesConfiguration;
-import mir.servlet.*;
+import mir.log.LoggerWrapper;
+import mir.servlet.AbstractServlet;
+import mir.servlet.ServletModule;
+import mir.servlet.ServletModuleDispatch;
+import mir.servlet.ServletModuleExc;
+import mir.servlet.ServletModuleUserExc;
 import mir.util.ExceptionFunctions;
 import mir.util.StringRoutines;
-import mir.log.LoggerWrapper;
 import mircoders.entity.EntityUsers;
 import mircoders.global.MirGlobal;
 import mircoders.module.ModuleUsers;
 import mircoders.servlet.ServletHelper;
-
-import javax.servlet.ServletConfig;
-import javax.servlet.ServletException;
-import javax.servlet.UnavailableException;
-import javax.servlet.http.*;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.PrintStream;
-import java.io.StringWriter;
-import java.lang.reflect.Method;
-import java.util.*;
-
 import multex.Failure;
 
 /**
@@ -279,9 +294,7 @@ public class Mir extends AbstractServlet {
         throw new ServletModuleExc("*** error resolving classname for " + moduleName + " -- " + e.getMessage());
       }
     }
-    else {
-      return (ServletModule) servletModuleInstanceHash.get(moduleName);
-    }
+               return (ServletModule) servletModuleInstanceHash.get(moduleName);
   }
 
   private void handleUserError(HttpServletRequest aRequest, HttpServletResponse aResponse, ServletModuleUserExc anException) {
index b3a9920..b50ae08 100755 (executable)
@@ -34,7 +34,7 @@ import java.util.Arrays;
 import java.util.List;
 
 public class CascadingBundleFactory implements BundleFactory {
-  private BundleFactory masterFactory;
+  BundleFactory masterFactory;
 
   /** {@inheritDoc} */
   public CascadingBundleFactory(BundleFactory aMasterFactory) {
index a795285..0409df8 100755 (executable)
@@ -29,9 +29,9 @@
  */
 package mir.bundle;
 
-import java.util.Properties;
-import java.util.List;
 import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
 
 import mir.util.StringParseRoutines;
 
@@ -78,7 +78,6 @@ public class PropertiesBundle implements Bundle {
 
     if (result==null || result.trim().length()==0)
       return null;
-    else
-      return formatValue(result, anArguments);
+               return formatValue(result, anArguments);
   }
 }
index 5e88976..3980124 100755 (executable)
@@ -30,8 +30,8 @@
 package mir.bundle;
 
 import java.io.File;
-import java.io.IOException;
 import java.io.FileInputStream;
+import java.io.IOException;
 import java.util.Properties;
 
 /**
index 80ece21..198ff3a 100755 (executable)
@@ -34,10 +34,12 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
+
 import javax.servlet.ServletContext;
 
 import multex.Exc;
 import multex.Failure;
+
 import org.apache.commons.collections.ExtendedProperties;
 
 /**
@@ -149,9 +151,7 @@ public class MirPropertiesConfiguration extends ExtendedProperties {
     if (result.isAbsolute()) {
       return result;
     }
-    else {
-      return new File(home, path);
-    }
+               return new File(home, path);
   }
 
   /**
index 72e98ec..ee35074 100755 (executable)
@@ -36,15 +36,15 @@ import java.util.Map;
 
 import mir.config.MirPropertiesConfiguration;
 import mir.log.LoggerWrapper;
+import mir.storage.Database;
 import mir.storage.StorageObjectExc;
 import mir.storage.StorageObjectFailure;
-import mir.storage.Database;
 
 /**
  * Base class the entities are derived from. Provides base functionality of
  * an entity.
  *
- * @version $Id: AbstractEntity.java,v 1.8.2.5 2005/01/23 15:36:02 zapata Exp $
+ * @version $Id: AbstractEntity.java,v 1.8.2.6 2005/02/10 16:22:30 rhindes Exp $
  */
 
 public class AbstractEntity implements Entity {
@@ -95,8 +95,7 @@ public class AbstractEntity implements Entity {
     if (database != null) {
       return database.insert(this);
     }
-    else
-      throw new StorageObjectExc("database == null!");
+               throw new StorageObjectExc("database == null!");
   }
 
   /** {@inheritDoc} */
index cac1e44..df2cb9a 100755 (executable)
  */
 package  mir.entity;
 
-import mir.storage.StorageObjectExc;
-import mir.storage.StorageObjectFailure;
-
 import java.util.List;
 import java.util.Map;
 
+import mir.storage.StorageObjectExc;
+import mir.storage.StorageObjectFailure;
+
 /**
  * An <code>Entity</code> represents a persistent data object, typically
  *   stored in a database.<p>
  *
- * @version $Id: Entity.java,v 1.21.2.10 2005/01/23 15:36:02 zapata Exp $
+ * @version $Id: Entity.java,v 1.21.2.11 2005/02/10 16:22:30 rhindes Exp $
  */
 
 public interface Entity {
index c51d9c9..7d42057 100755 (executable)
 
 package mir.entity;
 
+import java.util.List;
+
 import mir.storage.Database;
 import mir.storage.StorageObjectFailure;
 import mir.util.RewindableIterator;
-
-import java.util.List;
-
 import multex.Failure;
 
 public class EntityBrowser implements RewindableIterator {
@@ -121,9 +120,7 @@ public class EntityBrowser implements RewindableIterator {
 
         return result;
       }
-      else {
-        return null;
-      }
+                       return null;
     }
     catch (Throwable t) {
       throw new RuntimeException(t.getMessage());
index 7e3cc85..700d85d 100755 (executable)
@@ -29,6 +29,9 @@
  */
 package mir.entity;
 
+import java.util.ArrayList;
+import java.util.Set;
+
 import mir.config.MirPropertiesConfiguration;
 import mir.log.LoggerWrapper;
 import mir.storage.Database;
@@ -37,9 +40,6 @@ import mir.storage.store.StoreContainerType;
 import mir.storage.store.StoreIdentifier;
 import mir.storage.store.StoreUtil;
 
-import java.util.ArrayList;
-import java.util.Set;
-
 /**
  *
  * Container class for lists of Entities.
@@ -205,11 +205,9 @@ public class EntityList implements StorableObject {
                 StoreUtil.getEntityListUniqueIdentifierFor( storage.getTableName(),
                 whereClause, orderClause, offset, limit ));
     }
-    else {
-      logger.warn("EntityList could not return StoreIdentifier");
-      
-      return null;
-    }
+               logger.warn("EntityList could not return StoreIdentifier");
+               
+               return null;
   }
 
 }
index 8749bc2..3f2d627 100755 (executable)
@@ -68,9 +68,8 @@ public class StorableObjectEntity extends AbstractEntity
      Class theEntityClass, String theTable, String id) {
      if (id == null) {
         return null;
-     } else {
-        return new StoreIdentifier(theEntityClass, id + "@" + theTable);
      }
+               return new StoreIdentifier(theEntityClass, id + "@" + theTable);
   }
 
   public static final StoreIdentifier getStoreIdentifier(Database theStorage,
index ee997e2..0006328 100755 (executable)
@@ -175,8 +175,7 @@ public class EntityAdapter implements Map {
 
       if (i.hasNext())
         return (EntityAdapter) i.next();
-      else
-        return null;
+                       return null;
     }
     catch (Throwable t) {
       throw new RuntimeException(t.getMessage());
@@ -191,8 +190,7 @@ public class EntityAdapter implements Map {
 
       if (i.hasNext())
         return (EntityAdapter) i.next();
-      else
-        return null;
+                       return null;
     }
     catch (Throwable t) {
       throw new RuntimeException(t.getMessage());
index 571df52..9c95ab3 100755 (executable)
@@ -75,7 +75,7 @@ public class EntityAdapterDefinition {
   /**
    *
    * @param aFieldName
-   * @return
+   * @return boolean true if aFieldName is a calculated Field
    */
   public boolean hasCalculatedField(String aFieldName) {
     return calculatedFields.containsKey(aFieldName);
index 0c0a094..b840bc6 100755 (executable)
  */
 package mir.entity.adapter;
 
-import mir.entity.Entity;
-import mir.storage.Database;
-
 import java.util.HashMap;
 import java.util.Map;
 
+import mir.entity.Entity;
+import mir.storage.Database;
+
 public class EntityAdapterModel {
   private Map entityAdapterMappings;
 
index fbc6a01..967809b 100755 (executable)
@@ -81,5 +81,5 @@ public class EntityIteratorAdapter implements RewindableIterator {
 
   public void rewind() {
     iterator.rewind();
-  };
+  }
 }
index 324363f..1f4ce63 100755 (executable)
@@ -66,11 +66,8 @@ public class CompositeGeneratorLibrary implements Generator.Library {
 
       return library.makeGenerator(qualifier);
     }
-    else {
-      if (defaultLibrary!=null)
-        return defaultLibrary.makeGenerator(anIdentifier);
-      else
-        throw new GeneratorExc("CompositeGeneratorLibrary: no default library speficied");
-    }
-  };
+               if (defaultLibrary!=null)
+                 return defaultLibrary.makeGenerator(anIdentifier);
+               throw new GeneratorExc("CompositeGeneratorLibrary: no default library speficied");
+  }
 }
\ No newline at end of file
index b774a1d..576442a 100755 (executable)
@@ -29,8 +29,8 @@
  */
 package mir.generator;
 
-import java.io.PrintWriter;
 import java.io.File;
+import java.io.PrintWriter;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
@@ -38,6 +38,13 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import mir.log.LoggerWrapper;
+import mir.util.GeneratorFormatAdapters;
+import mir.util.RewindableIterator;
+
+import org.apache.commons.beanutils.MethodUtils;
+import org.apache.commons.beanutils.PropertyUtils;
+
 import freemarker.template.FileTemplateCache;
 import freemarker.template.SimpleScalar;
 import freemarker.template.Template;
@@ -48,11 +55,6 @@ import freemarker.template.TemplateModel;
 import freemarker.template.TemplateModelException;
 import freemarker.template.TemplateModelRoot;
 import freemarker.template.TemplateScalarModel;
-import mir.log.LoggerWrapper;
-import mir.util.GeneratorFormatAdapters;
-import mir.util.RewindableIterator;
-import org.apache.commons.beanutils.MethodUtils;
-import org.apache.commons.beanutils.PropertyUtils;
 
 
 public class FreemarkerGenerator implements Generator {
@@ -198,7 +200,7 @@ public class FreemarkerGenerator implements Generator {
       {
         valuesCache.add(makeAdapter(iterator.next()));
       }
-    };
+    }
 
     public TemplateModel get(int anIndex) throws TemplateModelException {
       TemplateModel result;
@@ -211,8 +213,7 @@ public class FreemarkerGenerator implements Generator {
 
         return result;
       }
-      else
-        throw new TemplateModelException( "Iterator out of bounds" );
+                       throw new TemplateModelException( "Iterator out of bounds" );
     }
 
     public boolean hasNext() {
@@ -266,8 +267,8 @@ public class FreemarkerGenerator implements Generator {
 
       if (i<valuesCache.size())
         return (TemplateModel) valuesCache.get(i);
-      else
-        throw new TemplateModelException( "Iterator out of bounds" );
+      
+                       throw new TemplateModelException( "Iterator out of bounds" );
     }
 
     public boolean hasNext() {
@@ -342,8 +343,7 @@ public class FreemarkerGenerator implements Generator {
       try {
         if (PropertyUtils.isReadable(object, aKey))
           return makeAdapter(PropertyUtils.getSimpleProperty(object, aKey));
-        else
-          return makeAdapter(MethodUtils.invokeExactMethod(object, "get", aKey));
+                               return makeAdapter(MethodUtils.invokeExactMethod(object, "get", aKey));
       }
       catch (Throwable t) {
         throw new TemplateModelException(t.getMessage());
@@ -381,6 +381,6 @@ public class FreemarkerGenerator implements Generator {
     public Library makeLibrary(String anInitializationString) {
       // todo: the initialization string should be parsed
       return new FreemarkerGeneratorLibrary(new File(basePath, anInitializationString));
-    };
+    }
   }
 }
index 298723d..0e55112 100755 (executable)
 
 package mir.generator;
 
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Locale;
 import java.util.Map;
-import java.util.ArrayList;
-import java.util.List;
 
+import mir.bundle.Bundle;
 import mir.entity.adapter.EntityIteratorAdapter;
 import mir.util.CachingRewindableIterator;
-import mir.bundle.Bundle;
 import mir.util.generator.BundleGeneratorFunction;
 import mircoders.global.MirGlobal;
 
index 210267a..5b60fbc 100755 (executable)
  */
 package mir.generator;
 
-import java.io.PrintWriter;
 import java.io.File;
+import java.io.PrintWriter;
 import java.util.Map;
 
 import mir.generator.tal.MirExpressionParser;
-import mir.generator.tal.template.Template;
 import mir.generator.tal.TALTemplateEngine;
 import mir.generator.tal.interfaces.TALLogger;
+import mir.generator.tal.template.Template;
 import mir.log.LoggerWrapper;
 
 public class TALGenerator implements Generator {
@@ -110,6 +110,6 @@ public class TALGenerator implements Generator {
 
     public Library makeLibrary(String anInitializationString) throws GeneratorExc, GeneratorFailure {
       return new TALGeneratorLibrary(new File(basePath, anInitializationString));
-    };
+    }
   }
 }
index 31a671b..030cae4 100755 (executable)
  */
 package mir.generator;
 
+import java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
 import mir.log.LoggerWrapper;
 import mir.util.GeneratorFormatAdapters;
 import mir.util.RewindableIterator;
+
 import org.apache.commons.beanutils.MethodUtils;
 import org.apache.commons.beanutils.PropertyUtils;
 import org.apache.velocity.Template;
@@ -42,11 +54,6 @@ import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.runtime.RuntimeServices;
 import org.apache.velocity.runtime.log.LogSystem;
 
-import java.io.File;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.*;
-
 public class VelocityGenerator implements Generator {
   private String templateIdentifier;
   private VelocityGeneratorLibrary library;
@@ -164,8 +171,7 @@ public class VelocityGenerator implements Generator {
     if (anObject instanceof VelocityAdapter) {
       return ((VelocityAdapter) anObject).getOriginal();
     }
-    else
-      return anObject;
+               return anObject;
   }
 
   /**
@@ -343,7 +349,7 @@ public class VelocityGenerator implements Generator {
       {
         valuesCache.add(makeAdapter(iterator.next()));
       }
-    };
+    }
 
     public Object getOriginal() {
       return iterator;
@@ -360,8 +366,7 @@ public class VelocityGenerator implements Generator {
 
         return result;
       }
-      else
-        throw new RuntimeException( "Iterator out of bounds" );
+                       throw new RuntimeException( "Iterator out of bounds" );
     }
 
     public int size() {
@@ -395,7 +400,7 @@ public class VelocityGenerator implements Generator {
       {
         valuesCache.add(makeAdapter(list.get(valuesCache.size())));
       }
-    };
+    }
 
     public Object getOriginal() {
       return list;
@@ -412,8 +417,7 @@ public class VelocityGenerator implements Generator {
 
         return result;
       }
-      else
-        throw new RuntimeException( "Iterator out of bounds" );
+                       throw new RuntimeException( "Iterator out of bounds" );
     }
 
     public int size() {
@@ -491,8 +495,7 @@ public class VelocityGenerator implements Generator {
    * @version 1.0
    */
   private static class VelocityLoggerWrapper implements LogSystem {
-    private LoggerWrapper logger;
-
+   
     public VelocityLoggerWrapper(LoggerWrapper aLogger) {
       logger = aLogger;
     }
@@ -555,7 +558,7 @@ public class VelocityGenerator implements Generator {
         engine.init();
       }
       catch (Throwable t) {
-        t.printStackTrace(logger.asPrintWriter(logger.ERROR_MESSAGE));
+        t.printStackTrace(logger.asPrintWriter(LoggerWrapper.ERROR_MESSAGE));
 
         logger.error("Failed to set up a VelocityGeneratorLibrary: " + t.toString());
         throw new GeneratorFailure(t);
@@ -585,6 +588,6 @@ public class VelocityGenerator implements Generator {
 
     public Library makeLibrary(String anInitializationString) throws GeneratorExc, GeneratorFailure {
       return new VelocityGeneratorLibrary(new File(basePath, anInitializationString));
-    };
+    }
   }
 }
index 561f50a..b25a8db 100755 (executable)
  */
 package mir.generator.tal;
 
-import java.util.Map;
 import java.util.HashMap;
+import java.util.Map;
 
-import mir.generator.tal.template.TemplateNodeLibraryRegistry;
 import mir.generator.tal.template.TemplateNodeLibrary;
+import mir.generator.tal.template.TemplateNodeLibraryRegistry;
 
 public class SimpleTemplateNodeLibraryRegistry implements TemplateNodeLibraryRegistry {
   private Map urlToLibrary;
index aa3fb76..b3c31c6 100755 (executable)
@@ -33,11 +33,17 @@ package mir.generator.tal;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.Map;
 import java.util.List;
+import java.util.Map;
 
 import mir.generator.tal.interfaces.TALExpressionParser;
-import mir.generator.tal.template.*;
+import mir.generator.tal.template.CoreTemplateNodeLibrary;
+import mir.generator.tal.template.MacroTemplateNodeLibrary;
+import mir.generator.tal.template.Template;
+import mir.generator.tal.template.TemplateLibrary;
+import mir.generator.tal.template.TemplateNode;
+import mir.generator.tal.template.TemplateNodeLibrary;
+import mir.generator.tal.template.TemplateProcessingException;
 import mir.util.StringRoutines;
 
 public class TALTemplateEngine implements TemplateLibrary {
@@ -83,13 +89,7 @@ public class TALTemplateEngine implements TemplateLibrary {
 
       return new Template(expressionParser, (TemplateNode) definitions.get(parts.get(1)), baseTemplate.getContext());
     }
-    else {
-      return baseTemplate;
-    }
-
-
-
-//      public Template(TALExpressionParser aParser, TemplateNode aRootNode, Map aTemplateContext) {
+               return baseTemplate;
   }
 
   public Template lookupTemplate(String aName) throws TemplateProcessingException {
index ff1596f..2e73d0d 100755 (executable)
@@ -37,16 +37,16 @@ import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
 import java.io.StringReader;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.HashMap;
 
 import mir.generator.tal.interfaces.TALExpressionParser;
 import mir.generator.tal.template.CompositeTemplateNode;
 import mir.generator.tal.template.PlainTextTemplateNode;
 import mir.generator.tal.template.Template;
-import mir.generator.tal.template.TemplateNodeLibrary;
 import mir.generator.tal.template.TemplateNode;
+import mir.generator.tal.template.TemplateNodeLibrary;
 import mir.generator.tal.template.TemplateNodeLibraryRegistry;
 import mir.util.HTMLRoutines;
 import mir.util.xml.SectionHandler;
@@ -167,7 +167,7 @@ public class TALTemplateParser {
       }
 
       return new TALHandler(parser, templateContext);
-    };
+    }
 
     public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
       if (library == null) {
@@ -188,7 +188,7 @@ public class TALTemplateParser {
         tag = null;
         attributes = null;
       }
-    };
+    }
 
     protected void appendSubNode(TemplateNode aNode) {
       flushData();
index 1eb475d..c1b48ea 100755 (executable)
 
 package mir.generator.tal;
 
-import java.io.PrintWriter;
 import java.io.File;
+import java.io.PrintWriter;
 import java.util.HashMap;
 import java.util.Map;
 
 import mir.generator.tal.interfaces.TALLogger;
+import mir.generator.tal.template.CoreTemplateNodeLibrary;
+import mir.generator.tal.template.MacroTemplateNodeLibrary;
 import mir.generator.tal.template.Template;
 import mir.generator.tal.template.TemplateLibrary;
 import mir.generator.tal.template.TemplateProcessingException;
-import mir.generator.tal.template.CoreTemplateNodeLibrary;
-import mir.generator.tal.template.MacroTemplateNodeLibrary;
 
 public class TALTest {
   public static void main(String args[]) {
index e806deb..c440561 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with  any library licensed under the Apache Software License,\r
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library\r
- * (or with modified versions of the above that use the same license as the above),\r
- * and distribute linked combinations including the two.  You must obey the\r
- * GNU General Public License in all respects for all of the code used other than\r
- * the above mentioned libraries.  If you modify this file, you may extend this\r
- * exception to your version of the file, but you are not obligated to do so.\r
- * If you do not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mir.generator.tal.template;\r
-\r
-import java.util.*;\r
-\r
-import mir.generator.tal.interfaces.TALExpressionParser;\r
-import mir.generator.tal.interfaces.TALLogger;\r
-import mir.util.HTMLRoutines;\r
-import mir.util.StringRoutines;\r
-import mir.util.xml.XMLName;\r
-import mir.util.xml.XMLParserExc;\r
-import mir.util.xml.XMLReaderTool;\r
-\r
-public class CoreTemplateNodeLibrary implements TemplateNodeLibrary {\r
-  private String prefix;\r
-  private String uri;\r
-\r
-  private boolean isOurTag(XMLName aName) {\r
-    return prefix.equals(aName.getPrefix()) || uri.equals(aName.getNamespaceURI());\r
-  }\r
-\r
-  public CoreTemplateNodeLibrary(String aPrefix, String aUri) {\r
-    prefix = aPrefix;\r
-    uri = aUri;\r
-  }\r
-\r
-  private static final String CONDITION_ATTRIBUTE = "condition";\r
-  private static final String REPEAT_ATTRIBUTE = "repeat";\r
-  private static final String CONTENT_ATTRIBUTE = "content";\r
-  private static final String ERROR_ATTRIBUTE = "on-error";\r
-  private static final String REPLACE_ATTRIBUTE = "replace";\r
-  private static final String DEFINITION_ATTRIBUTE = "define";\r
-  private static final String OMITTAG_ATTRIBUTE = "omit-tag";\r
-  private static final String ATTRIBUTE_ATTRIBUTE = "attributes";\r
-\r
-  public TemplateNode constructTemplateNode(TALExpressionParser aParser, XMLName aTag, Map anAttributes,\r
-      TemplateNode aChildTemplateNode, Map aTemplateContext) throws XMLParserExc {\r
-    TALBasicTemplateNode result = new TALBasicTemplateNode(XMLReaderTool.normalizeXMLName(aTag));\r
-    result.setBody(aChildTemplateNode);\r
-\r
-    if (isOurTag(aTag))\r
-      result.setOmitTag(aParser.preparseTRUE());\r
-\r
-    Iterator i = anAttributes.entrySet().iterator();\r
-    while (i.hasNext()) {\r
-      Map.Entry entry = (Map.Entry) i.next();\r
-      XMLName name = (XMLName) entry.getKey();\r
-\r
-      if (!isOurTag(name)) {\r
-        result.addFixedAttribute(XMLReaderTool.normalizeXMLName(name), (String) entry.getValue());\r
-      }\r
-      else {\r
-        if (name.getLocalName().equalsIgnoreCase(DEFINITION_ATTRIBUTE)) {\r
-          List definitions = StringRoutines.splitStringWithEscape((String) entry.getValue(), ';', '\\');\r
-\r
-          Iterator j = definitions.iterator();\r
-          while (j.hasNext())\r
-          {\r
-            List parts = StringRoutines.separateString((String) j.next(), " ");\r
-\r
-            if (parts.size()==2) {\r
-              result.addDefinition(aParser.preparseReferenceExpression((String) parts.get(0)), aParser.preparseExpression((String) parts.get(1)));\r
-            }\r
-          }\r
-        }\r
-        else if (name.getLocalName().equalsIgnoreCase(CONDITION_ATTRIBUTE)) {\r
-          result.setCondition(aParser.preparseBooleanExpression((String) entry.getValue()));\r
-        }\r
-        else if (name.getLocalName().equalsIgnoreCase(CONTENT_ATTRIBUTE)) {\r
-          result.setContent(aParser.preparseStringExpression((String) entry.getValue()));\r
-        }\r
-        else if (name.getLocalName().equalsIgnoreCase(ERROR_ATTRIBUTE)) {\r
-          result.setError(aParser.preparseStringExpression((String) entry.getValue()));\r
-        }\r
-        else if (name.getLocalName().equalsIgnoreCase(OMITTAG_ATTRIBUTE)) {\r
-          if (((String) entry.getValue()).trim().length()==0)\r
-            result.setOmitTag(aParser.preparseTRUE());\r
-          else\r
-            result.setOmitTag(aParser.preparseBooleanExpression((String) entry.getValue()));\r
-        }\r
-        else if (name.getLocalName().equalsIgnoreCase(REPLACE_ATTRIBUTE)) {\r
-          result.setOmitTag(aParser.preparseTRUE());\r
-          result.setContent(aParser.preparseStringExpression((String) entry.getValue()));\r
-        }\r
-        else if (name.getLocalName().equalsIgnoreCase(REPEAT_ATTRIBUTE)) {\r
-          List parts = StringRoutines.separateString((String) entry.getValue(), " ");\r
-\r
-          if (parts.size()==2) {\r
-            result.setRepeat(aParser.preparseReferenceExpression((String) parts.get(0)), aParser.preparseExpression((String) parts.get(1)));\r
-          }\r
-        }\r
-        else if (name.getLocalName().equalsIgnoreCase(ATTRIBUTE_ATTRIBUTE)) {\r
-          List attributes = StringRoutines.splitStringWithEscape((String) entry.getValue(), ';', '\\');\r
-\r
-          Iterator j = attributes.iterator();\r
-          while (j.hasNext()) {\r
-            String value = (String) j.next();\r
-            List parts = StringRoutines.separateString(value.trim(), " ");\r
-\r
-            if (parts.size()==2) {\r
-              result.addModifiedAttribute((String) parts.get(0), aParser.preparseExpression((String) parts.get(1)));\r
-            }\r
-            else {\r
-              throw new XMLParserExc(ATTRIBUTE_ATTRIBUTE + " tag should have exactly 2 parts ("+value+")");\r
-            }\r
-          }\r
-        }\r
-      }\r
-    }\r
-\r
-    return result;\r
-  }\r
-\r
-  public static class TALBasicTemplateNode implements TemplateNode {\r
-    private String tag;\r
-    private Map fixedAttributes;\r
-    private Map attributeModifiers;\r
-\r
-    private List definitions;\r
-    private Object condition;\r
-\r
-    private Object repeatVariable;\r
-    private Object repeatExpression;\r
-    private Object contentExpression;\r
-    private Object omitTagExpression;\r
-    private Object errorExpression;\r
-\r
-    private TemplateNode body;\r
-\r
-    public TALBasicTemplateNode(String aTag) {\r
-      tag = aTag;\r
-\r
-      fixedAttributes = new HashMap();\r
-      attributeModifiers = new HashMap();\r
-\r
-      definitions = new ArrayList();\r
-      condition = null;\r
-\r
-      repeatVariable = null;\r
-      repeatExpression = null;\r
-      contentExpression = null;\r
-      omitTagExpression = null;\r
-\r
-      body = null;\r
-    }\r
-\r
-    public void setBody(TemplateNode aBody) {\r
-      body = aBody;\r
-    }\r
-\r
-    public void addFixedAttribute(String aKey, String aValue) {\r
-      fixedAttributes.put(aKey, aValue);\r
-    }\r
-\r
-    public void addModifiedAttribute(String aKey, Object aValue) {\r
-      attributeModifiers.put(aKey, aValue);\r
-    }\r
-\r
-    public void addDefinition(Object aKey, Object aValue) {\r
-      definitions.add(new Definition(aKey, aValue));\r
-    }\r
-\r
-    public void setCondition(Object aCondition) {\r
-      condition = aCondition;\r
-    }\r
-\r
-    public void setRepeat(Object aRepeatVariable, Object aRepeatExpression) {\r
-      repeatVariable = aRepeatVariable;\r
-      repeatExpression = aRepeatExpression;\r
-    }\r
-\r
-    public void setContent(Object aContentExpression) {\r
-      contentExpression = aContentExpression;\r
-    }\r
-\r
-    public void setOmitTag(Object anOmitTagExpression) {\r
-      omitTagExpression = anOmitTagExpression;\r
-    }\r
-\r
-    public void setError(Object anErrorExpression) {\r
-      errorExpression = anErrorExpression;\r
-    }\r
-\r
-    public static class Definition {\r
-      private Object variable;\r
-      private Object expression;\r
-\r
-      public Definition(Object aVariable, Object anExpression) {\r
-        variable = aVariable;\r
-        expression = anExpression;\r
-      }\r
-\r
-      public Object getVariable() {\r
-        return variable;\r
-      }\r
-\r
-      public Object getExpression() {\r
-        return expression;\r
-      }\r
-    }\r
-\r
-    public void process(TALExpressionParser aParser, Object aContext,\r
-        StringBuffer aDestination, TALLogger aLogger, Map aTemplateContext,\r
-        TemplateLibrary aLibrary) throws TemplateProcessingException {\r
-      if (errorExpression != null) {\r
-        StringBuffer destination = new StringBuffer();\r
-\r
-        try {\r
-          outerProcess(aParser, aContext, destination, aLogger, aTemplateContext, aLibrary);\r
-        }\r
-        catch (Throwable t) {\r
-          try {\r
-//            destination.delete(0, destination.length());\r
-            aParser.processPseudoAssignment(aContext, "exception", t);\r
-            destination.insert(0, aParser.evaluateStringExpression(aContext, errorExpression));\r
-            destination.append(" >>>ERROR POSITION<<< ");\r
-          }\r
-          catch (Throwable s) {\r
-            throw new TemplateProcessingException(s);\r
-          }\r
-        }\r
-        finally {\r
-          aDestination.append(destination);\r
-        }\r
-      }\r
-      else {\r
-        outerProcess(aParser, aContext, aDestination, aLogger, aTemplateContext, aLibrary);\r
-      }\r
-    }\r
-\r
-    public String getPlainText() {\r
-      return body.getPlainText();\r
-    }\r
-\r
-    public void outerProcess(TALExpressionParser aParser, Object aContext,\r
-        StringBuffer aDestination, TALLogger aLogger, Map aTemplateContext,\r
-        TemplateLibrary aLibrary) throws TemplateProcessingException {\r
-\r
-      Object oldAttributes = aParser.evaluatePseudoVariable(aContext, "tagattributes");\r
-      aParser.processPseudoAssignment(aContext, "tagattributes", Collections.unmodifiableMap(fixedAttributes));\r
-\r
-      Object oldContent = aParser.evaluatePseudoVariable(aContext, "tagcontent");\r
-      aParser.processPseudoAssignment(aContext, "tagcontent", body.getPlainText());\r
-\r
-      try {\r
-        Iterator i;\r
-\r
-        i = definitions.iterator();\r
-        while (i.hasNext()) {\r
-          Definition d = (Definition) i.next();\r
-          aParser.processAssignment(aContext, d.getVariable(), d.getExpression());\r
-        }\r
-\r
-        if (condition == null || aParser.evaluateBooleanExpression(aContext, condition)) {\r
-          if (repeatExpression != null) {\r
-            i = aParser.evaluateListExpression(aContext, repeatExpression);\r
-\r
-            while (i.hasNext()) {\r
-              aParser.processDirectAssignment(aContext, repeatVariable, i.next());\r
-              innerProcess(aParser, aContext, aDestination, aLogger, aTemplateContext, aLibrary);\r
-            }\r
-          }\r
-          else {\r
-            innerProcess(aParser, aContext, aDestination, aLogger, aTemplateContext, aLibrary);\r
-          }\r
-        }\r
-      }\r
-      finally {\r
-        try {\r
-          aParser.processPseudoAssignment(aContext, "tagattributes", oldAttributes);\r
-          aParser.processPseudoAssignment(aContext, "tagcontent", oldContent);\r
-        }\r
-        catch (Throwable t) {\r
-        }\r
-      }\r
-    };\r
-\r
-    private void innerProcess(TALExpressionParser aParser, Object aContext,\r
-        StringBuffer aDestination, TALLogger aLogger, Map aTemplateContext, TemplateLibrary aLibrary)\r
-        throws TemplateProcessingException {\r
-\r
-      boolean omitTag = false;\r
-      StringBuffer content = aDestination;\r
-\r
-      if (omitTagExpression != null)\r
-        omitTag = aParser.evaluateBooleanExpression(aContext, omitTagExpression);\r
-\r
-      if (!omitTag) {\r
-        content = new StringBuffer();\r
-        Map generatedAttributes = new HashMap(fixedAttributes);\r
-\r
-        Iterator i = attributeModifiers.entrySet().iterator();\r
-        while (i.hasNext()) {\r
-          Map.Entry entry = (Map.Entry) i.next();\r
-\r
-          generatedAttributes.put(entry.getKey(), aParser.evaluateStringExpression(aContext, entry.getValue()));\r
-        }\r
-\r
-        aDestination.append("<");\r
-        aDestination.append(tag);\r
-\r
-        i = generatedAttributes.entrySet().iterator();\r
-        while (i.hasNext()) {\r
-          Map.Entry entry = (Map.Entry) i.next();\r
-          aDestination.append(" ");\r
-          aDestination.append(entry.getKey());\r
-          aDestination.append("=");\r
-          aDestination.append("\"");\r
-          aDestination.append(HTMLRoutines.encodeHTML( (String) entry.getValue()));\r
-          aDestination.append("\"");\r
-        }\r
-      }\r
-\r
-      try{\r
-        if (contentExpression != null) {\r
-          content.append(aParser.evaluateStringExpression(aContext, contentExpression));\r
-        }\r
-        else {\r
-          if (body != null) {\r
-            body.process(aParser, aContext, content, aLogger, aTemplateContext, aLibrary);\r
-          }\r
-        }\r
-        if (!omitTag) {\r
-          if (content.length()==0) {\r
-            aDestination.append(" />");\r
-          }\r
-          else {\r
-            aDestination.append(">");\r
-            aDestination.append(content);\r
-            aDestination.append("</");\r
-            aDestination.append(tag);\r
-            aDestination.append(">");\r
-          }\r
-        }\r
-      }\r
-      catch (Throwable t) {\r
-        if (!omitTag) {\r
-          aDestination.append(content);\r
-        }\r
-\r
-        if (t instanceof TemplateProcessingException) {\r
-          throw (TemplateProcessingException) t;\r
-        }\r
-        else if (t instanceof RuntimeException) {\r
-          throw (RuntimeException) t;\r
-        }\r
-        else throw new TemplateProcessingException(t.toString());\r
-      }\r
-    }\r
-  }\r
-}\r
+/*
+ * 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.generator.tal.template;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import mir.generator.tal.interfaces.TALExpressionParser;
+import mir.generator.tal.interfaces.TALLogger;
+import mir.util.HTMLRoutines;
+import mir.util.StringRoutines;
+import mir.util.xml.XMLName;
+import mir.util.xml.XMLParserExc;
+import mir.util.xml.XMLReaderTool;
+
+public class CoreTemplateNodeLibrary implements TemplateNodeLibrary {
+  private String prefix;
+  private String uri;
+
+  private boolean isOurTag(XMLName aName) {
+    return prefix.equals(aName.getPrefix()) || uri.equals(aName.getNamespaceURI());
+  }
+
+  public CoreTemplateNodeLibrary(String aPrefix, String aUri) {
+    prefix = aPrefix;
+    uri = aUri;
+  }
+
+  private static final String CONDITION_ATTRIBUTE = "condition";
+  private static final String REPEAT_ATTRIBUTE = "repeat";
+  private static final String CONTENT_ATTRIBUTE = "content";
+  private static final String ERROR_ATTRIBUTE = "on-error";
+  private static final String REPLACE_ATTRIBUTE = "replace";
+  private static final String DEFINITION_ATTRIBUTE = "define";
+  private static final String OMITTAG_ATTRIBUTE = "omit-tag";
+  private static final String ATTRIBUTE_ATTRIBUTE = "attributes";
+
+  public TemplateNode constructTemplateNode(TALExpressionParser aParser, XMLName aTag, Map anAttributes,
+      TemplateNode aChildTemplateNode, Map aTemplateContext) throws XMLParserExc {
+    TALBasicTemplateNode result = new TALBasicTemplateNode(XMLReaderTool.normalizeXMLName(aTag));
+    result.setBody(aChildTemplateNode);
+
+    if (isOurTag(aTag))
+      result.setOmitTag(aParser.preparseTRUE());
+
+    Iterator i = anAttributes.entrySet().iterator();
+    while (i.hasNext()) {
+      Map.Entry entry = (Map.Entry) i.next();
+      XMLName name = (XMLName) entry.getKey();
+
+      if (!isOurTag(name)) {
+        result.addFixedAttribute(XMLReaderTool.normalizeXMLName(name), (String) entry.getValue());
+      }
+      else {
+        if (name.getLocalName().equalsIgnoreCase(DEFINITION_ATTRIBUTE)) {
+          List definitions = StringRoutines.splitStringWithEscape((String) entry.getValue(), ';', '\\');
+
+          Iterator j = definitions.iterator();
+          while (j.hasNext())
+          {
+            List parts = StringRoutines.separateString((String) j.next(), " ");
+
+            if (parts.size()==2) {
+              result.addDefinition(aParser.preparseReferenceExpression((String) parts.get(0)), aParser.preparseExpression((String) parts.get(1)));
+            }
+          }
+        }
+        else if (name.getLocalName().equalsIgnoreCase(CONDITION_ATTRIBUTE)) {
+          result.setCondition(aParser.preparseBooleanExpression((String) entry.getValue()));
+        }
+        else if (name.getLocalName().equalsIgnoreCase(CONTENT_ATTRIBUTE)) {
+          result.setContent(aParser.preparseStringExpression((String) entry.getValue()));
+        }
+        else if (name.getLocalName().equalsIgnoreCase(ERROR_ATTRIBUTE)) {
+          result.setError(aParser.preparseStringExpression((String) entry.getValue()));
+        }
+        else if (name.getLocalName().equalsIgnoreCase(OMITTAG_ATTRIBUTE)) {
+          if (((String) entry.getValue()).trim().length()==0)
+            result.setOmitTag(aParser.preparseTRUE());
+          else
+            result.setOmitTag(aParser.preparseBooleanExpression((String) entry.getValue()));
+        }
+        else if (name.getLocalName().equalsIgnoreCase(REPLACE_ATTRIBUTE)) {
+          result.setOmitTag(aParser.preparseTRUE());
+          result.setContent(aParser.preparseStringExpression((String) entry.getValue()));
+        }
+        else if (name.getLocalName().equalsIgnoreCase(REPEAT_ATTRIBUTE)) {
+          List parts = StringRoutines.separateString((String) entry.getValue(), " ");
+
+          if (parts.size()==2) {
+            result.setRepeat(aParser.preparseReferenceExpression((String) parts.get(0)), aParser.preparseExpression((String) parts.get(1)));
+          }
+        }
+        else if (name.getLocalName().equalsIgnoreCase(ATTRIBUTE_ATTRIBUTE)) {
+          List attributes = StringRoutines.splitStringWithEscape((String) entry.getValue(), ';', '\\');
+
+          Iterator j = attributes.iterator();
+          while (j.hasNext()) {
+            String value = (String) j.next();
+            List parts = StringRoutines.separateString(value.trim(), " ");
+
+            if (parts.size()==2) {
+              result.addModifiedAttribute((String) parts.get(0), aParser.preparseExpression((String) parts.get(1)));
+            }
+            else {
+              throw new XMLParserExc(ATTRIBUTE_ATTRIBUTE + " tag should have exactly 2 parts ("+value+")");
+            }
+          }
+        }
+      }
+    }
+
+    return result;
+  }
+
+  public static class TALBasicTemplateNode implements TemplateNode {
+    private String tag;
+    private Map fixedAttributes;
+    private Map attributeModifiers;
+
+    private List definitions;
+    private Object condition;
+
+    private Object repeatVariable;
+    private Object repeatExpression;
+    private Object contentExpression;
+    private Object omitTagExpression;
+    private Object errorExpression;
+
+    private TemplateNode body;
+
+    public TALBasicTemplateNode(String aTag) {
+      tag = aTag;
+
+      fixedAttributes = new HashMap();
+      attributeModifiers = new HashMap();
+
+      definitions = new ArrayList();
+      condition = null;
+
+      repeatVariable = null;
+      repeatExpression = null;
+      contentExpression = null;
+      omitTagExpression = null;
+
+      body = null;
+    }
+
+    public void setBody(TemplateNode aBody) {
+      body = aBody;
+    }
+
+    public void addFixedAttribute(String aKey, String aValue) {
+      fixedAttributes.put(aKey, aValue);
+    }
+
+    public void addModifiedAttribute(String aKey, Object aValue) {
+      attributeModifiers.put(aKey, aValue);
+    }
+
+    public void addDefinition(Object aKey, Object aValue) {
+      definitions.add(new Definition(aKey, aValue));
+    }
+
+    public void setCondition(Object aCondition) {
+      condition = aCondition;
+    }
+
+    public void setRepeat(Object aRepeatVariable, Object aRepeatExpression) {
+      repeatVariable = aRepeatVariable;
+      repeatExpression = aRepeatExpression;
+    }
+
+    public void setContent(Object aContentExpression) {
+      contentExpression = aContentExpression;
+    }
+
+    public void setOmitTag(Object anOmitTagExpression) {
+      omitTagExpression = anOmitTagExpression;
+    }
+
+    public void setError(Object anErrorExpression) {
+      errorExpression = anErrorExpression;
+    }
+
+    public static class Definition {
+      private Object variable;
+      private Object expression;
+
+      public Definition(Object aVariable, Object anExpression) {
+        variable = aVariable;
+        expression = anExpression;
+      }
+
+      public Object getVariable() {
+        return variable;
+      }
+
+      public Object getExpression() {
+        return expression;
+      }
+    }
+
+    public void process(TALExpressionParser aParser, Object aContext,
+        StringBuffer aDestination, TALLogger aLogger, Map aTemplateContext,
+        TemplateLibrary aLibrary) throws TemplateProcessingException {
+      if (errorExpression != null) {
+        StringBuffer destination = new StringBuffer();
+
+        try {
+          outerProcess(aParser, aContext, destination, aLogger, aTemplateContext, aLibrary);
+        }
+        catch (Throwable t) {
+          try {
+//            destination.delete(0, destination.length());
+            aParser.processPseudoAssignment(aContext, "exception", t);
+            destination.insert(0, aParser.evaluateStringExpression(aContext, errorExpression));
+            destination.append(" >>>ERROR POSITION<<< ");
+          }
+          catch (Throwable s) {
+            throw new TemplateProcessingException(s);
+          }
+        }
+        finally {
+          aDestination.append(destination);
+        }
+      }
+      else {
+        outerProcess(aParser, aContext, aDestination, aLogger, aTemplateContext, aLibrary);
+      }
+    }
+
+    public String getPlainText() {
+      return body.getPlainText();
+    }
+
+    public void outerProcess(TALExpressionParser aParser, Object aContext,
+        StringBuffer aDestination, TALLogger aLogger, Map aTemplateContext,
+        TemplateLibrary aLibrary) throws TemplateProcessingException {
+
+      Object oldAttributes = aParser.evaluatePseudoVariable(aContext, "tagattributes");
+      aParser.processPseudoAssignment(aContext, "tagattributes", Collections.unmodifiableMap(fixedAttributes));
+
+      Object oldContent = aParser.evaluatePseudoVariable(aContext, "tagcontent");
+      aParser.processPseudoAssignment(aContext, "tagcontent", body.getPlainText());
+
+      try {
+        Iterator i;
+
+        i = definitions.iterator();
+        while (i.hasNext()) {
+          Definition d = (Definition) i.next();
+          aParser.processAssignment(aContext, d.getVariable(), d.getExpression());
+        }
+
+        if (condition == null || aParser.evaluateBooleanExpression(aContext, condition)) {
+          if (repeatExpression != null) {
+            i = aParser.evaluateListExpression(aContext, repeatExpression);
+
+            while (i.hasNext()) {
+              aParser.processDirectAssignment(aContext, repeatVariable, i.next());
+              innerProcess(aParser, aContext, aDestination, aLogger, aTemplateContext, aLibrary);
+            }
+          }
+          else {
+            innerProcess(aParser, aContext, aDestination, aLogger, aTemplateContext, aLibrary);
+          }
+        }
+      }
+      finally {
+        try {
+          aParser.processPseudoAssignment(aContext, "tagattributes", oldAttributes);
+          aParser.processPseudoAssignment(aContext, "tagcontent", oldContent);
+        }
+        catch (Throwable t) {
+        }
+      }
+    }
+
+    private void innerProcess(TALExpressionParser aParser, Object aContext,
+        StringBuffer aDestination, TALLogger aLogger, Map aTemplateContext, TemplateLibrary aLibrary)
+        throws TemplateProcessingException {
+
+      boolean omitTag = false;
+      StringBuffer content = aDestination;
+
+      if (omitTagExpression != null)
+        omitTag = aParser.evaluateBooleanExpression(aContext, omitTagExpression);
+
+      if (!omitTag) {
+        content = new StringBuffer();
+        Map generatedAttributes = new HashMap(fixedAttributes);
+
+        Iterator i = attributeModifiers.entrySet().iterator();
+        while (i.hasNext()) {
+          Map.Entry entry = (Map.Entry) i.next();
+
+          generatedAttributes.put(entry.getKey(), aParser.evaluateStringExpression(aContext, entry.getValue()));
+        }
+
+        aDestination.append("<");
+        aDestination.append(tag);
+
+        i = generatedAttributes.entrySet().iterator();
+        while (i.hasNext()) {
+          Map.Entry entry = (Map.Entry) i.next();
+          aDestination.append(" ");
+          aDestination.append(entry.getKey());
+          aDestination.append("=");
+          aDestination.append("\"");
+          aDestination.append(HTMLRoutines.encodeHTML( (String) entry.getValue()));
+          aDestination.append("\"");
+        }
+      }
+
+      try{
+        if (contentExpression != null) {
+          content.append(aParser.evaluateStringExpression(aContext, contentExpression));
+        }
+        else {
+          if (body != null) {
+            body.process(aParser, aContext, content, aLogger, aTemplateContext, aLibrary);
+          }
+        }
+        if (!omitTag) {
+          if (content.length()==0) {
+            aDestination.append(" />");
+          }
+          else {
+            aDestination.append(">");
+            aDestination.append(content);
+            aDestination.append("</");
+            aDestination.append(tag);
+            aDestination.append(">");
+          }
+        }
+      }
+      catch (Throwable t) {
+        if (!omitTag) {
+          aDestination.append(content);
+        }
+
+        if (t instanceof TemplateProcessingException) {
+          throw (TemplateProcessingException) t;
+        }
+        else if (t instanceof RuntimeException) {
+          throw (RuntimeException) t;
+        }
+        else throw new TemplateProcessingException(t.toString());
+      }
+    }
+  }
+}
index 1310c7b..fce8d8e 100755 (executable)
  */
 package mir.generator.tal.template;
 
-import java.util.Map;
+import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
-import java.util.HashMap;
+import java.util.Map;
 
 import mir.generator.tal.interfaces.TALExpressionParser;
 import mir.generator.tal.interfaces.TALLogger;
+import mir.util.HTMLRoutines;
+import mir.util.StringRoutines;
 import mir.util.xml.XMLName;
 import mir.util.xml.XMLParserExc;
 import mir.util.xml.XMLReaderTool;
-import mir.util.StringRoutines;
-import mir.util.HTMLRoutines;
 
 public class MacroTemplateNodeLibrary implements TemplateNodeLibrary {
   /** {@inheritDoc} */
index bdb8545..de57d15 100755 (executable)
@@ -1,49 +1,49 @@
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with  any library licensed under the Apache Software License,\r
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library\r
- * (or with modified versions of the above that use the same license as the above),\r
- * and distribute linked combinations including the two.  You must obey the\r
- * GNU General Public License in all respects for all of the code used other than\r
- * the above mentioned libraries.  If you modify this file, you may extend this\r
- * exception to your version of the file, but you are not obligated to do so.\r
- * If you do not wish to do so, delete this exception statement from your version.\r
- */\r
-package mir.generator.tal.template;\r
-\r
-import java.util.Map;\r
-\r
-import mir.util.xml.XMLName;\r
-import mir.util.xml.XMLParserExc;\r
-import mir.generator.tal.interfaces.TALExpressionParser;\r
-\r
-public interface TemplateNodeLibrary {\r
-  /**\r
-   * Construct a {@link TemplateNode} based on the tag and attributes given.\r
-   *\r
-   * @param anExpressionParser\r
-   * @param aTag\r
-   * @param anAttributes\r
-   * @param aChildTemplateNode\r
-   */\r
-  public TemplateNode constructTemplateNode(TALExpressionParser anExpressionParser,\r
-      XMLName aTag, Map anAttributes, TemplateNode aChildTemplateNode, Map aTemplateContext) throws XMLParserExc;\r
-}\r
+/*
+ * 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.generator.tal.template;
+
+import java.util.Map;
+
+import mir.generator.tal.interfaces.TALExpressionParser;
+import mir.util.xml.XMLName;
+import mir.util.xml.XMLParserExc;
+
+public interface TemplateNodeLibrary {
+  /**
+   * Construct a {@link TemplateNode} based on the tag and attributes given.
+   *
+   * @param anExpressionParser
+   * @param aTag
+   * @param anAttributes
+   * @param aChildTemplateNode
+   */
+  public TemplateNode constructTemplateNode(TALExpressionParser anExpressionParser,
+      XMLName aTag, Map anAttributes, TemplateNode aChildTemplateNode, Map aTemplateContext) throws XMLParserExc;
+}
index 018547d..f7eab50 100755 (executable)
@@ -73,7 +73,7 @@ public class LoggerToWriterAdapter extends Writer {
     }
 
     lineBuffer.delete(0, from);
-  };
+  }
 
   public void write(char[] aBuffer, int anOffset, int aLength)  {
     lineBuffer.append(aBuffer, anOffset, aLength);
index 749d9d2..436ed96 100755 (executable)
@@ -46,31 +46,31 @@ public class LoggerWrapper {
 
   public void debug( String aMessage ) {
     LoggerEngine.debug(object, aMessage);
-  };
+  }
 
   public void info( String aMessage ) {
     LoggerEngine.info(object, aMessage);
-  };
+  }
 
   public void warn( String aMessage ) {
     LoggerEngine.warn(object, aMessage);
-  };
+  }
 
   public void warn(String aMessage, Throwable anException) {
     LoggerEngine.warn(object, aMessage, anException);
-  };
+  }
 
   public void error( String aMessage ) {
     LoggerEngine.error(object, aMessage);
-  };
+  }
 
   public void error(String aMessage, Throwable anException) {
     LoggerEngine.error(object, aMessage, anException);
-  };
+  }
 
   public void fatal( String aMessage ) {
     LoggerEngine.fatal(object, aMessage);
-  };
+  }
 
   public void message( int aType, String aMessage) {
     switch(aType) {
index 9941499..582854d 100755 (executable)
@@ -35,6 +35,7 @@ import java.util.Map;
 import mir.config.MirPropertiesConfiguration;
 import mir.log.LoggerExc;
 import mir.log.LoggerFailure;
+
 import org.apache.log4j.Logger;
 import org.apache.log4j.PropertyConfigurator;
 
index 688d951..9226914 100755 (executable)
@@ -160,14 +160,7 @@ public final class FileUtil {
   public static long getSize(String filename) {
     File f = null;
     f = new File(filename);
-    long l = 0;
-
-    if (f.exists()) {
-      return f.length();
-    }
-    else {
-      return -1;
-    }
+    return f.exists() ? f.length():-1;
   }
 
 }
index f9c996a..b05c748 100755 (executable)
@@ -41,7 +41,7 @@ import java.util.TimeZone;
 /**
  * Statische Hilfsmethoden zur Stringbehandlung
  *
- * @version $Id: StringUtil.java,v 1.33.2.5 2003/10/23 14:55:28 rk Exp $
+ * @version $Id: StringUtil.java,v 1.33.2.6 2005/02/10 16:22:30 rhindes Exp $
  * @author mir-coders group
  *
  */
@@ -195,11 +195,11 @@ public final class StringUtil {
   }
 
   /**
-   * Ersetzt in String <code>s</code> das Regexp <code>pattern</code> durch <code>substitute</code>
-   * @param s
+   * Replaces in <code>haystack</code> matching <code>pattern</code> by <code>substitute</code>
+   * @param haystack
    * @param pattern
    * @param substitute
-   * @return String mit den Ersetzungen
+   * @return String with replacements.
    */
   public static String regexpReplace(String haystack, String pattern, String substitute) {
     try {
@@ -305,28 +305,27 @@ public final class StringUtil {
   /**
    * this routine takes text in url format and makes
    * a clickaeble "<href>" link removing any "illegal" html tags
-   * @param haystack, the url
-   * @param title, the href link text
-   * @param imagRoot, the place to find icons
-   * @param extImage, the url of the icon to show next to the link
+   * @param haystack  the url
+   * @param title  the href link text
+   * @param imageRoot  the place to find icons
+   * @param extImage  the url of the icon to show next to the link
    * @return a String containing the url
    */
   public static String createURLLinks(String haystack, String title, String imageRoot,String extImage) {
     if (title == null) {
       return re_url.substituteAll(haystack,"<img src=\""+imageRoot+"/"+extImage+"\" border=\"0\"/>&#160;<a href=\"$0\">$0</a>");
-    } else {
-      title = removeHTMLTags(title);
-      return re_url.substituteAll(haystack,"<img src=\""+imageRoot+"/"+extImage+"\" border=\"0\"/>&#160;<a href=\"$0\">"+title+"</a>");
     }
+               title = removeHTMLTags(title);
+               return re_url.substituteAll(haystack,"<img src=\""+imageRoot+"/"+extImage+"\" border=\"0\"/>&#160;<a href=\"$0\">"+title+"</a>");
   }
 
   /**
    * this routine takes text in url format and makes
    * a clickaeble "<href>" link removing any "illegal" html tags
-   * @param haystack, the url
-   * @param imageRoot, the place to find icons
-   * @param extImage, the url of the icon to show next to the link
-   * @param intImage, unused
+   * @param haystack the url
+   * @param imageRoot the place to find icons
+   * @param extImage the url of the icon to show next to the link
+   * @param intImage unused
    * @return a String containing the url
    */
   public static String createURLLinks(String haystack, String title, String imageRoot,String extImage,String intImage) {
index 490a50d..4b38727 100755 (executable)
@@ -29,8 +29,8 @@
  */
 package  mir.module;
 
-import java.util.Map;
 import java.sql.SQLException;
+import java.util.Map;
 
 import mir.entity.Entity;
 import mir.entity.EntityList;
@@ -71,8 +71,7 @@ public class AbstractModule {
 
       if (entity == null)
         throw new ModuleExc("AbstractModule.getById: No object for id = " + id);
-      else
-        return entity;
+                       return entity;
     }
     catch (Throwable e) {
       throw new ModuleFailure(e);
index 32dcc17..13c4793 100755 (executable)
@@ -36,7 +36,6 @@ import mir.util.ParameterExpander;
 
 public class AssignmentProducerNode extends ProducerNodeDecorator {
   private String key;
-  private String bundleIdentifier;
   private Object value;
 
   public AssignmentProducerNode(String aKey, Object aValue, ProducerNode aSubNode) {
@@ -55,5 +54,5 @@ public class AssignmentProducerNode extends ProducerNodeDecorator {
     catch (Throwable t) {
       throw new ProducerFailure(t.getMessage(), t);
     }
-  };
+  }
 }
\ No newline at end of file
index f7f8cdb..c86cdaf 100755 (executable)
@@ -78,6 +78,6 @@ public class BundleProducerNode implements ProducerNode {
       aLogger.error("Failed to load bundle " + bundleExpression + " for language " +
           languageExpression +  " into key " + key + ": " + t.getMessage());
     }
-  };
+  }
 
 }
\ No newline at end of file
index cbf1e9a..abdacc6 100755 (executable)
  */
 package mir.producer;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.ArrayList;
 
 import mir.entity.adapter.EntityAdapterModel;
 import mir.entity.adapter.EntityIteratorAdapter;
@@ -213,7 +213,7 @@ public class EntityBatchingProducerNode implements ProducerNode {
     catch (Throwable t) {
       aLogger.error("EntityBatchingProducerNode caused an exception: " + t.getMessage());
     }
-  };
+  }
 
   private class BatchLocation {
     int nrEntities;
index 630c70b..b82cfe9 100755 (executable)
@@ -56,6 +56,6 @@ public class EntityDeletingProducerNode implements ProducerNode {
     catch (Throwable t) {
       aLogger.error("Error while deleting entities: " + t.toString());
     }
-  };
+  }
 
 }
index ca4fef8..0ff765a 100755 (executable)
@@ -93,5 +93,5 @@ public class EntityEnumeratingProducerNode extends ProducerNodeDecorator {
     catch (Throwable t) {
       aLogger.error("Exception occurred inside an EntityEnumeratingProducerNode: " + t.getMessage());
     }
-  };
+  }
 }
\ No newline at end of file
index 8583b98..424c41d 100755 (executable)
@@ -37,7 +37,6 @@ import mir.util.ParameterExpander;
 
 public class EvaluatedAssignmentProducerNode implements ProducerNode {
   private String key;
-  private String bundleIdentifier;
   private String value;
 
   public EvaluatedAssignmentProducerNode(String aKey, String aValue) {
@@ -56,5 +55,5 @@ public class EvaluatedAssignmentProducerNode implements ProducerNode {
     catch (Throwable t) {
       aLogger.error("key " + key + " could not be set to " + value + ": " + t.getMessage());
     }
-  };
+  }
 }
\ No newline at end of file
index 0c57a15..0b7ee74 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with  any library licensed under the Apache Software License,\r
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library\r
- * (or with modified versions of the above that use the same license as the above),\r
- * and distribute linked combinations including the two.  You must obey the\r
- * GNU General Public License in all respects for all of the code used other than\r
- * the above mentioned libraries.  If you modify this file, you may extend this\r
- * exception to your version of the file, but you are not obligated to do so.\r
- * If you do not wish to do so, delete this exception statement from your version.\r
- */\r
-package mir.producer;\r
-\r
-import java.util.Map;\r
-\r
-import mir.log.LoggerWrapper;\r
-import mir.util.ParameterExpander;\r
-\r
-public class ExecuteProgramProducerNode implements ProducerNode  {\r
-  private String scriptExpression;\r
-  private String maxDurationExpression;\r
-  private String outputVariableExpression;\r
-  private String returnValueVariableExpression;\r
-\r
-  public ExecuteProgramProducerNode(String aScriptExpression, String aMaxDurationExpression, String anOutputVariableExpression,\r
-                                    String aReturnValueVariableExpression) {\r
-    scriptExpression = aScriptExpression;\r
-    maxDurationExpression = aMaxDurationExpression;\r
-    outputVariableExpression = anOutputVariableExpression;\r
-    returnValueVariableExpression = aReturnValueVariableExpression;\r
-  }\r
-\r
-  public void produce(Map aValueMap, String aVerb, LoggerWrapper aLogger) throws ProducerFailure {\r
-    String script;\r
-    long maxDuration;\r
-\r
-    try {\r
-      script = ParameterExpander.expandExpression(aValueMap, scriptExpression);\r
-      maxDuration = ParameterExpander.evaluateIntegerExpressionWithDefault(aValueMap, maxDurationExpression, 0);\r
-\r
-      ProcessRunner runner = new ProcessRunner(aLogger, script);\r
-      runner.start();\r
-\r
-      synchronized (runner) {\r
-        runner.wait(maxDuration);\r
-      }\r
-      runner.interrupt();\r
-\r
-      if (runner.getFinished()) {\r
-        aLogger.info(script + " terminated successfully, return value = " + runner.getReturnValue() + ".");\r
-\r
-        if (returnValueVariableExpression != null) {\r
-          ParameterExpander.setValueForKey(aValueMap,\r
-              ParameterExpander.expandExpression(aValueMap, returnValueVariableExpression),\r
-              new Integer(runner.getReturnValue()));\r
-        }\r
-\r
-      }\r
-      else {\r
-        aLogger.info(script + " interrupted prematurely after " + maxDuration + "ms.");\r
-      }\r
-    }\r
-    catch (Throwable e) {\r
-      aLogger.error("Error while executing " + scriptExpression + " : " + e.toString());\r
-    }\r
-  }\r
-\r
-  private static class ProcessRunner extends Thread {\r
-    private String script;\r
-    private boolean finished = false;\r
-    private int returnValue = 0;\r
-    private LoggerWrapper logger;\r
-\r
-    public ProcessRunner(LoggerWrapper aLogger, String aScript) {\r
-      script = aScript;\r
-      logger = aLogger;\r
-    }\r
-\r
-    public boolean getFinished() {\r
-      return finished;\r
-    }\r
-\r
-    public int getReturnValue() {\r
-      return returnValue;\r
-    }\r
-\r
-    public void run() {\r
-      Process process = null;\r
-      try {\r
-        process = Runtime.getRuntime().exec(script);\r
-        returnValue = process.waitFor();\r
-\r
-        finished = true;\r
-\r
-        synchronized (this) {\r
-          this.notify();\r
-        }\r
-      }\r
-      catch (InterruptedException e) {\r
-        if (process!=null) {\r
-          process.destroy();\r
-        }\r
-      }\r
-      catch (Exception e) {\r
-        logger.error(script + " failed to execute: " + e.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-}\r
+/*
+ * 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.producer;
+
+import java.util.Map;
+
+import mir.log.LoggerWrapper;
+import mir.util.ParameterExpander;
+
+public class ExecuteProgramProducerNode implements ProducerNode  {
+  private String scriptExpression;
+  private String maxDurationExpression;
+  private String outputVariableExpression;
+  private String returnValueVariableExpression;
+
+  public ExecuteProgramProducerNode(String aScriptExpression, String aMaxDurationExpression, String anOutputVariableExpression,
+                                    String aReturnValueVariableExpression) {
+    scriptExpression = aScriptExpression;
+    maxDurationExpression = aMaxDurationExpression;
+    outputVariableExpression = anOutputVariableExpression;
+    returnValueVariableExpression = aReturnValueVariableExpression;
+  }
+
+  public void produce(Map aValueMap, String aVerb, LoggerWrapper aLogger) throws ProducerFailure {
+    String script;
+    long maxDuration;
+
+    try {
+      script = ParameterExpander.expandExpression(aValueMap, scriptExpression);
+      maxDuration = ParameterExpander.evaluateIntegerExpressionWithDefault(aValueMap, maxDurationExpression, 0);
+
+      ProcessRunner runner = new ProcessRunner(aLogger, script);
+      runner.start();
+
+      synchronized (runner) {
+        runner.wait(maxDuration);
+      }
+      runner.interrupt();
+
+      if (runner.getFinished()) {
+        aLogger.info(script + " terminated successfully, return value = " + runner.getReturnValue() + ".");
+
+        if (returnValueVariableExpression != null) {
+          ParameterExpander.setValueForKey(aValueMap,
+              ParameterExpander.expandExpression(aValueMap, returnValueVariableExpression),
+              new Integer(runner.getReturnValue()));
+        }
+
+      }
+      else {
+        aLogger.info(script + " interrupted prematurely after " + maxDuration + "ms.");
+      }
+    }
+    catch (Throwable e) {
+      aLogger.error("Error while executing " + scriptExpression + " : " + e.toString());
+    }
+  }
+
+  private static class ProcessRunner extends Thread {
+    private String script;
+    private boolean finished = false;
+    private int returnValue = 0;
+    private LoggerWrapper logger;
+
+    public ProcessRunner(LoggerWrapper aLogger, String aScript) {
+      script = aScript;
+      logger = aLogger;
+    }
+
+    public boolean getFinished() {
+      return finished;
+    }
+
+    public int getReturnValue() {
+      return returnValue;
+    }
+
+    public void run() {
+      Process process = null;
+      try {
+        process = Runtime.getRuntime().exec(script);
+        returnValue = process.waitFor();
+
+        finished = true;
+
+        synchronized (this) {
+          this.notify();
+        }
+      }
+      catch (InterruptedException e) {
+        if (process!=null) {
+          process.destroy();
+        }
+      }
+      catch (Exception e) {
+        logger.error(script + " failed to execute: " + e.getMessage());
+      }
+    }
+  }
+
+}
index 7d497a8..0fb8481 100755 (executable)
@@ -36,7 +36,6 @@ import mir.util.ParameterExpander;
 
 public class ExpandedAssignmentProducerNode implements ProducerNode {
   private String key;
-  private String bundleIdentifier;
   private String value;
 
   public ExpandedAssignmentProducerNode(String aKey, String aValue) {
@@ -55,5 +54,5 @@ public class ExpandedAssignmentProducerNode implements ProducerNode {
     catch (Throwable t) {
       aLogger.error("key " + key + " could not be set to " + value + ": " + t.getMessage());
     }
-  };
+  }
 }
\ No newline at end of file
index cfc1e51..5c621d8 100755 (executable)
  */
 package mir.producer;
 
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.Statement;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import java.sql.*;
-
 
 import mir.log.LoggerWrapper;
 import mir.util.ExceptionFunctions;
@@ -116,5 +119,5 @@ public class ExternalDbProducerNode extends ProducerNodeDecorator {
       Throwable s = ExceptionFunctions.traceCauseException(t);
       aLogger.error("Error while accessing external database: " + s.getClass().getName()+","+ s.getMessage());
     }
-  };
+  }
 }
index 94e6f42..08b70eb 100755 (executable)
@@ -95,6 +95,6 @@ public class FreeQueryProducerNode implements ProducerNode {
     catch (Throwable t) {
       aLogger.error("Error while setting key " + key + ": " + t.toString());
     }
-  };
+  }
 
 }
\ No newline at end of file
index e9a68fc..0a59416 100755 (executable)
@@ -75,5 +75,5 @@ public class ListEnumeratingProducerNode extends ProducerNodeDecorator {
     catch (Throwable t) {
       aLogger.error("Exception occurred inside an ListEnumeratingProducerNode: " + t.getMessage());
     }
-  };
+  }
 }
index 43dcbff..5b56b04 100755 (executable)
@@ -67,5 +67,5 @@ public class LoopProducerNode extends ProducerNodeDecorator {
     catch (Throwable t) {
       aLogger.error("LoopProducerNode raised an exception: " + t.getMessage());
     }
-  };
+  }
 }
\ No newline at end of file
index e4f3da1..28a31f6 100755 (executable)
@@ -62,7 +62,7 @@ public class NodedProducer implements Producer {
       isFinished=true;
       return !isAborted;
     }
-  };
+  }
 
   public void abort() {
     synchronized(this) {
index d3ca018..dc8d771 100755 (executable)
@@ -29,8 +29,8 @@
  */
 package mir.producer;
 
-import java.util.Map;
 import java.util.List;
+import java.util.Map;
 
 public interface ProducerFactory {
   public interface ProducerVerb {
index 79a20c7..4872813 100755 (executable)
@@ -33,7 +33,8 @@ import multex.Failure;
 
 public class ProducerFailure extends Failure {
 
-  public ProducerFailure(String msg,Throwable cause) {
+
+       public ProducerFailure(String msg,Throwable cause) {
     super(msg,cause);
   }
 
index fe99ff6..02ce159 100755 (executable)
@@ -83,5 +83,5 @@ public class RDFAggregatorProducerNode implements ProducerNode {
       Throwable s = ExceptionFunctions.traceCauseException(t);
       aLogger.error("Error while aggregating RDF data: " + s.getClass().getName()+","+ s.getMessage());
     }
-  };
+  }
 }
index 9d62022..fa2bef1 100755 (executable)
@@ -92,5 +92,5 @@ public class RSSProducerNode implements ProducerNode {
       Throwable s = ExceptionFunctions.traceCauseException(t);
       aLogger.error("Error while processing RSS data: " + s.getClass().getName()+","+ s.getMessage());
     }
-  };
+  }
 }
\ No newline at end of file
index d0dac9e..e0a4ffc 100755 (executable)
@@ -51,5 +51,5 @@ public class ValuesMapProducerNode extends ProducerNodeDecorator {
     catch (Throwable t) {
       throw new ProducerFailure(t.getMessage(), t);
     }
-  };
+  }
 }
\ No newline at end of file
index c2f9a01..e0c8024 100755 (executable)
@@ -29,6 +29,7 @@
  */
 package mir.producer.reader;
 
+import java.io.File;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -36,12 +37,12 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.io.File;
 
 import mir.entity.adapter.EntityAdapterModel;
 import mir.generator.Generator;
 import mir.generator.WriterEngine;
 import mir.log.LoggerWrapper;
+import mir.producer.BundleProducerNode;
 import mir.producer.ConditionalProducerNode;
 import mir.producer.DirCopyingProducerNode;
 import mir.producer.EntityBatchingProducerNode;
@@ -50,6 +51,7 @@ import mir.producer.EntityEnumeratingProducerNode;
 import mir.producer.EntityListProducerNode;
 import mir.producer.EntityModifyingProducerNode;
 import mir.producer.EvaluatedAssignmentProducerNode;
+import mir.producer.ExecuteProgramProducerNode;
 import mir.producer.ExpandedAssignmentProducerNode;
 import mir.producer.ExternalDbProducerNode;
 import mir.producer.FileDateSettingProducerNode;
@@ -62,8 +64,6 @@ import mir.producer.LoopProducerNode;
 import mir.producer.ProducerNode;
 import mir.producer.RDFAggregatorProducerNode;
 import mir.producer.RSSProducerNode;
-import mir.producer.BundleProducerNode;
-import mir.producer.ExecuteProgramProducerNode;
 import mir.util.StringRoutines;
 import mir.util.xml.XMLParserExc;
 import mir.util.xml.XMLReaderTool;
@@ -119,11 +119,11 @@ public class DefaultProducerNodeBuilders {
 
     public void setSubNode(String aName, ProducerNode aNode) {
       subNodes.put(aName, aNode);
-    };
+    }
 
     public Set getAvailableSubNodes() {
       return availableSubnodes;
-    };
+    }
   }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -162,11 +162,11 @@ public class DefaultProducerNodeBuilders {
 
       key = (String) anAttributes.get(ASSIGNMENT_KEY_ATTRIBUTE);
       value = (String) anAttributes.get(ASSIGNMENT_VALUE_ATTRIBUTE);
-    };
+    }
 
     public ProducerNode constructNode() {
       return new ExpandedAssignmentProducerNode(key, value);
-    };
+    }
   }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -185,11 +185,11 @@ public class DefaultProducerNodeBuilders {
 
       key = (String) anAttributes.get(ASSIGNMENT_KEY_ATTRIBUTE);
       value = (String) anAttributes.get(ASSIGNMENT_VALUE_ATTRIBUTE);
-    };
+    }
 
     public ProducerNode constructNode() {
       return new EvaluatedAssignmentProducerNode(key, value);
-    };
+    }
   }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -254,14 +254,13 @@ public class DefaultProducerNodeBuilders {
         if (parts.size() > 1)
           mainTablePrefix = (String) parts.get(1);
       }
-    };
+    }
 
     public ProducerNode constructNode() {
       if (definition!=null)
         return new EntityEnumeratingProducerNode(key, model, mainTablePrefix, extraTables, definition, selection, order, limit, skip, getSubNode(ENUMERATION_DEFAULT_SUBNODE ));
-      else
-        return new ListEnumeratingProducerNode(key, list, getSubNode(ENUMERATION_DEFAULT_SUBNODE ));
-    };
+                       return new ListEnumeratingProducerNode(key, list, getSubNode(ENUMERATION_DEFAULT_SUBNODE ));
+    }
 
     public static class factory implements ProducerNodeBuilderFactory {
       private EntityAdapterModel model;
@@ -306,11 +305,10 @@ public class DefaultProducerNodeBuilders {
       fieldValues.putAll(anAttributes);
       fieldValues.remove(UPDATE_KEY_ATTRIBUTE);
       fieldValues.remove(UPDATE_DEFINITION_ATTRIBUTE);
-    };
-
+    }
     public ProducerNode constructNode() {
       return new EntityModifyingProducerNode(model, false, definition, key, fieldValues);
-    };
+    }
 
     public static class factory implements ProducerNodeBuilderFactory {
       private EntityAdapterModel model;
@@ -357,11 +355,11 @@ public class DefaultProducerNodeBuilders {
       fieldValues.putAll(anAttributes);
       fieldValues.remove(CREATEENTITY_KEY_ATTRIBUTE);
       fieldValues.remove(CREATEENTITY_DEFINITION_ATTRIBUTE);
-    };
+    }
 
     public ProducerNode constructNode() {
       return new EntityModifyingProducerNode(model, true, definition, key, fieldValues);
-    };
+    }
 
     public static class factory implements ProducerNodeBuilderFactory {
       private EntityAdapterModel model;
@@ -398,11 +396,11 @@ public class DefaultProducerNodeBuilders {
 
       condition = (String) anAttributes.get(LOOP_CONDITION_ATTRIBUTE);
       limit = XMLReaderTool.getStringAttributeWithDefault(anAttributes, LOOP_LIMIT_ATTRIBUTE, "");
-    };
+    }
 
     public ProducerNode constructNode() {
       return new LoopProducerNode(condition, limit, getSubNode( LOOP_DEFAULT_SUBNODE ));
-    };
+    }
   }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -449,11 +447,11 @@ public class DefaultProducerNodeBuilders {
       if (parts.size()>0) definition=(String)parts.get(0);
       if (parts.size()>1) mainTablePrefix=(String)parts.get(1);
 
-    };
+    }
 
     public ProducerNode constructNode() {
       return new EntityListProducerNode(key, model, mainTablePrefix, extraTables, definition, selection, order, limit, skip, null );
-    };
+    }
 
     public static class factory implements ProducerNodeBuilderFactory {
       private EntityAdapterModel model;
@@ -493,11 +491,11 @@ public class DefaultProducerNodeBuilders {
 
       definition = (String) anAttributes.get(DELETEENTITY_DEFINITION_ATTRIBUTE);
       selection = XMLReaderTool.getStringAttributeWithDefault(anAttributes, DELETEENTITY_SELECTION_ATTRIBUTE, "");
-    };
+    }
 
     public ProducerNode constructNode() {
       return new EntityDeletingProducerNode(model, definition, selection);
-    };
+    }
 
     public static class factory implements ProducerNodeBuilderFactory {
       private EntityAdapterModel model;
@@ -552,11 +550,11 @@ public class DefaultProducerNodeBuilders {
       }
       else
         type = LoggerWrapper.INFO_MESSAGE;
-    };
+    }
 
     public ProducerNode constructNode() {
       return new LoggingProducerNode(message, type);
-    };
+    }
   }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -604,11 +602,11 @@ public class DefaultProducerNodeBuilders {
       }
       else
         type = FreeQueryProducerNode.QUERY_TYPE_SET;
-    };
+    }
 
     public ProducerNode constructNode() {
       return new FreeQueryProducerNode(key, query, limit, type);
-    };
+    }
   }
 ////////////////////////////////////////////////////////////////////////////////
 
@@ -651,11 +649,11 @@ public class DefaultProducerNodeBuilders {
       username = (String) anAttributes.get(EXTDB_USERNAME_ATTRIBUTE);
       password = (String) anAttributes.get(EXTDB_PASSWORD_ATTRIBUTE);
       query = (String) anAttributes.get(EXTDB_QUERY_ATTRIBUTE);
-    };
+    }
 
     public ProducerNode constructNode() {
       return new ExternalDbProducerNode(key, driver, host, port, database, username, password, query,  getSubNode(EXTDB_DEFAULT_SUBNODE));
-    };
+    }
   }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -682,11 +680,11 @@ public class DefaultProducerNodeBuilders {
       key = (String) anAttributes.get(RESOURCEBUNDLE_KEY_ATTRIBUTE);
       bundle = (String) anAttributes.get(RESOURCEBUNDLE_BUNDLE_ATTRIBUTE);
       language = (String) anAttributes.get(RESOURCEBUNDLE_LANGUAGE_ATTRIBUTE);
-    };
+    }
 
     public ProducerNode constructNode() {
       return new BundleProducerNode(key, bundle, language);
-    };
+    }
   }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -710,11 +708,11 @@ public class DefaultProducerNodeBuilders {
 
       fileNameKey = (String) anAttributes.get(FILEDATESETTING_FILE_ATTRIBUTE);
       dateKey = (String) anAttributes.get(FILEDATESETTING_DATE_ATTRIBUTE);
-    };
+    }
 
     public ProducerNode constructNode() {
       return new FileDateSettingProducerNode(fileNameKey, dateKey);
-    };
+    }
   }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -735,11 +733,11 @@ public class DefaultProducerNodeBuilders {
       XMLReaderTool.checkAttributes(anAttributes, FILEDELETING_REQUIRED_ATTRIBUTES, FILEDELETING_OPTIONAL_ATTRIBUTES);
 
       fileNameKey = (String) anAttributes.get(FILEDELETING_FILE_ATTRIBUTE);
-    };
+    }
 
     public ProducerNode constructNode() {
       return new FileDeletingProducerNode(fileNameKey);
-    };
+    }
   }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -769,12 +767,12 @@ public class DefaultProducerNodeBuilders {
       time = XMLReaderTool.getStringAttributeWithDefault(anAttributes, EXECUTEPROGRAM_MAXTIME_ATTRIBUTE, null);
       resultvar = XMLReaderTool.getStringAttributeWithDefault(anAttributes, EXECUTEPROGRAM_RESULTVAR_ATTRIBUTE, null);
       returnValueVar = XMLReaderTool.getStringAttributeWithDefault(anAttributes, EXECUTEPROGRAM_RETURNVALUE_ATTRIBUTE, null);
-    };
+    }
 
     public ProducerNode constructNode() {
       return new
           ExecuteProgramProducerNode(command, time, resultvar, returnValueVar);
-    };
+    }
   }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -803,11 +801,11 @@ public class DefaultProducerNodeBuilders {
 
       source = (String) anAttributes.get(DIRCOPY_SOURCE_ATTRIBUTE);
       destination = (String) anAttributes.get(DIRCOPY_DESTINATION_ATTRIBUTE);
-    };
+    }
 
     public ProducerNode constructNode() {
       return new DirCopyingProducerNode(sourceBasePath, destinationBasePath, source, destination);
-    };
+    }
 
     public static class factory implements ProducerNodeBuilderFactory {
       private File sourceBasePath;
@@ -853,11 +851,11 @@ public class DefaultProducerNodeBuilders {
       generator = (String) anAttributes.get(GENERATION_GENERATOR_ATTRIBUTE);
       destination = (String) anAttributes.get(GENERATION_DESTINATION_ATTRIBUTE);
       parameters = XMLReaderTool.getStringAttributeWithDefault(anAttributes, GENERATION_PARAMETERS_ATTRIBUTE, "" );
-    };
+    }
 
     public ProducerNode constructNode() {
       return new GeneratingProducerNode(generatorLibrary, writerEngine, generator, destination, parameters);
-    };
+    }
 
     public static class factory implements ProducerNodeBuilderFactory {
       private Generator.Library generatorLibrary;
@@ -935,7 +933,7 @@ public class DefaultProducerNodeBuilders {
       List parts = StringRoutines.splitString(definition.trim(), " ");
       if (parts.size()>0) definition = (String) parts.get(0);
       if (parts.size()>1) mainTablePrefix = (String) parts.get(1);
-    };
+    }
 
     public ProducerNode constructNode() {
       return new EntityBatchingProducerNode(
@@ -954,7 +952,7 @@ public class DefaultProducerNodeBuilders {
           getSubNode( BATCHER_BATCH_SUBNODE ),
           getSubNode( BATCHER_BATCHLIST_SUBNODE )
       );
-    };
+    }
 
     public static class factory implements ProducerNodeBuilderFactory {
       private EntityAdapterModel model;
@@ -990,7 +988,7 @@ public class DefaultProducerNodeBuilders {
       XMLReaderTool.checkAttributes(anAttributes, IF_REQUIRED_ATTRIBUTES, IF_OPTIONAL_ATTRIBUTES);
 
       condition = (String) anAttributes.get( IF_CONDITION_ATTRIBUTE );
-    };
+    }
 
     public ProducerNode constructNode() {
       return new ConditionalProducerNode(
@@ -998,7 +996,7 @@ public class DefaultProducerNodeBuilders {
           getSubNode( IF_TRUE_SUBNODE ),
           getSubNode( IF_FALSE_SUBNODE )
       );
-    };
+    }
 
   }
 
@@ -1030,11 +1028,11 @@ public class DefaultProducerNodeBuilders {
       url = (String) anAttributes.get( RSS_URL_ATTRIBUTE );
       version = XMLReaderTool.getStringAttributeWithDefault(anAttributes, RSS_VERSION_ATTRIBUTE, "1.0");
       encoding = XMLReaderTool.getStringAttributeWithDefault(anAttributes, RSS_ENCODING_ATTRIBUTE, null);
-    };
+    }
 
     public ProducerNode constructNode() {
       return new RSSProducerNode(key, url, version, encoding);
-    };
+    }
   }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1065,11 +1063,11 @@ public class DefaultProducerNodeBuilders {
       source = (String) anAttributes.get( RDF_AGGREGATOR_SOURCE_ATTRIBUTE );
       order = XMLReaderTool.getStringAttributeWithDefault(anAttributes, RDF_AGGREGATOR_SOURCE_ATTRIBUTE, "");
       filter = XMLReaderTool.getStringAttributeWithDefault(anAttributes, RDF_AGGREGATOR_FILTER_ATTRIBUTE, "");
-    };
+    }
 
     public ProducerNode constructNode() {
       return new RDFAggregatorProducerNode(key, source, order, filter);
-    };
+    }
   }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1084,20 +1082,20 @@ public class DefaultProducerNodeBuilders {
     }
 
     public void setSubNode(String aName, ProducerNode aNode) {
-    };
+    }
 
     public Set getAvailableSubNodes() {
       return new HashSet();
-    };
+    }
 
     public void setAttributes(Map anAttributes) throws ProducerConfigExc {
       if (!anAttributes.isEmpty())
         throw new ProducerConfigExc("No parameters allowed here");
-    };
+    }
 
     public ProducerNode constructNode() {
       return new ScriptedProducerNodeDefinition.NodeParameterProducerNode(scriptedNodeName, parameterName);
-    };
+    }
   }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -1122,11 +1120,11 @@ public class DefaultProducerNodeBuilders {
 
     public void setSubNode(String aName, ProducerNode aNode) {
       nodeParameterValues.put(aName, aNode);
-    };
+    }
 
     public Set getAvailableSubNodes() {
       return definition.getNodeParameters();
-    };
+    }
 
     public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
       XMLReaderTool.checkAttributeSet(anAttributes.keySet(), definition.getRequiredAttributes(), definition.getOptionalAttributes());
@@ -1140,11 +1138,11 @@ public class DefaultProducerNodeBuilders {
         else
           stringParameterValues.put(entry.getKey(), entry.getValue());
       }
-    };
+    }
 
     public ProducerNode constructNode() {
       return new ScriptedProducerNode(definition, stringParameterValues, integerParameterValues, nodeParameterValues);
-    };
+    }
 
     public static class factory implements ProducerNodeBuilderFactory {
       private ScriptedProducerNodeDefinition definition;
index 631573f..d39fbee 100755 (executable)
@@ -54,7 +54,7 @@ public class ProducerConfigReader {
 
   public ProducerConfigReader() {
     super();
-  };
+  }
 
   public void parse(Reader aReader, ProducerNodeBuilderLibrary aBuilderLibrary, List aProducerFactories) throws ProducerConfigFailure {
     try {
@@ -104,8 +104,7 @@ public class ProducerConfigReader {
       if (aTag.equals("producers")) {
         return new ProducersSectionHandler(producers);
       }
-      else
-        throw new XMLParserExc("Tag 'producers' expected, tag '"+aTag+"' found");
+                       throw new XMLParserExc("Tag 'producers' expected, tag '"+aTag+"' found");
     }
 
     public void endElement(mir.util.xml.SectionHandler aHandler) {
@@ -201,14 +200,12 @@ public class ProducerConfigReader {
           throw new XMLParserExc("Verbs already processed");
         if (body!=null)
           throw new XMLParserExc("Verbs should come before body");
-        else
-          return new ProducerVerbsSectionHandler();
+                               return new ProducerVerbsSectionHandler();
       }
       else if (aTag.equals("body")) {
         if (body==null)
           return new ProducerNodeSectionHandler();
-        else
-          throw new XMLParserExc("Body already processed");
+                               throw new XMLParserExc("Body already processed");
       }
       throw new XMLParserExc("Unexpected tag: '"+aTag+"'");
     }
@@ -288,8 +285,7 @@ public class ProducerConfigReader {
 
         return new ProducerNodeSectionHandler();
       }
-      else
-        throw new XMLParserExc("Only 'verb' tags allowed here, '" + aTag + "' encountered.");
+                       throw new XMLParserExc("Only 'verb' tags allowed here, '" + aTag + "' encountered.");
     }
 
     public void endElement(mir.util.xml.SectionHandler aHandler) {
@@ -472,9 +468,7 @@ public class ProducerConfigReader {
       if (producerNode.getNrSubNodes()==1) {
         return producerNode.getSubNode(0);
       }
-      else {
-        return producerNode;
-      }
+                       return producerNode;
     }
 
     public void finishSection() {
index bc9f287..90d1a4f 100755 (executable)
@@ -59,7 +59,6 @@ public class ProducerNodeBuilderLibrary {
   public ProducerNodeBuilder constructBuilder(String aName) throws ProducerConfigExc {
     if (hasBuilderForName(aName))
       return ((ProducerNodeBuilder.ProducerNodeBuilderFactory) nodeBuilders.get(aName)).makeBuilder();
-    else
-      throw new ProducerConfigExc("ProducerNodeBuilder: no builder with name '" + aName + "' found.");
+               throw new ProducerConfigExc("ProducerNodeBuilder: no builder with name '" + aName + "' found.");
   }
 }
index 5825ae9..e870733 100755 (executable)
@@ -84,7 +84,7 @@ public class ScriptedProducerFactory implements ProducerFactory {
     rootNode.addSubNode(body);
 
     return new NodedProducer(rootNode, aVerb, aStartingValues);
-  };
+  }
 
   public List verbs() {
     return verbs;
index 3a01811..2b9a4d0 100755 (executable)
  */
 package mir.rss;
 
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
 import mir.util.HTTPClientHelper;
 import mir.util.xml.XMLParserEngine;
 import mir.util.xml.XMLParserExc;
 import mir.util.xml.XMLParserFailure;
 
-import java.io.InputStream;
-import java.util.*;
-
 /**
  *
  * <p>Title: </p>
@@ -151,20 +155,19 @@ public class RSS091Reader {
       if (aTag.getLocalName().equals("rss")) {
         return new RSS091SectionHandler(data);
       }
-      else
-        throw new XMLParserFailure(new RSSExc("'rss' tag expected"));
-    };
+                       throw new XMLParserFailure(new RSSExc("'rss' tag expected"));
+    }
 
     public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
-    };
+    }
 
     public void characters(String aCharacters) throws XMLParserExc {
       if (aCharacters.trim().length()>0)
         throw new XMLParserExc("No character data allowed here");
-    };
+    }
 
     public void finishSection() throws XMLParserExc {
-    };
+    }
   }
 
   private class RSS091SectionHandler extends mir.util.xml.AbstractSectionHandler {
@@ -180,15 +183,15 @@ public class RSS091Reader {
         return new RSS091ChannelSectionHandler(data);
       else
         throw new XMLParserExc("channel tag expected, " + aTag.getLocalName() + " found");
-    };
+    }
 
     public void characters(String aCharacters) throws XMLParserExc {
       if (aCharacters.trim().length()>0)
         throw new XMLParserExc("No character data allowed here");
-    };
+    }
 
     public void finishSection() throws XMLParserExc {
-    };
+    }
   }
 
   private class RSS091ChannelSectionHandler extends mir.util.xml.AbstractSectionHandler {
@@ -217,7 +220,7 @@ public class RSS091Reader {
       }
       else
         return new DiscardingSectionHandler();
-    };
+    }
 
     public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
       if (aHandler instanceof PCDATASectionHandler) {
@@ -226,12 +229,12 @@ public class RSS091Reader {
       else if (aHandler instanceof RSS091ItemSectionHandler) {
         items.add((((RSS091ItemSectionHandler) aHandler).getItem()));
       }
-    };
+    }
 
     public void characters(String aCharacters) throws XMLParserExc {
       if (aCharacters.trim().length()>0)
         throw new XMLParserExc("No character data allowed here");
-    };
+    }
 
     public void finishSection() throws XMLParserExc {
       Iterator i = items.iterator();
@@ -239,7 +242,7 @@ public class RSS091Reader {
       while (i.hasNext()) {
         data.addResource((RDFResource) i.next());
       }
-    };
+    }
   }
 
   private class RSS091ItemSectionHandler extends mir.util.xml.AbstractSectionHandler {
@@ -259,20 +262,19 @@ public class RSS091Reader {
         currentTag=(String) mappedItemProperties.get(tag);
         return new PCDATASectionHandler();
       }
-      else
-        return new DiscardingSectionHandler();
-    };
+                       return new DiscardingSectionHandler();
+    }
 
     public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
       if (aHandler instanceof PCDATASectionHandler) {
         attributes.put(currentTag, (((PCDATASectionHandler) aHandler).getData()));
       }
-    };
+    }
 
     public void characters(String aCharacters) throws XMLParserExc {
       if (aCharacters.trim().length()>0)
         throw new XMLParserExc("No character data allowed here");
-    };
+    }
 
     public void finishSection() throws XMLParserExc {
       item = new RDFResource("rss:item", (String) attributes.get("rss:link"));
@@ -283,7 +285,7 @@ public class RSS091Reader {
 
         item.set((String) entry.getKey(), entry.getValue());
       }
-    };
+    }
 
     public RDFResource getItem() {
       return item;
@@ -300,17 +302,17 @@ public class RSS091Reader {
 
     public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
       throw new XMLParserFailure(new RSSExc("No subtags allowed here"));
-    };
+    }
 
     public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
-    };
+    }
 
     public void characters(String aCharacters) throws XMLParserExc {
       data.append(aCharacters);
-    };
+    }
 
     public void finishSection() throws XMLParserExc {
-    };
+    }
 
     public String getData() {
       return data.toString();
@@ -334,16 +336,16 @@ public class RSS091Reader {
       }
 
       return new DiscardingSectionHandler();
-    };
+    }
 
     public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
-    };
+    }
 
     public void characters(String aCharacters) throws XMLParserExc {
-    };
+    }
 
     public void finishSection() throws XMLParserExc {
-    };
+    }
 
     public List getItems() {
       return items;
@@ -353,15 +355,15 @@ public class RSS091Reader {
   private class DiscardingSectionHandler extends mir.util.xml.AbstractSectionHandler {
     public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
       return this;
-    };
+    }
 
     public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
-    };
+    }
 
     public void characters(String aCharacters) throws XMLParserExc {
-    };
+    }
 
     public void finishSection() throws XMLParserExc {
-    };
+    }
   }
 }
index d858aed..e1aa6a9 100755 (executable)
  */
 package mir.rss;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.ArrayList;
 
 public class RSSData {
   private List resources;
index ad2958a..faff1ea 100755 (executable)
@@ -172,20 +172,19 @@ public class RSSReader {
       if (aTag.getLocalName().equals("RDF")) {
         return new RDFSectionHandler(data);
       }
-      else
-        throw new XMLParserFailure(new RSSExc("'RDF' tag expected"));
-    };
+                       throw new XMLParserFailure(new RSSExc("'RDF' tag expected"));
+    }
 
     public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
-    };
+    }
 
     public void characters(String aCharacters) throws XMLParserExc {
       if (aCharacters.trim().length()>0)
         throw new XMLParserExc("No character data allowed here");
-    };
+    }
 
     public void finishSection() throws XMLParserExc {
-    };
+    }
   }
 
   private class RDFSectionHandler extends mir.util.xml.AbstractSectionHandler {
@@ -201,21 +200,21 @@ public class RSSReader {
       String rdfClass = makeQualifiedName(aTag);
 
       return new RDFResourceSectionHandler(rdfClass, identifier);
-    };
+    }
 
     public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
       if (aHandler instanceof RDFResourceSectionHandler) {
         data.addResource(((RDFResourceSectionHandler) aHandler).getResource());
       }
-    };
+    }
 
     public void characters(String aCharacters) throws XMLParserExc {
       if (aCharacters.trim().length()>0)
         throw new XMLParserExc("No character data allowed here");
-    };
+    }
 
     public void finishSection() throws XMLParserExc {
-    };
+    }
   }
 
   private mir.util.xml.SectionHandler makePropertyValueSectionHandler(mir.util.xml.XMLName aTag, Map anAttributes) {
@@ -294,22 +293,22 @@ public class RSSReader {
       currentTag = aTag;
 
       return makePropertyValueSectionHandler(aTag, anAttributes);
-    };
+    }
 
     public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
       if (aHandler instanceof PropertyValueSectionHandler) {
         usePropertyValueSectionHandler(resource, (PropertyValueSectionHandler) aHandler, currentTag);
 //        resource.set(makeQualifiedName(currentTag), ( (PropertyValueSectionHandler) aHandler).getFieldValue());
       }
-    };
+    }
 
     public void characters(String aCharacters) throws XMLParserExc {
       if (aCharacters.trim().length()>0)
         throw new XMLParserExc("No character data allowed here");
-    };
+    }
 
     public void finishSection() throws XMLParserExc {
-    };
+    }
 
     public RDFResource getResource() {
       if ((resource.getIdentifier()==null || resource.getIdentifier().length()==0) && resource.get("rss:link")!=null) {
@@ -338,20 +337,20 @@ public class RSSReader {
         return new RDFSequenceSectionHandler();
       else
         return new DiscardingSectionHandler();
-    };
+    }
 
     public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
       if (aHandler instanceof RDFSequenceSectionHandler) {
         structuredData= ((RDFSequenceSectionHandler) aHandler).getItems();
       }
-    };
+    }
 
     public void characters(String aCharacters) throws XMLParserExc {
       stringData.append(aCharacters);
-    };
+    }
 
     public void finishSection() throws XMLParserExc {
-    };
+    }
 
     public String getData() {
       return stringData.toString();
@@ -360,8 +359,7 @@ public class RSSReader {
     public Object getValue() {
       if (structuredData==null)
         return stringData.toString();
-      else
-        return structuredData;
+                       return structuredData;
     }
   }
 
@@ -377,21 +375,21 @@ public class RSSReader {
         return new RDFSequenceSectionHandler();
       else
         return new DiscardingSectionHandler();
-    };
+    }
 
     public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
       if (aHandler instanceof RDFSequenceSectionHandler) {
         items.addAll(((RDFSequenceSectionHandler) aHandler).getItems());
       }
-    };
+    }
 
     public void characters(String aCharacters) throws XMLParserExc {
       if (aCharacters.trim().length()>0)
         throw new XMLParserExc("No character data allowed here");
-    };
+    }
 
     public void finishSection() throws XMLParserExc {
-    };
+    }
 
     public List getItems() {
       return items;
@@ -411,17 +409,17 @@ public class RSSReader {
 
     public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
       throw new XMLParserFailure(new RSSExc("No subtags allowed here"));
-    };
+    }
 
     public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
-    };
+    }
 
     public void characters(String aCharacters) throws XMLParserExc {
       data.append(aCharacters);
-    };
+    }
 
     public void finishSection() throws XMLParserExc {
-    };
+    }
 
     public String getData() {
       return data.toString();
@@ -441,17 +439,17 @@ public class RSSReader {
 
     public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
       throw new XMLParserFailure(new RSSExc("No subtags allowed here"));
-    };
+    }
 
     public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
-    };
+    }
 
     public void characters(String aCharacters) throws XMLParserExc {
       data.append(aCharacters);
-    };
+    }
 
     public void finishSection() throws XMLParserExc {
-    };
+    }
 
     public Object getValue() {
       try {
@@ -483,16 +481,16 @@ public class RSSReader {
       }
 
       return new DiscardingSectionHandler();
-    };
+    }
 
     public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
-    };
+    }
 
     public void characters(String aCharacters) throws XMLParserExc {
-    };
+    }
 
     public void finishSection() throws XMLParserExc {
-    };
+    }
 
     public List getItems() {
       return items;
@@ -516,19 +514,19 @@ public class RSSReader {
       data.append("<"+tag+">");
 
       return new RDFLiteralSectionHandler();
-    };
+    }
 
     public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
       data.append(((RDFLiteralSectionHandler) aHandler).getData());
       data.append("</"+tag+">");
-    };
+    }
 
     public void characters(String aCharacters) throws XMLParserExc {
       data.append(aCharacters);
-    };
+    }
 
     public void finishSection() throws XMLParserExc {
-    };
+    }
 
     public Object getValue() {
       return data.toString();
@@ -538,15 +536,15 @@ public class RSSReader {
   private class DiscardingSectionHandler extends mir.util.xml.AbstractSectionHandler {
     public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
       return this;
-    };
+    }
 
     public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
-    };
+    }
 
     public void characters(String aCharacters) throws XMLParserExc {
-    };
+    }
 
     public void finishSection() throws XMLParserExc {
-    };
+    }
   }
 }
index b3a2d6c..13553f3 100755 (executable)
  */
 package mir.servlet;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+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;
@@ -376,7 +382,7 @@ public abstract class ServletModule {
     catch (ModuleExc t) {
       throw new ServletModuleFailure(t);
     }
-  };
+  }
 
   /**
    * Generic delete confirmation servlet method
index 968c004..8fcaf88 100755 (executable)
  */
 package mir.session;
 
-import org.apache.commons.fileupload.FileItem;
-
 import java.io.File;
-import java.io.InputStream;
 import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.commons.fileupload.FileItem;
 
 public class CommonsUploadedFileAdapter implements UploadedFile {
   private FileItem fileItem;
@@ -72,5 +72,5 @@ public class CommonsUploadedFileAdapter implements UploadedFile {
 
   public String getContentType() {
     return fileItem.getContentType();
-  };
+  }
 }
\ No newline at end of file
index 78cd362..cc16c21 100755 (executable)
  */
 package mir.session;
 
-import java.util.*;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
 
 import mir.util.HTTPParsedRequest;
+
 import org.apache.commons.fileupload.FileItem;
 
 public class HTTPAdapters {
@@ -68,11 +75,11 @@ public class HTTPAdapters {
       }
 
       return request.getHeader(aHeaderName);
-    };
+    }
 
     public String getParameter(String aName) {
       return request.getParameter(aName);
-    };
+    }
 
     public List getPrefixedParameterNames(String aPrefix) {
       List result = new ArrayList();
@@ -86,15 +93,15 @@ public class HTTPAdapters {
       }
 
       return result;
-    };
+    }
 
     public List getUploadedFiles() {
       return Collections.EMPTY_LIST;
-    };
+    }
 
     public List getParameters(String aName) {
       return Arrays.asList(request.getParameterValues(aName));
-    };
+    }
 
     public HttpServletRequest getRequest() {
       return request;
@@ -117,9 +124,7 @@ public class HTTPAdapters {
         if (headers.hasMoreElements()) {
           return (String) headers.nextElement();
         }
-        else {
-          return request.getRequest().getRemoteAddr();
-        }
+                               return request.getRequest().getRemoteAddr();
       }
 
       if (aHeaderName.equals("hostname")) {
@@ -140,11 +145,11 @@ public class HTTPAdapters {
 
     public String getParameter(String aName) {
       return request.getParameter(aName);
-    };
+    }
 
     public List getParameters(String aName) {
       return request.getParameterList(aName);
-    };
+    }
 
     public List getPrefixedParameterNames(String aPrefix) {
       List result = new ArrayList();
@@ -157,9 +162,8 @@ public class HTTPAdapters {
           result.add(name);
         }
       }
-
       return result;
-    };
+    }
 
     public List getUploadedFiles() {
       List result = new ArrayList();
@@ -170,7 +174,7 @@ public class HTTPAdapters {
       }
 
       return result;
-    };
+    }
 
     public HttpServletRequest getRequest() {
       return request.getRequest();
index 9ac7e08..83a31bc 100755 (executable)
@@ -50,8 +50,7 @@ public class ValidationHelper {
       aValidationResults.add(new ValidationError(aFieldName, anErrorMessageResource));
       return false;
     }
-    else
-      return true;
+               return true;
   }
 
   /**
index ea6d987..0f886db 100755 (executable)
  */
 package mir.storage;
 
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Timestamp;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TimeZone;
+
 import mir.config.MirPropertiesConfiguration;
+import mir.entity.AbstractEntity;
 import mir.entity.Entity;
 import mir.entity.EntityList;
 import mir.entity.StorableObjectEntity;
-import mir.entity.AbstractEntity;
 import mir.log.LoggerWrapper;
 import mir.misc.StringUtil;
-import mir.storage.store.*;
+import mir.storage.store.ObjectStore;
+import mir.storage.store.StorableObject;
+import mir.storage.store.StoreContainerType;
+import mir.storage.store.StoreIdentifier;
+import mir.storage.store.StoreUtil;
 import mir.util.JDBCStringRoutines;
 import mircoders.global.MirGlobal;
 
-import java.io.*;
-import java.sql.*;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.*;
-
 import org.apache.commons.dbcp.DelegatingConnection;
 import org.postgresql.PGConnection;
-import org.postgresql.largeobject.LargeObjectManager;
 import org.postgresql.largeobject.LargeObject;
+import org.postgresql.largeobject.LargeObjectManager;
 
 /**
  * Implements database access.
  *
- * @version $Id: Database.java,v 1.44.2.26 2005/01/23 15:36:03 zapata Exp $
+ * @version $Id: Database.java,v 1.44.2.27 2005/02/10 16:22:33 rhindes Exp $
  * @author rk
  *
  */
@@ -882,7 +902,8 @@ public class Database {
         con.setAutoCommit(true);
       }
       catch (Exception e) {
-        ;
+        
+       
       }
 
       freeConnection(con, pstmt);
@@ -1041,7 +1062,7 @@ public class Database {
         freeConnection(connection, statement);
       }
     }
-  };
+  }
 
   /**
    * Executes 1 sql statement and returns the first result row as a <code>Map</code>s
@@ -1053,8 +1074,7 @@ public class Database {
       try {
         if (resultList.size()>0)
           return (Map) resultList.get(0);
-        else
-          return null;
+                               return null;
       }
       finally {
       }
@@ -1062,7 +1082,7 @@ public class Database {
     catch (Throwable t) {
       throw new StorageObjectFailure(t);
     }
-  };
+  }
 
   /**
    * Executes 1 sql statement and returns the first column of the first result row as a <code>String</code>s
@@ -1077,9 +1097,8 @@ public class Database {
     Iterator i = row.values().iterator();
     if (i.hasNext())
       return (String) i.next();
-    else
-      return null;
-  };
+               return null;
+  }
 
   public int getSize(String where) throws SQLException, StorageObjectFailure {
     return getSize("", null, where);
index c1b7aca..3b946b9 100755 (executable)
@@ -53,8 +53,8 @@ public class StorageObjectFailure extends Failure {
   }
 
   /**
-   * Construktor with message
-   * @param   String msg
+   * Constructor with message
+   * @param msg
    */
   public StorageObjectFailure(String msg, Throwable e) {
     super(msg, e);
index 0c65b1c..8c3a7f4 100755 (executable)
@@ -63,6 +63,7 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.MissingResourceException;
+
 import javax.servlet.http.HttpServletRequest;
 
 import mir.config.MirPropertiesConfiguration;
index dafe141..e1a455f 100755 (executable)
@@ -67,7 +67,7 @@ public class StoreContainer {
   protected LoggerWrapper logger = new LoggerWrapper("Database.ObjectStore");
 
   // avoid construction without parameters
-  private StoreContainer() {};
+  private StoreContainer() {}
 
 
   public StoreContainer(StoreContainerType stoc_type) {
@@ -183,7 +183,7 @@ public class StoreContainer {
   /**
    *  Method:       toString()
    *  Description:  gives out statistical Information, viewable via
-   *                @see ServletStoreInfo.
+   *                @see ServletStoreInfo
    *
    *  @return       String
    */
index 96273de..837fb52 100755 (executable)
@@ -65,6 +65,6 @@ public class EntityC1 implements StorableObject {
     // simulates a relation to EntityC2 with uniqueIdentifier "1"
     notifiees.add(new StoreIdentifier(EntityC2.class,"1"));
     notifiees.add(new StoreIdentifier(EntityC2.class,"18"));
-               return (Set)notifiees;
+               return notifiees;
        }
 }
\ No newline at end of file
index 1bbfc0a..0678e74 100755 (executable)
@@ -67,5 +67,5 @@ public class CachingRewindableIterator implements RewindableIterator {
 
   public void rewind() {
     iterationPosition=0;
-  };
+  }
 }
\ No newline at end of file
index f89ef89..4eff748 100755 (executable)
@@ -45,6 +45,15 @@ public class DateTimeFunctions {
   private DateTimeFunctions() {
   }
 
+
+  private final static String SPACE = "[\t\n\r ]*";
+  private final static String NUMBER = "[0-9]*";
+  private final static String TWODIGITNUMBER = "[0-9][0-9]";
+  private final static String FOURDIGITNUMBER = "[0-9][0-9][0-9][0-9]";
+  private final static String FRACTION = "(\\.[0-9]*)|)";
+  private final static String SIGN = "[-+]";
+  private final static String TZD = "(Z|(+|-)([0-9][0-9]:[0-9][0-9]|[0-9][0-9][0-9][0-9]))";
+  
   /**
    * Function to parse a <a href="http://www.w3.org/TR/NOTE-datetime">W3CDTF</a> formatted string.
    *
@@ -52,16 +61,8 @@ public class DateTimeFunctions {
    * YYYY[-MM[-DD[Thh:mm[:ss[.s*]]TZD]]]
    *
    * @param aString
-   * @return
+   * @return Date
    */
-  private final static String SPACE = "[\t\n\r ]*";
-  private final static String NUMBER = "[0-9]*";
-  private final static String TWODIGITNUMBER = "[0-9][0-9]";
-  private final static String FOURDIGITNUMBER = "[0-9][0-9][0-9][0-9]";
-  private final static String FRACTION = "(\\.[0-9]*)|)";
-  private final static String SIGN = "[-+]";
-  private final static String TZD = "(Z|(+|-)([0-9][0-9]:[0-9][0-9]|[0-9][0-9][0-9][0-9]))";
-
   public static Date parseW3CDTFString(String aString) throws UtilExc, UtilFailure {
     try {
       int year = 1;
index c9e6a10..476451c 100755 (executable)
  */
 package mir.util;
 
-import java.io.*;
+import gnu.regexp.RE;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
-import gnu.regexp.RE;
-
 public class FileFunctions {
   protected static final int FILE_COPY_BUFFER_SIZE = 65536;
 
@@ -146,7 +153,7 @@ public class FileFunctions {
         inputStream.close();
       }
       aSource.delete();
-    };
+    }
   }
 
   public static class RegExpFileFilter implements FilenameFilter {
@@ -179,8 +186,7 @@ public class FileFunctions {
     Object[] contents = aDirectory.list(aFilter);
     if (contents==null)
       return Collections.EMPTY_LIST;
-    else
-      return Arrays.asList(contents);
+               return Arrays.asList(contents);
   }
 
   public static String getExtension(String aPath) {
@@ -188,9 +194,7 @@ public class FileFunctions {
     if (position>=0) {
       return aPath.substring(position+1);
     }
-    else {
-      return "";
-    }
+               return "";
   }
 
   public static boolean isAbsolutePath(String aPath) {
@@ -201,8 +205,6 @@ public class FileFunctions {
     if (isAbsolutePath(aPath)) {
       return new File(aPath);
     }
-    else {
-      return new File(aParentIfRelative, aPath);
-    }
+               return new File(aParentIfRelative, aPath);
   }
 }
\ No newline at end of file
index d7d88be..36a8d11 100755 (executable)
@@ -90,7 +90,7 @@ public class GeneratorDateTimeFunctions {
       catch (Throwable t) {
         throw new GeneratorFailure("encodeURIGeneratorFunction: " + t.getMessage(), t);
       }
-    };
+    }
   }
 
 
index becea34..7c7f5a3 100755 (executable)
@@ -72,7 +72,7 @@ public class GeneratorFormatAdapters {
         catch (Throwable t) {
           throw new GeneratorFailure("NumberFormattingFunction: " + t.getMessage(), t);
         }
-      };
+      }
     }
   }
 
@@ -149,7 +149,7 @@ public class GeneratorFormatAdapters {
         catch (Throwable t) {
           throw new GeneratorFailure("DateFormattingFunction: " + t.getMessage(), t);
         }
-      };
+      }
     }
 
     /**
index 3d9d96f..881db9c 100755 (executable)
  */
 package mir.util;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
 import mir.log.LoggerWrapper;
+
 import org.apache.commons.fileupload.DiskFileUpload;
 import org.apache.commons.fileupload.FileItem;
 
-import javax.servlet.http.HttpServletRequest;
-import java.util.*;
-
 public class HTTPParsedRequest {
   static final String MULTIPART_FORMDATA_CONTENTTYPE = "multipart/form-data";
 
index 4695468..a24c468 100755 (executable)
 package mir.util;
 
 import java.util.ArrayList;
-import java.util.List;
 import java.util.Collections;
+import java.util.List;
 import java.util.Map;
+
 import javax.servlet.http.HttpServletRequest;
 
 public class HTTPRequestParser {
index 2260d4d..a510aa3 100755 (executable)
@@ -31,8 +31,8 @@
 
 package mir.util;
 
-import java.util.List;
 import java.net.InetAddress;
+import java.util.List;
 
 public class InternetFunctions {
   private InternetFunctions() {
index e397f6f..3077611 100755 (executable)
  */
 package mir.util;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
 import mir.generator.Generator;
 import mir.generator.GeneratorExc;
 import multex.Exc;
+
 import org.apache.commons.beanutils.MethodUtils;
 import org.apache.commons.beanutils.PropertyUtils;
 
-import java.util.*;
-
 /**
  * Class to work with expressions. Will be gradually phased out and replaced
  * with {@link mir.util.expressions.ExpressionParser}
@@ -263,25 +268,25 @@ public class ParameterExpander {
   private static abstract class Token {
   }
 
-  public static abstract class PunctuationToken extends Token { public PunctuationToken() { }; }
-    private static class LeftSquareBraceToken extends PunctuationToken {};
-    private static class RightSquareBraceToken extends PunctuationToken {};
-    private static class EqualsToken extends PunctuationToken {};
-    private static class EqualsNotToken extends PunctuationToken {};
-    private static class NOTToken extends PunctuationToken {};
-    private static class LeftParenthesisToken extends PunctuationToken {};
-    private static class RightParenthesisToken extends PunctuationToken {};
-    private static class CommaToken extends PunctuationToken {};
-    private static class PeriodToken extends PunctuationToken {};
-    private static class PlusToken extends PunctuationToken {};
-    private static class TimesToken extends PunctuationToken {};
-    private static class DivideToken extends PunctuationToken {};
-    private static class MinusToken extends PunctuationToken {};
-    private static class ConcatenateToken extends PunctuationToken {};
-    private static class LessThanOrEqualsToken extends PunctuationToken {};
-    private static class GreaterThanOrEqualsToken extends PunctuationToken {};
-    private static class LessThanToken extends PunctuationToken {};
-    private static class GreaterThanToken extends PunctuationToken {};
+  public static abstract class PunctuationToken extends Token { public PunctuationToken() { } }
+    private static class LeftSquareBraceToken extends PunctuationToken {}
+    private static class RightSquareBraceToken extends PunctuationToken {}
+    private static class EqualsToken extends PunctuationToken {}
+    private static class EqualsNotToken extends PunctuationToken {}
+    private static class NOTToken extends PunctuationToken {}
+    private static class LeftParenthesisToken extends PunctuationToken {}
+    private static class RightParenthesisToken extends PunctuationToken {}
+    private static class CommaToken extends PunctuationToken {}
+    private static class PeriodToken extends PunctuationToken {}
+    private static class PlusToken extends PunctuationToken {}
+    private static class TimesToken extends PunctuationToken {}
+    private static class DivideToken extends PunctuationToken {}
+    private static class MinusToken extends PunctuationToken {}
+    private static class ConcatenateToken extends PunctuationToken {}
+    private static class LessThanOrEqualsToken extends PunctuationToken {}
+    private static class GreaterThanOrEqualsToken extends PunctuationToken {}
+    private static class LessThanToken extends PunctuationToken {}
+    private static class GreaterThanToken extends PunctuationToken {}
 
 
   private static class IdentifierToken extends Token {
@@ -443,7 +448,7 @@ public class ParameterExpander {
     public void skipWhitespace() {
       while (reader.hasNext() && Character.isWhitespace(reader.peek().charValue()))
         reader.getNext();
-    };
+    }
 
     private boolean isIdentifierStart(char c) {
       return Character.isLetter(c) || (c == '_');
index 0044577..a820f57 100755 (executable)
@@ -35,7 +35,11 @@ import java.io.LineNumberReader;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 import multex.Exc;
 import multex.Failure;
index b15014f..df34672 100755 (executable)
@@ -1,60 +1,60 @@
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with  any library licensed under the Apache Software License,\r
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library\r
- * (or with modified versions of the above that use the same license as the above),\r
- * and distribute linked combinations including the two.  You must obey the\r
- * GNU General Public License in all respects for all of the code used other than\r
- * the above mentioned libraries.  If you modify this file, you may extend this\r
- * exception to your version of the file, but you are not obligated to do so.\r
- * If you do not wish to do so, delete this exception statement from your version.\r
- */\r
-package mir.util;\r
-\r
-import org.apache.commons.beanutils.MethodUtils;\r
-\r
-import java.lang.reflect.InvocationTargetException;\r
-\r
-public class ReflectionRoutines {\r
-  private ReflectionRoutines() {\r
-  }\r
-\r
-  /**\r
-   * Method to overcome a shortcoming in {@link org.apache.commons.beanutils}'s\r
-   *     {@link MethodUtils#invokeMethod(Object, String, Object[])} involving\r
-   *     parameters that are <code>null</code> \r
-   */\r
-  public static Object invokeMethod(Object aTarget, String aMethodName, Object[] aParameters)\r
-      throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {\r
-    Class parameterTypes[] = new Class[aParameters.length];\r
-\r
-    for (int i=0; i<aParameters.length; i++) {\r
-      if (aParameters[i] == null) {\r
-        parameterTypes[i] = Object.class;\r
-      }\r
-      else {\r
-        parameterTypes[i] = aParameters[i].getClass();\r
-      }\r
-    }\r
-\r
-    return MethodUtils.invokeMethod(aTarget, aMethodName, aParameters, parameterTypes);\r
-  }\r
-}\r
+/*
+ * 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 java.lang.reflect.InvocationTargetException;
+
+import org.apache.commons.beanutils.MethodUtils;
+
+public class ReflectionRoutines {
+  private ReflectionRoutines() {
+  }
+
+  /**
+   * Method to overcome a shortcoming in {@link org.apache.commons.beanutils}'s
+   *     {@link MethodUtils#invokeMethod(Object, String, Object[])} involving
+   *     parameters that are <code>null</code> 
+   */
+  public static Object invokeMethod(Object aTarget, String aMethodName, Object[] aParameters)
+      throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
+    Class parameterTypes[] = new Class[aParameters.length];
+
+    for (int i=0; i<aParameters.length; i++) {
+      if (aParameters[i] == null) {
+        parameterTypes[i] = Object.class;
+      }
+      else {
+        parameterTypes[i] = aParameters[i].getClass();
+      }
+    }
+
+    return MethodUtils.invokeMethod(aTarget, aMethodName, aParameters, parameterTypes);
+  }
+}
index b259b9a..a4d655d 100755 (executable)
@@ -29,9 +29,9 @@
  */
 package mir.util;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.io.IOException;
 
 public class StreamCopier {
   public static void copy(InputStream aSource, OutputStream aDestination) throws IOException {
index 04bbc72..9e96195 100755 (executable)
 
 package mir.util;
 
+import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Map;
 import java.util.List;
-import java.util.ArrayList;
+import java.util.Map;
 
 public class StringParseRoutines {
 
index a7a41b6..b79ef10 100755 (executable)
@@ -31,8 +31,8 @@ package mir.util;
 
 import gnu.regexp.RE;
 
-import java.util.List;
 import java.util.ArrayList;
+import java.util.List;
 
 public class StringRoutines {
 
@@ -316,8 +316,7 @@ public class StringRoutines {
   public static String padStringLeft(String aString, int aLength, char aPadCharacter) {
     if (aString.length()<aLength)
       return replicateChar(aPadCharacter, aLength-aString.length()) + aString;
-    else
-      return aString;
+               return aString;
   }
 
   private static final char HEX_CHARACTERS[] = {
index 7f3f354..60a8866 100755 (executable)
 
 package mir.util;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.ArrayList;
 
 
 /**
index b1b1439..652bdfd 100755 (executable)
  */
 package mir.util;
 
-import java.util.List;
 import java.util.NoSuchElementException;
 
 public class SubsetIterator implements RewindableIterator {
   private RewindableIterator master;
-  private List cachedItems;
   private int position;
   private int skip;
   private int maxLength;
@@ -62,8 +60,7 @@ public class SubsetIterator implements RewindableIterator {
   public Object next() {
     if (hasNext())
       return getNext();
-    else
-      throw new NoSuchElementException();
+               throw new NoSuchElementException();
   }
 
   public void remove() {
@@ -73,5 +70,5 @@ public class SubsetIterator implements RewindableIterator {
   public void rewind() {
     position=0;
     master.rewind();
-  };
+  }
 }
\ No newline at end of file
index a33a5ed..411338c 100755 (executable)
  */
 package mir.util.generator;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import mir.bundle.Bundle;
 import mir.generator.Generator;
 import mir.generator.GeneratorExc;
 
-import java.util.ArrayList;
-import java.util.List;
-
 /**
  *
  */
index cd2dda5..2218249 100755 (executable)
@@ -1,39 +1,39 @@
-package mir.util.xml;\r
-\r
-/**\r
- *\r
- * <p>Title: </p>\r
- * <p>Description: </p>\r
- * <p>Copyright: Copyright (c) 2003</p>\r
- * <p>Company: </p>\r
- * @author not attributable\r
- * @version 1.0\r
- */\r
-\r
-public abstract class AbstractSectionHandler implements SectionHandler {\r
-  public void extra(String anExtraData) throws XMLParserExc, XMLParserFailure {\r
-  }\r
-\r
-  public SectionHandler startElement(XMLName aTag, java.util.Map anAttributes) throws XMLParserExc{\r
-    return startElement(aTag.getLocalName(), XMLReaderTool.convertXMLAttributeMap(anAttributes));\r
-  };\r
-\r
-  public SectionHandler startElement(String aLocalName, java.util.Map anAttributes) throws XMLParserExc{\r
-    return new AbstractSectionHandler() {};\r
-  };\r
-\r
-  public void endElement(SectionHandler aHandler) throws XMLParserExc{\r
-  };\r
-\r
-  public void startSection() throws XMLParserExc{\r
-  }\r
-\r
-  public void finishSection() throws XMLParserExc{\r
-  }\r
-\r
-  public void characters(String aCharacters) throws XMLParserExc{\r
-    if ( aCharacters.trim().length() > 0) {\r
-      throw new XMLParserExc("Text not allowed");\r
-    }\r
-  }\r
-}\r
+package mir.util.xml;
+
+/**
+ *
+ * <p>Title: </p>
+ * <p>Description: </p>
+ * <p>Copyright: Copyright (c) 2003</p>
+ * <p>Company: </p>
+ * @author not attributable
+ * @version 1.0
+ */
+
+public abstract class AbstractSectionHandler implements SectionHandler {
+  public void extra(String anExtraData) throws XMLParserExc, XMLParserFailure {
+  }
+
+  public SectionHandler startElement(XMLName aTag, java.util.Map anAttributes) throws XMLParserExc{
+    return startElement(aTag.getLocalName(), XMLReaderTool.convertXMLAttributeMap(anAttributes));
+  }
+
+  public SectionHandler startElement(String aLocalName, java.util.Map anAttributes) throws XMLParserExc{
+    return new AbstractSectionHandler() {};
+  }
+
+  public void endElement(SectionHandler aHandler) throws XMLParserExc{
+  }
+
+  public void startSection() throws XMLParserExc{
+  }
+
+  public void finishSection() throws XMLParserExc{
+  }
+
+  public void characters(String aCharacters) throws XMLParserExc{
+    if ( aCharacters.trim().length() > 0) {
+      throw new XMLParserExc("Text not allowed");
+    }
+  }
+}
index a9f6058..173bc01 100755 (executable)
@@ -1,88 +1,86 @@
-package mir.util.xml;\r
-\r
-/**\r
- * Class to encapsulate an XML-style name (either for tagnames,\r
- * or attribute names).\r
- *\r
- * <p>\r
- * Usage requirements:\r
- * <ul>\r
- *   <li> Namespace aware parsers must supply a local name\r
- *        and a namespace URI\r
- *   <li> Non-namespace aware parsers should supply a local name,\r
- *        and, if present and applicable, also a prefix\r
- * </ul>\r
- */\r
-\r
-public class XMLName {\r
-  private String namespaceURI;\r
-  private String localName;\r
-  private String prefix;\r
-\r
-  public XMLName(String aLocalName) {\r
-    this(null, null, aLocalName);\r
-  }\r
-\r
-  public XMLName(String aNamespaceURI, String aPrefix, String aLocalName) {\r
-    localName="";\r
-    prefix="";\r
-    namespaceURI="";\r
-\r
-    if (aLocalName!=null)\r
-      localName = aLocalName;\r
-    if (aPrefix!=null)\r
-      prefix = aPrefix;\r
-    if (aNamespaceURI!=null)\r
-      namespaceURI = aNamespaceURI;\r
-  }\r
-\r
-  public XMLName(String aNamespaceURI, String aLocalName) {\r
-    this (aNamespaceURI, null, aLocalName);\r
-  }\r
-\r
-  /**\r
-   * Returns the namespace URI if available\r
-   */\r
-  public String getNamespaceURI() {\r
-    return namespaceURI;\r
-  }\r
-\r
-  /**\r
-   * Returns the name of the tag, stripped from prefix\r
-   */\r
-  public String getLocalName() {\r
-    return localName;\r
-  }\r
-\r
-  /**\r
-   * Returns the prefix of the tag, if present\r
-   */\r
-  public String getPrefix() {\r
-    return prefix;\r
-  }\r
-\r
-  public int hashCode() {\r
-    if (namespaceURI == null)\r
-      return localName.hashCode() + 3*prefix.hashCode();\r
-    else\r
-      return localName.hashCode() + 3*namespaceURI.hashCode();\r
-  }\r
-\r
-  public String toString() {\r
-    return ((namespaceURI.length()>0)? "["+namespaceURI+"]":"")+((prefix.length()>0)?prefix+":":"")+localName;\r
-  }\r
-\r
-  public boolean equals(Object anObject) {\r
-    if (anObject instanceof mir.util.xml.XMLName) {\r
-      if (namespaceURI==null)\r
-        return (((mir.util.xml.XMLName) anObject).namespaceURI == null) &&\r
-               prefix.equals(((mir.util.xml.XMLName) anObject).prefix) &&\r
-               localName.equals(((mir.util.xml.XMLName) anObject).localName);\r
-      else\r
-        return namespaceURI.equals(((mir.util.xml.XMLName) anObject).namespaceURI) &&\r
-               localName.equals(((mir.util.xml.XMLName) anObject).localName);\r
-    }\r
-    else\r
-      return false;\r
-  }\r
-}\r
+package mir.util.xml;
+
+/**
+ * Class to encapsulate an XML-style name (either for tagnames,
+ * or attribute names).
+ *
+ * <p>
+ * Usage requirements:
+ * <ul>
+ *   <li> Namespace aware parsers must supply a local name
+ *        and a namespace URI
+ *   <li> Non-namespace aware parsers should supply a local name,
+ *        and, if present and applicable, also a prefix
+ * </ul>
+ */
+
+public class XMLName {
+  private String namespaceURI;
+  private String localName;
+  private String prefix;
+
+  public XMLName(String aLocalName) {
+    this(null, null, aLocalName);
+  }
+
+  public XMLName(String aNamespaceURI, String aPrefix, String aLocalName) {
+    localName="";
+    prefix="";
+    namespaceURI="";
+
+    if (aLocalName!=null)
+      localName = aLocalName;
+    if (aPrefix!=null)
+      prefix = aPrefix;
+    if (aNamespaceURI!=null)
+      namespaceURI = aNamespaceURI;
+  }
+
+  public XMLName(String aNamespaceURI, String aLocalName) {
+    this (aNamespaceURI, null, aLocalName);
+  }
+
+  /**
+   * Returns the namespace URI if available
+   */
+  public String getNamespaceURI() {
+    return namespaceURI;
+  }
+
+  /**
+   * Returns the name of the tag, stripped from prefix
+   */
+  public String getLocalName() {
+    return localName;
+  }
+
+  /**
+   * Returns the prefix of the tag, if present
+   */
+  public String getPrefix() {
+    return prefix;
+  }
+
+  public int hashCode() {
+    if (namespaceURI == null)
+      return localName.hashCode() + 3*prefix.hashCode();
+               return localName.hashCode() + 3*namespaceURI.hashCode();
+  }
+
+  public String toString() {
+    return ((namespaceURI.length()>0)? "["+namespaceURI+"]":"")+((prefix.length()>0)?prefix+":":"")+localName;
+  }
+
+  public boolean equals(Object anObject) {
+    if (anObject instanceof mir.util.xml.XMLName) {
+      if (namespaceURI==null)
+        return (((mir.util.xml.XMLName) anObject).namespaceURI == null) &&
+               prefix.equals(((mir.util.xml.XMLName) anObject).prefix) &&
+               localName.equals(((mir.util.xml.XMLName) anObject).localName);
+      else
+        return namespaceURI.equals(((mir.util.xml.XMLName) anObject).namespaceURI) &&
+               localName.equals(((mir.util.xml.XMLName) anObject).localName);
+    }
+               return false;
+  }
+}
index ee70a13..9b4d928 100755 (executable)
 package mir.util.xml;
 
 import java.io.BufferedInputStream;
+import java.io.File;
 import java.io.FileInputStream;
 import java.io.InputStream;
-import java.io.StringReader;
-import java.io.File;
-import java.io.Reader;
 import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringReader;
 import java.io.UnsupportedEncodingException;
 import java.util.HashMap;
 import java.util.Map;
-
 import java.util.Stack;
 
 import mir.util.ExceptionFunctions;
index b96d451..e6c0b66 100755 (executable)
@@ -1,20 +1,25 @@
-package mir.util.xml;\r
-\r
-/**\r
- *\r
- * <p>Title: </p>\r
- * <p>Description: </p>\r
- * <p>Copyright: Copyright (c) 2003</p>\r
- * <p>Company: </p>\r
- * @author not attributable\r
- * @version 1.0\r
- */\r
-public class XMLParserFailure extends multex.Failure {\r
-  public XMLParserFailure(String aMessage, Throwable aCause) {\r
-    super(aMessage, aCause);\r
-  }\r
-\r
-  public XMLParserFailure(Throwable aCause) {\r
-    super(aCause.getMessage(), aCause);\r
-  }\r
-}\r
+package mir.util.xml;
+
+/**
+ *
+ * <p>Title: </p>
+ * <p>Description: </p>
+ * <p>Copyright: Copyright (c) 2003</p>
+ * <p>Company: </p>
+ * @author not attributable
+ * @version 1.0
+ */
+public class XMLParserFailure extends multex.Failure {
+  /**
+        * Comment for <code>serialVersionUID</code>
+        */
+       private static final long serialVersionUID = 1L;
+
+       public XMLParserFailure(String aMessage, Throwable aCause) {
+    super(aMessage, aCause);
+  }
+
+  public XMLParserFailure(Throwable aCause) {
+    super(aCause.getMessage(), aCause);
+  }
+}
index fb4859d..84fa8b4 100755 (executable)
@@ -120,8 +120,7 @@ public class XMLReaderTool {
 
     if (parts.size()==1)
       return (String) parts.get(0);
-    else
-      return (String) parts.get(1);
+               return (String) parts.get(1);
   }
 
   /**
index 0e8a851..c5ee60a 100755 (executable)
-package mir.util.xml;\r
-\r
-import java.util.*;\r
-\r
-import org.xml.sax.InputSource;\r
-import org.xml.sax.SAXException;\r
-import org.xml.sax.Locator;\r
-import org.xml.sax.SAXParseException;\r
-import mir.util.ExceptionFunctions;\r
-\r
-/**\r
- *\r
- * <p>Title: </p>\r
- * <p>Description: </p>\r
- * <p>Copyright: Copyright (c) 2003</p>\r
- * <p>Company: </p>\r
- * @author not attributable\r
- * @version 1.0\r
- */\r
-class XMLSAXParserProvider implements XMLParserEngine.XMLParserProvider {\r
-  private boolean nameSpaceAware;\r
-\r
-  public XMLSAXParserProvider(boolean aNameSpaceAware) {\r
-    nameSpaceAware = aNameSpaceAware;\r
-  }\r
-\r
-  public void parse(java.io.Reader aReader, XMLParserEngine.XMLParserReceiver aReceiver) throws XMLParserExc, XMLParserFailure {\r
-    try {\r
-      javax.xml.parsers.SAXParserFactory parserFactory = javax.xml.parsers.SAXParserFactory.newInstance();\r
-\r
-      parserFactory.setNamespaceAware(true);\r
-      parserFactory.setValidating(true);\r
-      javax.xml.parsers.SAXParser parser = parserFactory.newSAXParser();\r
-\r
-      parser.parse(new InputSource(aReader), new SAXHandler(aReceiver));\r
-    }\r
-    catch (org.xml.sax.SAXException e) {\r
-      Throwable t = ExceptionFunctions.traceCauseException(e);\r
-\r
-      if (t instanceof XMLParserExc) {\r
-        throw (XMLParserExc) t;\r
-      }\r
-\r
-      if (t instanceof XMLParserFailure) {\r
-        throw (XMLParserFailure) t;\r
-      }\r
-\r
-      if (t instanceof SAXParseException) {\r
-        throw new XMLParserExc(t.getMessage());\r
-      }\r
-\r
-      throw new XMLParserFailure(t);\r
-    }\r
-    catch (Throwable t) {\r
-      throw new XMLParserFailure(t);\r
-    }\r
-  }\r
-\r
-  private class SAXHandler extends org.xml.sax.helpers.DefaultHandler {\r
-    private XMLParserEngine.XMLParserReceiver receiver;\r
-\r
-    public SAXHandler(XMLParserEngine.XMLParserReceiver aReceiver) throws XMLParserExc, XMLParserFailure {\r
-      super();\r
-\r
-      receiver = aReceiver;\r
-      receiver.startDocument();\r
-   }\r
-\r
-    public void setDocumentLocator(final Locator aLocator) {\r
-      receiver.setLocator(\r
-          new XMLParserEngine.XMLLocator() {\r
-            public int getLineNr() {\r
-              return aLocator.getLineNumber();\r
-            }\r
-\r
-            public int getColumnNr() {\r
-              return aLocator.getColumnNumber();\r
-            }\r
-          }\r
-      );\r
-    }\r
-\r
-    public void startElement(String aUri, String aLocalName, String aQualifiedName, org.xml.sax.Attributes anAttributes) throws org.xml.sax.SAXException {\r
-      try {\r
-        Map attributes = new java.util.HashMap();\r
-\r
-        XMLName tag;\r
-        if (nameSpaceAware) {\r
-          tag = new XMLName(aUri, XMLReaderTool.getPrefixFromQualifiedName(aQualifiedName), aLocalName);\r
-          for (int i=0; i<anAttributes.getLength(); i++)\r
-            attributes.put(\r
-                new XMLName(anAttributes.getURI(i),\r
-                            XMLReaderTool.getPrefixFromQualifiedName(anAttributes.getQName(i)),\r
-                            anAttributes.getLocalName(i)),\r
-                anAttributes.getValue(i));\r
-        }\r
-        else {\r
-          tag = new XMLName(aUri, XMLReaderTool.getPrefixFromQualifiedName(aQualifiedName),\r
-                      XMLReaderTool.getLocalNameFromQualifiedName(aQualifiedName));\r
-          for (int i=0; i<anAttributes.getLength(); i++)\r
-            attributes.put(\r
-                new XMLName(anAttributes.getURI(i),\r
-                           XMLReaderTool.getPrefixFromQualifiedName(anAttributes.getQName(i)),\r
-                           XMLReaderTool.getLocalNameFromQualifiedName(anAttributes.getQName(i))),\r
-                anAttributes.getValue(i));\r
-        }\r
-\r
-        receiver.startElement(tag, attributes);\r
-      }\r
-      catch (XMLParserExc e) {\r
-        throw new org.xml.sax.SAXParseException(e.getMessage(), null, e);\r
-      }\r
-      catch (Exception e) {\r
-        throw new SAXException(e);\r
-      }\r
-    }\r
-\r
-    public void endElement(String aUri, String aLocalName, String aQualifiedName) throws org.xml.sax.SAXException {\r
-      try\r
-      {\r
-        XMLName element = new XMLName(aUri, XMLReaderTool.getPrefixFromQualifiedName(aQualifiedName), aLocalName);\r
-\r
-        receiver.endElement(element);\r
-      }\r
-      catch (XMLParserExc e) {\r
-        throw new org.xml.sax.SAXParseException(e.getMessage(), null, e);\r
-      }\r
-      catch (Exception e) {\r
-        throw new org.xml.sax.SAXException(e);\r
-      }\r
-    }\r
-\r
-    public void endDocument() throws org.xml.sax.SAXException {\r
-      try\r
-      {\r
-        receiver.endDocument();\r
-      }\r
-      catch (XMLParserExc e) {\r
-        throw new org.xml.sax.SAXParseException(e.getMessage(), null, e);\r
-      }\r
-      catch (Exception e) {\r
-        throw new org.xml.sax.SAXException(e);\r
-      }\r
-    }\r
-\r
-    public void characters(char[] aBuffer, int aStart, int anEnd) throws org.xml.sax.SAXException {\r
-      try {\r
-        String text = new String(aBuffer, aStart, anEnd);\r
-\r
-        receiver.text(text);\r
-      }\r
-      catch (XMLParserExc e) {\r
-        throw new org.xml.sax.SAXParseException(e.getMessage(), null, e);\r
-      }\r
-      catch (Exception e) {\r
-        throw new org.xml.sax.SAXException(e);\r
-      }\r
-    }\r
-  }\r
-}\r
+package mir.util.xml;
+
+import java.util.Map;
+
+import mir.util.ExceptionFunctions;
+
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ *
+ * <p>Title: </p>
+ * <p>Description: </p>
+ * <p>Copyright: Copyright (c) 2003</p>
+ * <p>Company: </p>
+ * @author not attributable
+ * @version 1.0
+ */
+class XMLSAXParserProvider implements XMLParserEngine.XMLParserProvider {
+  private boolean nameSpaceAware;
+
+  public XMLSAXParserProvider(boolean aNameSpaceAware) {
+    nameSpaceAware = aNameSpaceAware;
+  }
+
+  public void parse(java.io.Reader aReader, XMLParserEngine.XMLParserReceiver aReceiver) throws XMLParserExc, XMLParserFailure {
+    try {
+      javax.xml.parsers.SAXParserFactory parserFactory = javax.xml.parsers.SAXParserFactory.newInstance();
+
+      parserFactory.setNamespaceAware(true);
+      parserFactory.setValidating(true);
+      javax.xml.parsers.SAXParser parser = parserFactory.newSAXParser();
+
+      parser.parse(new InputSource(aReader), new SAXHandler(aReceiver));
+    }
+    catch (org.xml.sax.SAXException e) {
+      Throwable t = ExceptionFunctions.traceCauseException(e);
+
+      if (t instanceof XMLParserExc) {
+        throw (XMLParserExc) t;
+      }
+
+      if (t instanceof XMLParserFailure) {
+        throw (XMLParserFailure) t;
+      }
+
+      if (t instanceof SAXParseException) {
+        throw new XMLParserExc(t.getMessage());
+      }
+
+      throw new XMLParserFailure(t);
+    }
+    catch (Throwable t) {
+      throw new XMLParserFailure(t);
+    }
+  }
+
+  private class SAXHandler extends org.xml.sax.helpers.DefaultHandler {
+    private XMLParserEngine.XMLParserReceiver receiver;
+
+    public SAXHandler(XMLParserEngine.XMLParserReceiver aReceiver) throws XMLParserExc, XMLParserFailure {
+      super();
+
+      receiver = aReceiver;
+      receiver.startDocument();
+   }
+
+    public void setDocumentLocator(final Locator aLocator) {
+      receiver.setLocator(
+          new XMLParserEngine.XMLLocator() {
+            public int getLineNr() {
+              return aLocator.getLineNumber();
+            }
+
+            public int getColumnNr() {
+              return aLocator.getColumnNumber();
+            }
+          }
+      );
+    }
+
+    public void startElement(String aUri, String aLocalName, String aQualifiedName, org.xml.sax.Attributes anAttributes) throws org.xml.sax.SAXException {
+      try {
+        Map attributes = new java.util.HashMap();
+
+        XMLName tag;
+        if (nameSpaceAware) {
+          tag = new XMLName(aUri, XMLReaderTool.getPrefixFromQualifiedName(aQualifiedName), aLocalName);
+          for (int i=0; i<anAttributes.getLength(); i++)
+            attributes.put(
+                new XMLName(anAttributes.getURI(i),
+                            XMLReaderTool.getPrefixFromQualifiedName(anAttributes.getQName(i)),
+                            anAttributes.getLocalName(i)),
+                anAttributes.getValue(i));
+        }
+        else {
+          tag = new XMLName(aUri, XMLReaderTool.getPrefixFromQualifiedName(aQualifiedName),
+                      XMLReaderTool.getLocalNameFromQualifiedName(aQualifiedName));
+          for (int i=0; i<anAttributes.getLength(); i++)
+            attributes.put(
+                new XMLName(anAttributes.getURI(i),
+                           XMLReaderTool.getPrefixFromQualifiedName(anAttributes.getQName(i)),
+                           XMLReaderTool.getLocalNameFromQualifiedName(anAttributes.getQName(i))),
+                anAttributes.getValue(i));
+        }
+
+        receiver.startElement(tag, attributes);
+      }
+      catch (XMLParserExc e) {
+        throw new org.xml.sax.SAXParseException(e.getMessage(), null, e);
+      }
+      catch (Exception e) {
+        throw new SAXException(e);
+      }
+    }
+
+    public void endElement(String aUri, String aLocalName, String aQualifiedName) throws org.xml.sax.SAXException {
+      try
+      {
+        XMLName element = new XMLName(aUri, XMLReaderTool.getPrefixFromQualifiedName(aQualifiedName), aLocalName);
+
+        receiver.endElement(element);
+      }
+      catch (XMLParserExc e) {
+        throw new org.xml.sax.SAXParseException(e.getMessage(), null, e);
+      }
+      catch (Exception e) {
+        throw new org.xml.sax.SAXException(e);
+      }
+    }
+
+    public void endDocument() throws org.xml.sax.SAXException {
+      try
+      {
+        receiver.endDocument();
+      }
+      catch (XMLParserExc e) {
+        throw new org.xml.sax.SAXParseException(e.getMessage(), null, e);
+      }
+      catch (Exception e) {
+        throw new org.xml.sax.SAXException(e);
+      }
+    }
+
+    public void characters(char[] aBuffer, int aStart, int anEnd) throws org.xml.sax.SAXException {
+      try {
+        String text = new String(aBuffer, aStart, anEnd);
+
+        receiver.text(text);
+      }
+      catch (XMLParserExc e) {
+        throw new org.xml.sax.SAXParseException(e.getMessage(), null, e);
+      }
+      catch (Exception e) {
+        throw new org.xml.sax.SAXException(e);
+      }
+    }
+  }
+}
index 669a9bd..8ffcf18 100755 (executable)
@@ -1,7 +1,11 @@
 package mir.util.xml.html;
 
-import java.io.*;
-import java.util.*;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Stack;
 
 /**
  *
index 1c6ff42..dd8c990 100755 (executable)
@@ -115,8 +115,7 @@ public class HTMLScanner {
 
     if (result.length()==0)
       return null;
-    else
-      return result.toString();
+               return result.toString();
   }
 
   private String getAttributeValue() throws IOException {
@@ -218,9 +217,7 @@ public class HTMLScanner {
 
         return;
       }
-      else {
-        result.append('-');
-      }
+                       result.append('-');
     }
 
     while (!reader.isAtEnd() && reader.peek()!='>') {
index 5856214..8250d22 100755 (executable)
@@ -1,6 +1,9 @@
 package mir.util.xml.html;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 public class HTMLSchemaInformation {
   private Map tags;
index 31bcc85..8b19693 100755 (executable)
@@ -1,96 +1,96 @@
-package mir.util.xml.html;\r
-\r
-import java.io.IOException;\r
-import java.util.HashMap;\r
-import java.util.Iterator;\r
-import java.util.Map;\r
-\r
-import mir.util.xml.XMLParserEngine;\r
-import mir.util.xml.XMLParserExc;\r
-import mir.util.xml.XMLParserFailure;\r
-import mir.util.xml.XMLReaderTool;\r
-import mir.util.xml.XMLName;\r
-\r
-/**\r
- */\r
-\r
-public class XMLHTMLParserProvider implements XMLParserEngine.XMLParserProvider {\r
-  public XMLHTMLParserProvider() {\r
-  }\r
-\r
-  public void parse(java.io.Reader aReader, final XMLParserEngine.XMLParserReceiver aReceiver) throws XMLParserExc, XMLParserFailure {\r
-    HTMLParser parser = new HTMLParser();\r
-\r
-    try {\r
-      aReceiver.startDocument();\r
-\r
-      parser.parse(aReader, new HTMLParser.ParserReceiver() {\r
-        public void dtd(String aDTD) throws HTMLParserExc {\r
-          try {\r
-            aReceiver.extra(aDTD);\r
-          }\r
-          catch (XMLParserExc t) {\r
-            throw new HTMLParserFailure(t);\r
-          }\r
-        }\r
-\r
-        public void openTag(String aTag, Map anAttributes) {\r
-          Map attributes = new HashMap();\r
-          Iterator i = anAttributes.entrySet().iterator();\r
-\r
-          while (i.hasNext()) {\r
-            Map.Entry entry = (Map.Entry) i.next();\r
-            XMLName key = XMLReaderTool.getXMLNameForQualifiedName((String) entry.getKey());\r
-            String value = (String) entry.getValue();\r
-            if (value==null)\r
-              value = key.getLocalName();\r
-\r
-            attributes.put(key, value);\r
-          }\r
-\r
-          try {\r
-            aReceiver.startElement(XMLReaderTool.getXMLNameForQualifiedName(aTag), attributes);\r
-          }\r
-          catch (XMLParserExc e) {\r
-            throw new HTMLParserFailure(e);\r
-          }\r
-        }\r
-\r
-        public void closeTag(String aTag) {\r
-          try {\r
-            aReceiver.endElement(XMLReaderTool.getXMLNameForQualifiedName(aTag));\r
-          }\r
-          catch (XMLParserExc e) {\r
-            throw new HTMLParserFailure(e);\r
-          }\r
-        }\r
-\r
-        public void comment(String aData) {\r
-          try {\r
-            aReceiver.extra("<!--"+aData+"-->");\r
-          }\r
-          catch (XMLParserExc e) {\r
-            throw new HTMLParserFailure(e);\r
-          }\r
-        }\r
-\r
-        public void cdata(String aData) {\r
-          try {\r
-            aReceiver.text(aData);\r
-          }\r
-          catch (XMLParserExc e) {\r
-            throw new HTMLParserFailure(e);\r
-          }\r
-        }\r
-      });\r
-\r
-      aReceiver.endDocument();\r
-    }\r
-    catch (IOException e) {\r
-      throw new XMLParserFailure(e);\r
-    }\r
-    catch (HTMLParserExc e) {\r
-      throw new XMLParserFailure(e);\r
-    }\r
-  }\r
-}\r
+package mir.util.xml.html;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import mir.util.xml.XMLName;
+import mir.util.xml.XMLParserEngine;
+import mir.util.xml.XMLParserExc;
+import mir.util.xml.XMLParserFailure;
+import mir.util.xml.XMLReaderTool;
+
+/**
+ */
+
+public class XMLHTMLParserProvider implements XMLParserEngine.XMLParserProvider {
+  public XMLHTMLParserProvider() {
+  }
+
+  public void parse(java.io.Reader aReader, final XMLParserEngine.XMLParserReceiver aReceiver) throws XMLParserExc, XMLParserFailure {
+    HTMLParser parser = new HTMLParser();
+
+    try {
+      aReceiver.startDocument();
+
+      parser.parse(aReader, new HTMLParser.ParserReceiver() {
+        public void dtd(String aDTD) throws HTMLParserExc {
+          try {
+            aReceiver.extra(aDTD);
+          }
+          catch (XMLParserExc t) {
+            throw new HTMLParserFailure(t);
+          }
+        }
+
+        public void openTag(String aTag, Map anAttributes) {
+          Map attributes = new HashMap();
+          Iterator i = anAttributes.entrySet().iterator();
+
+          while (i.hasNext()) {
+            Map.Entry entry = (Map.Entry) i.next();
+            XMLName key = XMLReaderTool.getXMLNameForQualifiedName((String) entry.getKey());
+            String value = (String) entry.getValue();
+            if (value==null)
+              value = key.getLocalName();
+
+            attributes.put(key, value);
+          }
+
+          try {
+            aReceiver.startElement(XMLReaderTool.getXMLNameForQualifiedName(aTag), attributes);
+          }
+          catch (XMLParserExc e) {
+            throw new HTMLParserFailure(e);
+          }
+        }
+
+        public void closeTag(String aTag) {
+          try {
+            aReceiver.endElement(XMLReaderTool.getXMLNameForQualifiedName(aTag));
+          }
+          catch (XMLParserExc e) {
+            throw new HTMLParserFailure(e);
+          }
+        }
+
+        public void comment(String aData) {
+          try {
+            aReceiver.extra("<!--"+aData+"-->");
+          }
+          catch (XMLParserExc e) {
+            throw new HTMLParserFailure(e);
+          }
+        }
+
+        public void cdata(String aData) {
+          try {
+            aReceiver.text(aData);
+          }
+          catch (XMLParserExc e) {
+            throw new HTMLParserFailure(e);
+          }
+        }
+      });
+
+      aReceiver.endDocument();
+    }
+    catch (IOException e) {
+      throw new XMLParserFailure(e);
+    }
+    catch (HTMLParserExc e) {
+      throw new XMLParserFailure(e);
+    }
+  }
+}
index 7a61c85..56c7216 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with  any library licensed under the Apache Software License,\r
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library\r
- * (or with modified versions of the above that use the same license as the above),\r
- * and distribute linked combinations including the two.  You must obey the\r
- * GNU General Public License in all respects for all of the code used other than\r
- * the above mentioned libraries.  If you modify this file, you may extend this\r
- * exception to your version of the file, but you are not obligated to do so.\r
- * If you do not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.abuse;\r
-\r
-import mir.entity.Entity;\r
-import mir.entity.adapter.EntityAdapter;\r
-import mir.entity.adapter.EntityAdapterModel;\r
-import mir.entity.adapter.EntityIteratorAdapter;\r
-import mir.log.LoggerWrapper;\r
-import mir.storage.StorageObjectExc;\r
-import mir.session.Request;\r
-import mir.config.MirPropertiesConfiguration;\r
-import mircoders.storage.DatabaseFilter;\r
-import mircoders.storage.DatabaseFilterGroup;\r
-import mircoders.global.MirGlobal;\r
-\r
-import java.util.*;\r
-import java.text.SimpleDateFormat;\r
-\r
-public class FilterEngine {\r
-  private Map filterTypes;\r
-  private List filterTypeIds;\r
-\r
-  private List filterGroups;\r
-  private Map idToFilterGroup;\r
-  private LoggerWrapper logger;\r
-  private EntityAdapterModel model;\r
-  private SimpleDateFormat dateFormat;\r
-  private MirPropertiesConfiguration configuration = MirPropertiesConfiguration.instance();\r
-\r
-  public FilterEngine(EntityAdapterModel aModel) {\r
-    logger = new LoggerWrapper("Global.Abuse.FilterEngine");\r
-    filterGroups = new ArrayList();\r
-    idToFilterGroup = new HashMap();\r
-\r
-    filterTypes = new HashMap();\r
-    filterTypeIds = new ArrayList();\r
-    try {\r
-      Iterator i = MirGlobal.localizer().openPostings().getAntiAbuseFilterTypes().iterator();\r
-      while (i.hasNext()) {\r
-        FilterType filterType = (FilterType) i.next();\r
-\r
-        filterTypes.put(filterType.getName(), filterType);\r
-        filterTypeIds.add(filterType.getName());\r
-      }\r
-    }\r
-    catch (Throwable t) {\r
-      throw new RuntimeException(t.getMessage());\r
-    }\r
-\r
-    model = aModel;\r
-\r
-    dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");\r
-    dateFormat.setTimeZone(TimeZone.getTimeZone(configuration.getString("Mir.DefaultTimezone")));\r
-    reload();\r
-  }\r
-\r
-  public Filter testPosting(Entity anEntity, Request aRequest) {\r
-    Iterator i = filterGroups.iterator();\r
-    while (i.hasNext()) {\r
-      FilterGroup group = (FilterGroup) i.next();\r
-      Iterator j = group.getFilters().iterator();\r
-      while (j.hasNext()) {\r
-        Filter filter = (Filter) j.next();\r
-        try {\r
-          if (filter.test(anEntity, aRequest)) {\r
-            return filter;\r
-          }\r
-        }\r
-        catch (Throwable t) {\r
-          logger.warn("Exception thrown while testing filter " + filter.getType() + " ( " + filter.getExpression() + ") " + t.toString());\r
-        }\r
-      }\r
-    }\r
-\r
-    return null;\r
-  }\r
-\r
-  public List getFilterTypes() {\r
-    try {\r
-      List result = new ArrayList();\r
-\r
-      Iterator i = filterTypeIds.iterator();\r
-      while (i.hasNext()) {\r
-        String id = (String) i.next();\r
-\r
-        Map action = new HashMap();\r
-        action.put("resource", id);\r
-        action.put("identifier", id);\r
-\r
-        result.add(action);\r
-      }\r
-\r
-      return result;\r
-    }\r
-    catch (Throwable t) {\r
-      throw new RuntimeException("can't get article actions");\r
-    }\r
-  }\r
-\r
-  public class FilterGroup {\r
-    private List filters;\r
-    private Entity entity;\r
-    private Map idToFilter;\r
-\r
-    public FilterGroup(Entity anEntity) {\r
-      this (anEntity, Collections.EMPTY_LIST);\r
-    }\r
-\r
-    public FilterGroup(Entity anEntity, List aFilters) {\r
-      entity = anEntity;\r
-      filters = new ArrayList();\r
-      idToFilter = new HashMap();\r
-      Iterator i = aFilters.iterator();\r
-\r
-      while (i.hasNext()) {\r
-        Entity entity = (Entity) i.next();\r
-        try {\r
-          Filter filter = new Filter(entity);\r
-          introduceFilter(filter);\r
-        }\r
-        catch (AbuseExc e) {\r
-        }\r
-      }\r
-    }\r
-\r
-    public Entity getEntity() {\r
-      return entity;\r
-    }\r
-\r
-    public EntityAdapter getEntityAdapter() {\r
-      return model.makeEntityAdapter("filterGroup",  entity);\r
-    }\r
-\r
-    public List getFilterEntityAdapterList() {\r
-      List result = new ArrayList();\r
-\r
-      Iterator i = filters.iterator();\r
-      while (i.hasNext()) {\r
-        Filter filter = (Filter) i.next();\r
-        result.add(filter.getEntityAdapter());\r
-      }\r
-\r
-      return result;\r
-    }\r
-\r
-    public List getFilters() {\r
-      return filters;\r
-    }\r
-\r
-    public Filter getFilterForId(String anId) {\r
-      Filter result = (Filter) idToFilter.get(anId);\r
-      if (result==null) {\r
-        throw new NullPointerException("No such filter");\r
-      }\r
-\r
-      return result;\r
-    }\r
-\r
-    private void introduceFilter(Filter aFilter) {\r
-      filters.add(aFilter);\r
-      idToFilter.put(aFilter.getEntity().getId(), aFilter);\r
-    }\r
-\r
-    private void removeFilter(Filter aFilter) {\r
-      filters.remove(aFilter);\r
-      idToFilter.remove(aFilter.getEntity().getId());\r
-    }\r
-\r
-    private void deleteFilter(String anId) {\r
-      Filter filter = getFilterForId(anId);\r
-      removeFilter(filter);\r
-      DatabaseFilter.getInstance().delete(anId);\r
-    }\r
-\r
-    public void populateFilterEntity(Entity anEntity, String aType, String anExpression,\r
-                             String aComments, String aTag, String anArticleAction,\r
-                             String aCommentAction) {\r
-\r
-      anEntity.setFieldValue("type", aType);\r
-      anEntity.setFieldValue("expression", anExpression);\r
-      anEntity.setFieldValue("comment", aComments);\r
-      anEntity.setFieldValue("tag", aTag);\r
-      anEntity.setFieldValue("articleaction", anArticleAction);\r
-      anEntity.setFieldValue("commentaction", aCommentAction);\r
-    }\r
-\r
-    public String updateFilter(String anId, String aType, String anExpression,\r
-                             String aComments, String aTag, String anArticleAction,\r
-                             String aCommentAction) {\r
-\r
-      try {\r
-        getFilterTypeForId(aType).constructFilterInstance(anExpression);\r
-      }\r
-      catch (AbuseExc e) {\r
-        return e.getMessage();\r
-      }\r
-\r
-      Entity entity = getFilterForId(anId).getEntity();\r
-      populateFilterEntity(entity, aType, anExpression, aComments, aTag,\r
-          anArticleAction, aCommentAction);\r
-      entity.update();\r
-\r
-      return "";\r
-    }\r
-\r
-    public String createFilter(String aType, String anExpression,\r
-                             String aComments, String aTag, String anArticleAction,\r
-                             String aCommentAction) throws StorageObjectExc {\r
-      FilterInstance instance;\r
-\r
-      try {\r
-        instance = getFilterTypeForId(aType).constructFilterInstance(anExpression);\r
-      }\r
-      catch (AbuseExc e) {\r
-        return e.getMessage();\r
-      }\r
-\r
-      Entity entity = DatabaseFilter.getInstance().createNewEntity();\r
-      populateFilterEntity(entity, aType, anExpression, aComments, aTag,\r
-          anArticleAction, aCommentAction);\r
-      entity.setFieldValue("priority", "1");\r
-      entity.setFieldValue("filter_group_id", getEntity().getId());\r
-      entity.insert();\r
-\r
-      Filter filter = new Filter(entity, instance);\r
-      introduceFilter(filter);\r
-\r
-      return "";\r
-    }\r
-\r
-    public String getName() {\r
-      return entity.getFieldValue("name");\r
-    }\r
-  }\r
-\r
-  public class Filter {\r
-    private Entity entity;\r
-    private FilterInstance instance;\r
-\r
-    public Filter(Entity anEntity) throws AbuseExc {\r
-      this(anEntity, getFilterTypeForId(anEntity.getFieldValue("type")).constructFilterInstance(anEntity.getFieldValue("expression")));\r
-    }\r
-\r
-    public Filter(Entity anEntity, FilterInstance anInstance) {\r
-      entity = anEntity;\r
-      instance = anInstance;\r
-    }\r
-\r
-    public Entity getEntity() {\r
-      return entity;\r
-    }\r
-\r
-    public EntityAdapter getEntityAdapter() {\r
-      return model.makeEntityAdapter("filter", entity);\r
-    }\r
-\r
-    public void update(String aType, String anExpression, String aComments, String aTag,\r
-                       String anArticleAction, String aCommentAction) throws AbuseExc {\r
-\r
-      instance = getFilterTypeForId(aType).constructFilterInstance(anExpression);\r
-\r
-      entity.setFieldValue("type", aType);\r
-      entity.setFieldValue("expression", anExpression);\r
-      entity.setFieldValue("tag", aType);\r
-      entity.setFieldValue("comment", aComments);\r
-      entity.setFieldValue("articleaction", anArticleAction);\r
-      entity.setFieldValue("commentaction", aCommentAction);\r
-      entity.setFieldValue("last_hit", null);\r
-      entity.update();\r
-   }\r
-\r
-    public void updateLastHit(Date aDate) {\r
-      entity.setFieldValue("last_hit", dateFormat.format(aDate));\r
-      entity.update();\r
-    }\r
-\r
-    public String getType() {\r
-      return entity.getFieldValue("type");\r
-    }\r
-\r
-    public String getExpression() {\r
-      return entity.getFieldValue("expression");\r
-    }\r
-\r
-    public String getTag() {\r
-      return entity.getFieldValue("tag");\r
-    }\r
-\r
-    public String getComment() {\r
-      return entity.getFieldValue("comment");\r
-    }\r
-\r
-    public String getArticleAction() {\r
-      return entity.getFieldValue("articleaction");\r
-    }\r
-\r
-    public String getCommentAction() {\r
-      return entity.getFieldValue("commentaction");\r
-    }\r
-\r
-    public FilterInstance getInstance() {\r
-      return instance;\r
-    }\r
-\r
-    public boolean test(Entity anEntity, Request aRequest) {\r
-      return instance.test(anEntity, aRequest);\r
-    }\r
-  }\r
-\r
-  public synchronized void reload() {\r
-    filterGroups.clear();\r
-    idToFilterGroup.clear();\r
-\r
-    try {\r
-      Iterator i = new EntityIteratorAdapter("", "priority asc", 100, model, "filterGroup");\r
-      while (i.hasNext()) {\r
-        EntityAdapter entityAdapter = (EntityAdapter) i.next();\r
-        List filters = new ArrayList();\r
-        Iterator j = (Iterator) entityAdapter.get("to_filters");\r
-        while (j.hasNext()) {\r
-          filters.add(((EntityAdapter) j.next()).getEntity());\r
-        }\r
-\r
-        FilterGroup filterGroup = new FilterGroup(entityAdapter.getEntity(), filters);\r
-        introduceFilterGroup(filterGroup);\r
-      }\r
-    }\r
-    catch (Throwable e) {\r
-      logger.error("Can't load filters: " + e.getMessage());\r
-    }\r
-  }\r
-\r
-  public synchronized List getFilterGroups() {\r
-    List result = new ArrayList();\r
-    Iterator i = filterGroups.iterator();\r
-    while (i.hasNext()) {\r
-      result.add(((FilterGroup) i.next()).getEntityAdapter());\r
-    }\r
-\r
-    return result;\r
-  }\r
-\r
-  public synchronized void updateFilterGroup(String anId, String aName) {\r
-    FilterGroup filterGroup = getFilterGroupForId(anId);\r
-    filterGroup.getEntity().setFieldValue("name", aName);\r
-    filterGroup.getEntity().update();\r
-  }\r
-\r
-  public synchronized void addFilterGroup(String aName) throws StorageObjectExc {\r
-    Entity entity = DatabaseFilterGroup.getInstance().createNewEntity();\r
-    entity.setFieldValue("name", aName);\r
-    entity.setFieldValue("priority", "1");\r
-    entity.insert();\r
-\r
-    FilterGroup filterGroup = new FilterGroup(entity);\r
-    introduceFilterGroup(filterGroup);\r
-  }\r
-\r
-  public synchronized void deleteFilterGroup(String anId) {\r
-\r
-    FilterGroup filterGroup = getFilterGroupForId(anId);\r
-    removeFilterGroup(filterGroup);\r
-    DatabaseFilter.getInstance().deleteByWhereClause("filter_group_id = " + anId);\r
-    DatabaseFilterGroup.getInstance().delete(anId);\r
-  }\r
-\r
-  public synchronized void deleteFilter(String aGroupId, String anId) {\r
-    getFilterGroupForId(aGroupId).deleteFilter(anId);\r
-  }\r
-\r
-\r
-  public synchronized String updateFilter(String aGroupId, String anId,\r
-                                        String aType, String anExpression,\r
-                                        String aComments,\r
-                                        String aTag,\r
-                                        String anArticleAction,\r
-                                        String aCommentAction) {\r
-    return getFilterGroupForId(aGroupId).updateFilter(anId, aType,\r
-        anExpression, aComments, aTag, anArticleAction, aCommentAction);\r
-  }\r
-\r
-  public synchronized String addFilter(String aGroupId,\r
-                                       String aType, String anExpression,\r
-                                       String aComments,\r
-                                       String aTag,\r
-                                       String anArticleAction,\r
-                                       String aCommentAction) throws StorageObjectExc {\r
-    return getFilterGroupForId(aGroupId).createFilter(aType, anExpression,\r
-        aComments, aTag, anArticleAction, aCommentAction);\r
-  }\r
-\r
-\r
-  public FilterGroup getFilterGroupForId(String anId) {\r
-    FilterGroup result = (FilterGroup) idToFilterGroup.get(anId);\r
-    if (result == null) {\r
-      throw new NullPointerException("No such filter group");\r
-    }\r
-\r
-    return result;\r
-  }\r
-\r
-  public Filter getFilterForId(String aGroupId, String anId) {\r
-    return getFilterGroupForId(aGroupId).getFilterForId(anId);\r
-  }\r
-\r
-\r
-  public List getFilters(String aFilterGroupId) {\r
-    return getFilterGroupForId(aFilterGroupId).getFilterEntityAdapterList();\r
-  }\r
-\r
-  private void introduceFilterGroup(FilterGroup aFilterGroup) {\r
-    filterGroups.add(aFilterGroup);\r
-    idToFilterGroup.put(aFilterGroup.getEntity().getId(), aFilterGroup);\r
-  }\r
-\r
-  private void removeFilterGroup(FilterGroup aFilterGroup) {\r
-    filterGroups.remove(aFilterGroup);\r
-    idToFilterGroup.remove(aFilterGroup.getEntity().getId());\r
-  }\r
-\r
-  private FilterType getFilterTypeForId(String anId) {\r
-    return (FilterType) filterTypes.get(anId);\r
-  }\r
-}\r
+/*
+ * 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.abuse;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TimeZone;
+
+import mir.config.MirPropertiesConfiguration;
+import mir.entity.Entity;
+import mir.entity.adapter.EntityAdapter;
+import mir.entity.adapter.EntityAdapterModel;
+import mir.entity.adapter.EntityIteratorAdapter;
+import mir.log.LoggerWrapper;
+import mir.session.Request;
+import mir.storage.StorageObjectExc;
+import mircoders.global.MirGlobal;
+import mircoders.storage.DatabaseFilter;
+import mircoders.storage.DatabaseFilterGroup;
+
+public class FilterEngine {
+  private Map filterTypes;
+  private List filterTypeIds;
+
+  private List filterGroups;
+  private Map idToFilterGroup;
+  private LoggerWrapper logger;
+  private EntityAdapterModel model;
+  private SimpleDateFormat dateFormat;
+  private MirPropertiesConfiguration configuration = MirPropertiesConfiguration.instance();
+
+  public FilterEngine(EntityAdapterModel aModel) {
+    logger = new LoggerWrapper("Global.Abuse.FilterEngine");
+    filterGroups = new ArrayList();
+    idToFilterGroup = new HashMap();
+
+    filterTypes = new HashMap();
+    filterTypeIds = new ArrayList();
+    try {
+      Iterator i = MirGlobal.localizer().openPostings().getAntiAbuseFilterTypes().iterator();
+      while (i.hasNext()) {
+        FilterType filterType = (FilterType) i.next();
+
+        filterTypes.put(filterType.getName(), filterType);
+        filterTypeIds.add(filterType.getName());
+      }
+    }
+    catch (Throwable t) {
+      throw new RuntimeException(t.getMessage());
+    }
+
+    model = aModel;
+
+    dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+    dateFormat.setTimeZone(TimeZone.getTimeZone(configuration.getString("Mir.DefaultTimezone")));
+    reload();
+  }
+
+  public Filter testPosting(Entity anEntity, Request aRequest) {
+    Iterator i = filterGroups.iterator();
+    while (i.hasNext()) {
+      FilterGroup group = (FilterGroup) i.next();
+      Iterator j = group.getFilters().iterator();
+      while (j.hasNext()) {
+        Filter filter = (Filter) j.next();
+        try {
+          if (filter.test(anEntity, aRequest)) {
+            return filter;
+          }
+        }
+        catch (Throwable t) {
+          logger.warn("Exception thrown while testing filter " + filter.getType() + " ( " + filter.getExpression() + ") " + t.toString());
+        }
+      }
+    }
+
+    return null;
+  }
+
+  public List getFilterTypes() {
+    try {
+      List result = new ArrayList();
+
+      Iterator i = filterTypeIds.iterator();
+      while (i.hasNext()) {
+        String id = (String) i.next();
+
+        Map action = new HashMap();
+        action.put("resource", id);
+        action.put("identifier", id);
+
+        result.add(action);
+      }
+
+      return result;
+    }
+    catch (Throwable t) {
+      throw new RuntimeException("can't get article actions");
+    }
+  }
+
+  public class FilterGroup {
+    private List filters;
+    private Entity entity;
+    private Map idToFilter;
+
+    public FilterGroup(Entity anEntity) {
+      this (anEntity, Collections.EMPTY_LIST);
+    }
+
+    public FilterGroup(Entity anEntity, List aFilters) {
+      entity = anEntity;
+      filters = new ArrayList();
+      idToFilter = new HashMap();
+      Iterator i = aFilters.iterator();
+
+      while (i.hasNext()) {
+        Entity entity = (Entity) i.next();
+        try {
+          Filter filter = new Filter(entity);
+          introduceFilter(filter);
+        }
+        catch (AbuseExc e) {
+        }
+      }
+    }
+
+    public Entity getEntity() {
+      return entity;
+    }
+
+    public EntityAdapter getEntityAdapter() {
+      return model.makeEntityAdapter("filterGroup",  entity);
+    }
+
+    public List getFilterEntityAdapterList() {
+      List result = new ArrayList();
+
+      Iterator i = filters.iterator();
+      while (i.hasNext()) {
+        Filter filter = (Filter) i.next();
+        result.add(filter.getEntityAdapter());
+      }
+
+      return result;
+    }
+
+    public List getFilters() {
+      return filters;
+    }
+
+    public Filter getFilterForId(String anId) {
+      Filter result = (Filter) idToFilter.get(anId);
+      if (result==null) {
+        throw new NullPointerException("No such filter");
+      }
+
+      return result;
+    }
+
+    private void introduceFilter(Filter aFilter) {
+      filters.add(aFilter);
+      idToFilter.put(aFilter.getEntity().getId(), aFilter);
+    }
+
+    private void removeFilter(Filter aFilter) {
+      filters.remove(aFilter);
+      idToFilter.remove(aFilter.getEntity().getId());
+    }
+
+    private void deleteFilter(String anId) {
+      Filter filter = getFilterForId(anId);
+      removeFilter(filter);
+      DatabaseFilter.getInstance().delete(anId);
+    }
+
+    public void populateFilterEntity(Entity anEntity, String aType, String anExpression,
+                             String aComments, String aTag, String anArticleAction,
+                             String aCommentAction) {
+
+      anEntity.setFieldValue("type", aType);
+      anEntity.setFieldValue("expression", anExpression);
+      anEntity.setFieldValue("comment", aComments);
+      anEntity.setFieldValue("tag", aTag);
+      anEntity.setFieldValue("articleaction", anArticleAction);
+      anEntity.setFieldValue("commentaction", aCommentAction);
+    }
+
+    public String updateFilter(String anId, String aType, String anExpression,
+                             String aComments, String aTag, String anArticleAction,
+                             String aCommentAction) {
+
+      try {
+        getFilterTypeForId(aType).constructFilterInstance(anExpression);
+      }
+      catch (AbuseExc e) {
+        return e.getMessage();
+      }
+
+      Entity entity = getFilterForId(anId).getEntity();
+      populateFilterEntity(entity, aType, anExpression, aComments, aTag,
+          anArticleAction, aCommentAction);
+      entity.update();
+
+      return "";
+    }
+
+    public String createFilter(String aType, String anExpression,
+                             String aComments, String aTag, String anArticleAction,
+                             String aCommentAction) throws StorageObjectExc {
+      FilterInstance instance;
+
+      try {
+        instance = getFilterTypeForId(aType).constructFilterInstance(anExpression);
+      }
+      catch (AbuseExc e) {
+        return e.getMessage();
+      }
+
+      Entity entity = DatabaseFilter.getInstance().createNewEntity();
+      populateFilterEntity(entity, aType, anExpression, aComments, aTag,
+          anArticleAction, aCommentAction);
+      entity.setFieldValue("priority", "1");
+      entity.setFieldValue("filter_group_id", getEntity().getId());
+      entity.insert();
+
+      Filter filter = new Filter(entity, instance);
+      introduceFilter(filter);
+
+      return "";
+    }
+
+    public String getName() {
+      return entity.getFieldValue("name");
+    }
+  }
+
+  public class Filter {
+    private Entity entity;
+    private FilterInstance instance;
+
+    public Filter(Entity anEntity) throws AbuseExc {
+      this(anEntity, getFilterTypeForId(anEntity.getFieldValue("type")).constructFilterInstance(anEntity.getFieldValue("expression")));
+    }
+
+    public Filter(Entity anEntity, FilterInstance anInstance) {
+      entity = anEntity;
+      instance = anInstance;
+    }
+
+    public Entity getEntity() {
+      return entity;
+    }
+
+    public EntityAdapter getEntityAdapter() {
+      return model.makeEntityAdapter("filter", entity);
+    }
+
+    public void update(String aType, String anExpression, String aComments, String aTag,
+                       String anArticleAction, String aCommentAction) throws AbuseExc {
+
+      instance = getFilterTypeForId(aType).constructFilterInstance(anExpression);
+
+      entity.setFieldValue("type", aType);
+      entity.setFieldValue("expression", anExpression);
+      entity.setFieldValue("tag", aType);
+      entity.setFieldValue("comment", aComments);
+      entity.setFieldValue("articleaction", anArticleAction);
+      entity.setFieldValue("commentaction", aCommentAction);
+      entity.setFieldValue("last_hit", null);
+      entity.update();
+   }
+
+    public void updateLastHit(Date aDate) {
+      entity.setFieldValue("last_hit", dateFormat.format(aDate));
+      entity.update();
+    }
+
+    public String getType() {
+      return entity.getFieldValue("type");
+    }
+
+    public String getExpression() {
+      return entity.getFieldValue("expression");
+    }
+
+    public String getTag() {
+      return entity.getFieldValue("tag");
+    }
+
+    public String getComment() {
+      return entity.getFieldValue("comment");
+    }
+
+    public String getArticleAction() {
+      return entity.getFieldValue("articleaction");
+    }
+
+    public String getCommentAction() {
+      return entity.getFieldValue("commentaction");
+    }
+
+    public FilterInstance getInstance() {
+      return instance;
+    }
+
+    public boolean test(Entity anEntity, Request aRequest) {
+      return instance.test(anEntity, aRequest);
+    }
+  }
+
+  public synchronized void reload() {
+    filterGroups.clear();
+    idToFilterGroup.clear();
+
+    try {
+      Iterator i = new EntityIteratorAdapter("", "priority asc", 100, model, "filterGroup");
+      while (i.hasNext()) {
+        EntityAdapter entityAdapter = (EntityAdapter) i.next();
+        List filters = new ArrayList();
+        Iterator j = (Iterator) entityAdapter.get("to_filters");
+        while (j.hasNext()) {
+          filters.add(((EntityAdapter) j.next()).getEntity());
+        }
+
+        FilterGroup filterGroup = new FilterGroup(entityAdapter.getEntity(), filters);
+        introduceFilterGroup(filterGroup);
+      }
+    }
+    catch (Throwable e) {
+      logger.error("Can't load filters: " + e.getMessage());
+    }
+  }
+
+  public synchronized List getFilterGroups() {
+    List result = new ArrayList();
+    Iterator i = filterGroups.iterator();
+    while (i.hasNext()) {
+      result.add(((FilterGroup) i.next()).getEntityAdapter());
+    }
+
+    return result;
+  }
+
+  public synchronized void updateFilterGroup(String anId, String aName) {
+    FilterGroup filterGroup = getFilterGroupForId(anId);
+    filterGroup.getEntity().setFieldValue("name", aName);
+    filterGroup.getEntity().update();
+  }
+
+  public synchronized void addFilterGroup(String aName) throws StorageObjectExc {
+    Entity entity = DatabaseFilterGroup.getInstance().createNewEntity();
+    entity.setFieldValue("name", aName);
+    entity.setFieldValue("priority", "1");
+    entity.insert();
+
+    FilterGroup filterGroup = new FilterGroup(entity);
+    introduceFilterGroup(filterGroup);
+  }
+
+  public synchronized void deleteFilterGroup(String anId) {
+
+    FilterGroup filterGroup = getFilterGroupForId(anId);
+    removeFilterGroup(filterGroup);
+    DatabaseFilter.getInstance().deleteByWhereClause("filter_group_id = " + anId);
+    DatabaseFilterGroup.getInstance().delete(anId);
+  }
+
+  public synchronized void deleteFilter(String aGroupId, String anId) {
+    getFilterGroupForId(aGroupId).deleteFilter(anId);
+  }
+
+
+  public synchronized String updateFilter(String aGroupId, String anId,
+                                        String aType, String anExpression,
+                                        String aComments,
+                                        String aTag,
+                                        String anArticleAction,
+                                        String aCommentAction) {
+    return getFilterGroupForId(aGroupId).updateFilter(anId, aType,
+        anExpression, aComments, aTag, anArticleAction, aCommentAction);
+  }
+
+  public synchronized String addFilter(String aGroupId,
+                                       String aType, String anExpression,
+                                       String aComments,
+                                       String aTag,
+                                       String anArticleAction,
+                                       String aCommentAction) throws StorageObjectExc {
+    return getFilterGroupForId(aGroupId).createFilter(aType, anExpression,
+        aComments, aTag, anArticleAction, aCommentAction);
+  }
+
+
+  public FilterGroup getFilterGroupForId(String anId) {
+    FilterGroup result = (FilterGroup) idToFilterGroup.get(anId);
+    if (result == null) {
+      throw new NullPointerException("No such filter group");
+    }
+
+    return result;
+  }
+
+  public Filter getFilterForId(String aGroupId, String anId) {
+    return getFilterGroupForId(aGroupId).getFilterForId(anId);
+  }
+
+
+  public List getFilters(String aFilterGroupId) {
+    return getFilterGroupForId(aFilterGroupId).getFilterEntityAdapterList();
+  }
+
+  private void introduceFilterGroup(FilterGroup aFilterGroup) {
+    filterGroups.add(aFilterGroup);
+    idToFilterGroup.put(aFilterGroup.getEntity().getId(), aFilterGroup);
+  }
+
+  private void removeFilterGroup(FilterGroup aFilterGroup) {
+    filterGroups.remove(aFilterGroup);
+    idToFilterGroup.remove(aFilterGroup.getEntity().getId());
+  }
+
+  private FilterType getFilterTypeForId(String anId) {
+    return (FilterType) filterTypes.get(anId);
+  }
+}
index e601831..9cb0867 100755 (executable)
@@ -1,80 +1,80 @@
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with  any library licensed under the Apache Software License,\r
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library\r
- * (or with modified versions of the above that use the same license as the above),\r
- * and distribute linked combinations including the two.  You must obey the\r
- * GNU General Public License in all respects for all of the code used other than\r
- * the above mentioned libraries.  If you modify this file, you may extend this\r
- * exception to your version of the file, but you are not obligated to do so.\r
- * If you do not wish to do so, delete this exception statement from your version.\r
- */\r
-package mircoders.abuse;\r
-\r
-import mir.util.InternetFunctions;\r
-import mir.entity.Entity;\r
-import mir.session.Request;\r
-\r
-/**\r
- * A basic ip filter type. Supports x.x.x.x, x.x.x.x/x and x.x.x.x/x.x.x.x expressions.\r
- */\r
-public class IPFilterType extends AbstractFilterType {\r
-  public IPFilterType(String aName) {\r
-    super(aName);\r
-  }\r
-\r
-  /**\r
-   *\r
-   */\r
-  public boolean validate(String anExpression) {\r
-    try {\r
-      InternetFunctions.isIpAddressInNetwork("1.1.1.1", anExpression);\r
-      return true;\r
-    }\r
-    catch (Throwable t) {\r
-      return false;\r
-    }\r
-  }\r
-\r
-  public FilterInstance constructFilterInstance(final String anExpression) throws AbuseExc {\r
-    try {\r
-      InternetFunctions.isIpAddressInNetwork("1.1.1.1", anExpression);\r
-    }\r
-    catch (Throwable t) {\r
-      throw new AbuseExc("Invalid expression: " + anExpression);\r
-    }\r
-\r
-    return new FilterInstance() {\r
-      public boolean test(Entity anEntity, Request aRequest) {\r
-        try {\r
-          return InternetFunctions.isIpAddressInNetwork(aRequest.getHeader("ip"), anExpression);\r
-        }\r
-        catch (Exception e) {\r
-          return false;\r
-        }\r
-      }\r
-\r
-      public String status() {\r
-        return "";\r
-      }\r
-    };\r
-  }\r
-}\r
+/*
+ * 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.abuse;
+
+import mir.entity.Entity;
+import mir.session.Request;
+import mir.util.InternetFunctions;
+
+/**
+ * A basic ip filter type. Supports x.x.x.x, x.x.x.x/x and x.x.x.x/x.x.x.x expressions.
+ */
+public class IPFilterType extends AbstractFilterType {
+  public IPFilterType(String aName) {
+    super(aName);
+  }
+
+  /**
+   *
+   */
+  public boolean validate(String anExpression) {
+    try {
+      InternetFunctions.isIpAddressInNetwork("1.1.1.1", anExpression);
+      return true;
+    }
+    catch (Throwable t) {
+      return false;
+    }
+  }
+
+  public FilterInstance constructFilterInstance(final String anExpression) throws AbuseExc {
+    try {
+      InternetFunctions.isIpAddressInNetwork("1.1.1.1", anExpression);
+    }
+    catch (Throwable t) {
+      throw new AbuseExc("Invalid expression: " + anExpression);
+    }
+
+    return new FilterInstance() {
+      public boolean test(Entity anEntity, Request aRequest) {
+        try {
+          return InternetFunctions.isIpAddressInNetwork(aRequest.getHeader("ip"), anExpression);
+        }
+        catch (Exception e) {
+          return false;
+        }
+      }
+
+      public String status() {
+        return "";
+      }
+    };
+  }
+}
index 13d1db5..fe0e6bb 100755 (executable)
 package mircoders.abuse;
 
 import gnu.regexp.RE;
-import mir.entity.Entity;
-import mir.session.Request;
 
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
+import mir.entity.Entity;
+import mir.session.Request;
+
 
 /**
   * A regular expression filter.
index 714f205..79e8649 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with  any library licensed under the Apache Software License,\r
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library\r
- * (or with modified versions of the above that use the same license as the above),\r
- * and distribute linked combinations including the two.  You must obey the\r
- * GNU General Public License in all respects for all of the code used other than\r
- * the above mentioned libraries.  If you modify this file, you may extend this\r
- * exception to your version of the file, but you are not obligated to do so.\r
- * If you do not wish to do so, delete this exception statement from your version.\r
- */\r
-package mircoders.abuse;\r
-\r
-import mir.entity.Entity;\r
-import mir.session.Request;\r
-import mir.util.StringRoutines;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-\r
-/**\r
- * A ip-based throttling filter.\r
- *\r
- * <p>\r
- * Expressions have the form <time in minutes>:<posting limit>\r
- */\r
-public class ThrottleFilter extends AbstractFilterType {\r
-\r
-  public ThrottleFilter(String aName) {\r
-    super(aName);\r
-  }\r
-\r
-  public FilterInstance constructFilterInstance(String anExpression) throws AbuseExc {\r
-    List parts = StringRoutines.splitString(anExpression.trim(), ":");\r
-\r
-    if (parts.size()==2) {\r
-      try {\r
-        final int interval = Integer.parseInt((String) parts.get(0));\r
-        final int limit = Integer.parseInt((String) parts.get(1));\r
-\r
-        if (interval<1) {\r
-          throw new AbuseExc("Interval should be larger than 0");\r
-        }\r
-        if (limit<1) {\r
-          throw new AbuseExc("Limit should be larger than 0");\r
-        }\r
-        final ThrottleManager manager = new ThrottleManager(interval*1000*60);\r
-\r
-        return new FilterInstance() {\r
-          public boolean test(Entity anEntity, Request aRequest) {\r
-            manager.addMessage(aRequest.getHeader("ip"));\r
-            if (manager.count(aRequest.getHeader("ip")) > limit) {\r
-              return true;\r
-            }\r
-\r
-            return false;\r
-          }\r
-\r
-          public String status() {\r
-            return Integer.toString(manager.messages.size()) + " messages";\r
-          }\r
-        };\r
-      }\r
-      catch (AbuseExc e) {\r
-        throw e;\r
-      }\r
-      catch (Throwable t) {\r
-        throw new AbuseExc("Invalid expression: <interval>:<limit> expected");\r
-      }\r
-    }\r
-    else {\r
-      throw new AbuseExc("Invalid expression: <interval>:<limit> expected");\r
-    }\r
-  }\r
-\r
-  private class ThrottleManager {\r
-    private long horizon;\r
-    private List messages;\r
-\r
-    public ThrottleManager(long aHorizon) {\r
-      horizon = aHorizon;\r
-\r
-      messages = new ArrayList();\r
-    }\r
-\r
-    public void flush() {\r
-      long limit = System.currentTimeMillis() - horizon;\r
-\r
-      while (messages.size()>0 && ((Message) messages.get(0)).getTime()<=limit) {\r
-        messages.remove(0);\r
-      }\r
-    }\r
-\r
-    public void addMessage(String anIp) {\r
-      Message newMessage = new Message(anIp, System.currentTimeMillis());\r
-      messages.add(newMessage);\r
-    }\r
-\r
-    public int count(String anIp) {\r
-      flush();\r
-\r
-      int result = 0;\r
-      Iterator i = messages.iterator();\r
-      while (i.hasNext()) {\r
-        Message message = (Message) i.next();\r
-        if (message.getIp().equals(anIp)) {\r
-          result = result + 1;\r
-        }\r
-      }\r
-\r
-      return result;\r
-    }\r
-\r
-    private class Message {\r
-      private String ip;\r
-      private long time;\r
-\r
-      public Message(String anIp, long aTime) {\r
-        ip = anIp;\r
-        time = aTime;\r
-      }\r
-\r
-      public String getIp() {\r
-        return ip;\r
-      }\r
-\r
-      public long getTime() {\r
-        return time;\r
-      }\r
-    }\r
-  }\r
-}\r
+/*
+ * 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.abuse;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import mir.entity.Entity;
+import mir.session.Request;
+import mir.util.StringRoutines;
+
+/**
+ * A ip-based throttling filter.
+ *
+ * <p>
+ * Expressions have the form <time in minutes>:<posting limit>
+ */
+public class ThrottleFilter extends AbstractFilterType {
+
+  public ThrottleFilter(String aName) {
+    super(aName);
+  }
+
+  public FilterInstance constructFilterInstance(String anExpression) throws AbuseExc {
+    List parts = StringRoutines.splitString(anExpression.trim(), ":");
+
+    if (parts.size()==2) {
+      try {
+        final int interval = Integer.parseInt((String) parts.get(0));
+        final int limit = Integer.parseInt((String) parts.get(1));
+
+        if (interval<1) {
+          throw new AbuseExc("Interval should be larger than 0");
+        }
+        if (limit<1) {
+          throw new AbuseExc("Limit should be larger than 0");
+        }
+        final ThrottleManager manager = new ThrottleManager(interval*1000*60);
+
+        return new FilterInstance() {
+          public boolean test(Entity anEntity, Request aRequest) {
+            manager.addMessage(aRequest.getHeader("ip"));
+            if (manager.count(aRequest.getHeader("ip")) > limit) {
+              return true;
+            }
+
+            return false;
+          }
+
+          public String status() {
+            return Integer.toString(manager.messages.size()) + " messages";
+          }
+        };
+      }
+      catch (AbuseExc e) {
+        throw e;
+      }
+      catch (Throwable t) {
+        throw new AbuseExc("Invalid expression: <interval>:<limit> expected");
+      }
+    }
+               throw new AbuseExc("Invalid expression: <interval>:<limit> expected");
+  }
+
+  private class ThrottleManager {
+    private long horizon;
+    private List messages;
+
+    public ThrottleManager(long aHorizon) {
+      horizon = aHorizon;
+
+      messages = new ArrayList();
+    }
+
+    public void flush() {
+      long limit = System.currentTimeMillis() - horizon;
+
+      while (messages.size()>0 && ((Message) messages.get(0)).getTime()<=limit) {
+        messages.remove(0);
+      }
+    }
+
+    public void addMessage(String anIp) {
+      Message newMessage = new Message(anIp, System.currentTimeMillis());
+      messages.add(newMessage);
+    }
+
+    public int count(String anIp) {
+      flush();
+
+      int result = 0;
+      Iterator i = messages.iterator();
+      while (i.hasNext()) {
+        Message message = (Message) i.next();
+        if (message.getIp().equals(anIp)) {
+          result = result + 1;
+        }
+      }
+
+      return result;
+    }
+
+    private class Message {
+      private String ip;
+      private long time;
+
+      public Message(String anIp, long aTime) {
+        ip = anIp;
+        time = aTime;
+      }
+
+      public String getIp() {
+        return ip;
+      }
+
+      public long getTime() {
+        return time;
+      }
+    }
+  }
+}
index f64a208..93a7d28 100755 (executable)
 
 package mircoders.accesscontrol;
 
+import java.util.List;
+import java.util.Vector;
+
 import mir.config.MirPropertiesConfiguration;
 import mir.log.LoggerWrapper;
 import mircoders.entity.EntityUsers;
 import mircoders.module.ModuleContent;
 
-import java.util.List;
-import java.util.Vector;
-
 public class AccessControl {
   private UserAccessControl user;
   private GeneralAccessControl general;
index b5fc55a..9d9c064 100755 (executable)
 
 package mircoders.entity;
 
+import java.util.Map;
+
 import mir.entity.AbstractEntity;
 import mir.storage.StorageObjectFailure;
 import mircoders.storage.DatabaseCommentToMedia;
 import mircoders.storage.DatabaseContent;
 
-import java.util.Map;
-
 /**
  * This class maps one line of the comment-table to a java-object.
  *
- * @author $Author: zapata $
- * @version $Revision: 1.16.2.4 $ $Date: 2005/01/09 20:37:10 $
+ * @author $Author: rhindes $
+ * @version $Revision: 1.16.2.5 $ $Date: 2005/02/10 16:22:32 $
  */
 
 
index 2b208dd..51fbd2a 100755 (executable)
 
 package mircoders.entity;
 
-import mir.entity.AbstractEntity;
-import mir.log.LoggerWrapper;
-import mir.storage.StorageObjectFailure;
-import mircoders.storage.DatabaseContentToMedia;
-
 import java.sql.Connection;
 import java.sql.SQLException;
 import java.sql.Statement;
 import java.util.Map;
 
+import mir.entity.AbstractEntity;
+import mir.log.LoggerWrapper;
+import mir.storage.StorageObjectFailure;
+import mircoders.storage.DatabaseContentToMedia;
+
 /**
  * this class implements mapping of one line of the database table content
  * to a java object
  *
- * @version $Id: EntityContent.java,v 1.19.2.9 2005/01/23 15:36:04 zapata Exp $
+ * @version $Id: EntityContent.java,v 1.19.2.10 2005/02/10 16:22:32 rhindes Exp $
  * @author mir-coders group
  *
  */
index 7221e9b..5fb1f1b 100755 (executable)
 
 package mircoders.entity;
 
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.sql.SQLException;
+
 import mir.log.LoggerWrapper;
 import mir.storage.StorageObjectFailure;
 import mir.util.StreamCopier;
 import mircoders.media.ImageProcessor;
 
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.sql.SQLException;
-
 /**
  *
  * @author RK, mh, mir-coders
- * @version $Id: EntityImages.java,v 1.21.2.7 2005/01/23 15:36:04 zapata Exp $
+ * @version $Id: EntityImages.java,v 1.21.2.8 2005/02/10 16:22:32 rhindes Exp $
  */
 
 
index 6147337..30ffb87 100755 (executable)
  */
 package mircoders.entity;
 
+import java.sql.SQLException;
+import java.util.Map;
+
 import mir.entity.AbstractEntity;
 import mir.entity.Entity;
 import mir.log.LoggerWrapper;
 import mir.storage.StorageObjectFailure;
 import mircoders.storage.DatabaseUploadedMedia;
 
-import java.sql.SQLException;
-import java.util.Map;
-
 /**
  *
  * @author mh, mir-coders group
- * @version $Id: EntityUploadedMedia.java,v 1.26.2.10 2005/01/23 15:36:04 zapata Exp $
+ * @version $Id: EntityUploadedMedia.java,v 1.26.2.11 2005/02/10 16:22:32 rhindes Exp $
  */
 
 public class EntityUploadedMedia extends AbstractEntity {
index 19d0d44..00e3639 100755 (executable)
  */
 package mircoders.entity;
 
-import mir.log.LoggerWrapper;
-
 import java.util.Map;
 
+import mir.log.LoggerWrapper;
+
 public class EntityVideo extends EntityUploadedMedia {
   public EntityVideo() {
     super();
index 02a111c..360a592 100755 (executable)
 
 package mircoders.global;
 
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponse;
+
 import mir.config.MirPropertiesConfiguration;
 import mir.entity.Entity;
 import mir.entity.adapter.EntityAdapterModel;
@@ -43,15 +59,8 @@ import mircoders.abuse.FilterEngine;
 import mircoders.entity.EntityComment;
 import mircoders.entity.EntityContent;
 import mircoders.localizer.MirAdminInterfaceLocalizer;
-import org.apache.commons.collections.ExtendedProperties;
 
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletResponse;
-import java.io.BufferedOutputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.util.*;
+import org.apache.commons.collections.ExtendedProperties;
 
 
 public class Abuse {
@@ -485,7 +494,7 @@ public class Abuse {
         }
       }
     }
-  };
+  }
 
   private void appendLog(LogEntry anEntry) {
     synchronized (log) {
index 63fead0..f1b947c 100755 (executable)
@@ -48,8 +48,7 @@ public class CacheKey {
       return false;
     if (((CacheKey) aCacheKey).type.equals(type) && ((CacheKey) aCacheKey).selector.equals(selector))
       return true;
-    else
-      return false;
+               return false;
     
   }
 }
index d61fcd7..332d0a3 100755 (executable)
@@ -34,6 +34,7 @@ import java.sql.Driver;
 import java.util.Properties;
 
 import mir.config.MirPropertiesConfiguration;
+
 import org.apache.commons.dbcp.ConnectionFactory;
 import org.apache.commons.dbcp.DriverConnectionFactory;
 import org.apache.commons.dbcp.PoolableConnection;
index 8a62d11..5cc3a92 100755 (executable)
@@ -31,6 +31,7 @@
 package mircoders.global;
 
 
+import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.GregorianCalendar;
@@ -38,7 +39,6 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.ArrayList;
 
 import mir.log.LoggerWrapper;
 
@@ -283,7 +283,7 @@ public class JobQueue {
         else
           setAborted();
       }
-    };
+    }
 
     private void cancelOrAbortJob() {
       synchronized (this) {
@@ -292,7 +292,7 @@ public class JobQueue {
         if (isProcessing())
           job.abort();
       }
-    };
+    }
 
     public int getStatus() {
       synchronized(this) {
@@ -394,16 +394,13 @@ public class JobQueue {
           }
           return true;
         }
-        else {
-          return false;
-        }
+                               return false;
       }
     }
   }
 
   private class JobQueueRunner implements Runnable {
-    private LoggerWrapper logger;
-
+    
     public JobQueueRunner(LoggerWrapper aLogger) {
       logger = aLogger;
     }
index e1ea9d4..1c21e32 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with  any library licensed under the Apache Software License,\r
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library\r
- * (or with modified versions of the above that use the same license as the above),\r
- * and distribute linked combinations including the two.  You must obey the\r
- * GNU General Public License in all respects for all of the code used other than\r
- * the above mentioned libraries.  If you modify this file, you may extend this\r
- * exception to your version of the file, but you are not obligated to do so.\r
- * If you do not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.global;\r
-\r
-import mir.bundle.BasicBundleFactory;\r
-import mir.bundle.BundleFactory;\r
-import mir.bundle.CascadingBundleFactory;\r
-import mir.bundle.PropertiesFileBundleLoader;\r
-import mir.config.MirPropertiesConfiguration;\r
-import mir.entity.adapter.EntityAdapter;\r
-import mir.log.LoggerEngine;\r
-import mir.log.LoggerWrapper;\r
-import mir.misc.ConfigException;\r
-import mircoders.accesscontrol.AccessControl;\r
-import mircoders.entity.EntityComment;\r
-import mircoders.entity.EntityContent;\r
-import mircoders.entity.EntityUsers;\r
-import mircoders.localizer.MirAdminInterfaceLocalizer;\r
-import mircoders.localizer.MirCachingLocalizerDecorator;\r
-import mircoders.localizer.MirLocalizer;\r
-import mircoders.localizer.MirLocalizerExc;\r
-\r
-import java.util.*;\r
-\r
-public class MirGlobal {\r
-  static private MirLocalizer localizer;\r
-  static private ProducerEngine producerEngine;\r
-  static private Abuse abuse;\r
-  static private MRUCache mruCache;\r
-  static private AccessControl accessControl;\r
-  static private Map articleOperations;\r
-  static private Map commentOperations;\r
-  static private Map loggedInUsers = new HashMap();\r
-  static private Map loggedInUserIds = new HashMap();\r
-  static private LoggerWrapper logger = new LoggerWrapper("Global");\r
-  static private LoggerWrapper adminUsageLogger = new LoggerWrapper("AdminUsage");\r
-//  static private ChangeEngine changeEngine = new ChangeEngine();\r
-  static private DatabaseEngine databaseEngine;\r
-\r
-  static private BundleFactory bundleFactory =\r
-      new CascadingBundleFactory(\r
-        new BasicBundleFactory(\r
-            new PropertiesFileBundleLoader(\r
-                config().getHome())));\r
-\r
-  public synchronized static MirLocalizer localizer() {\r
-    String localizerClassName;\r
-    Class localizerClass;\r
-\r
-    if (localizer == null ) {\r
-      localizerClassName = config().getString("Mir.Localizer", "mirlocal.localizer.basic.MirBasicLocalizer");\r
-\r
-      try {\r
-        localizerClass = Class.forName(localizerClassName);\r
-      }\r
-      catch (Throwable t) {\r
-        throw new ConfigException("localizer class '" +\r
-            localizerClassName + "' not found: " + t.toString());\r
-      }\r
-\r
-      if (!(MirLocalizer.class.isAssignableFrom(localizerClass)))\r
-        throw new ConfigException("localizer class '" +\r
-            localizerClassName + "' is not assignable from MirLocalizer");\r
-\r
-      try {\r
-        localizer = new MirCachingLocalizerDecorator((MirLocalizer) localizerClass.newInstance());\r
-      }\r
-      catch (Throwable t) {\r
-        throw new ConfigException("localizer class '" +\r
-            localizerClassName + "' cannot be instantiated: " + t.toString());\r
-      }\r
-    }\r
-\r
-    return localizer;\r
-  }\r
-\r
-  /**\r
-   * Returns a string that provides some global status information\r
-   */\r
-  public static String getStatus() {\r
-    StringBuffer result = new StringBuffer();\r
-\r
-    result.append((Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory())/(1024*1024));\r
-    result.append("M in use, ");\r
-    result.append(Thread.activeCount()).append(" threads, ");\r
-    result.append(getDatabaseEngine().getStatus());\r
-\r
-    return result.toString();\r
-  }\r
-\r
-  public synchronized static Abuse abuse() {\r
-    if (abuse==null) {\r
-      try {\r
-        abuse = new Abuse(localizer().dataModel().adapterModel());\r
-      }\r
-      catch (MirLocalizerExc e) {\r
-        throw new RuntimeException(e.getMessage());\r
-      }\r
-    }\r
-\r
-    return abuse;\r
-  }\r
-\r
-  /**\r
-   * returns the global change engine (used to track changed files)\r
-   */\r
-//  public static ChangeEngine getChangeEngine() {\r
-//    return changeEngine;\r
-//  }\r
-\r
-  public static MirPropertiesConfiguration config() {\r
-    return MirPropertiesConfiguration.instance();\r
-  }\r
-\r
-  public synchronized static DatabaseEngine getDatabaseEngine() {\r
-    if (databaseEngine==null)\r
-      databaseEngine = new DatabaseEngine();\r
-\r
-    return databaseEngine;\r
-  }\r
-\r
-  public static ProducerEngine getProducerEngine() {\r
-    if (producerEngine == null) {\r
-      producerEngine = new ProducerEngine();\r
-    }\r
-\r
-    return producerEngine;\r
-  }\r
-\r
-  public static MRUCache mruCache() {\r
-    synchronized(MirGlobal.class) {\r
-      if (mruCache == null) {\r
-        mruCache = new MRUCache();\r
-      }\r
-      return mruCache;\r
-    }\r
-  }\r
-\r
-  public static synchronized AccessControl accessControl() {\r
-    if (accessControl == null) {\r
-      accessControl=new AccessControl();\r
-    }\r
-\r
-    return accessControl;\r
-  }\r
-\r
-  public static void performArticleOperation(EntityUsers aUser, EntityContent  anArticle, String anOperation) {\r
-    MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = getArticleOperationForName(anOperation);\r
-\r
-    try {\r
-      EntityAdapter user = null;\r
-      if (aUser!=null)\r
-          user = localizer().dataModel().adapterModel().makeEntityAdapter("user", aUser);\r
-\r
-      if (operation!=null)\r
-        operation.perform(\r
-            user,\r
-            localizer().dataModel().adapterModel().makeEntityAdapter("content", anArticle));\r
-    }\r
-    catch (Throwable t) {\r
-      t.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));\r
-\r
-      throw new RuntimeException(t.toString());\r
-    }\r
-  }\r
-\r
-  public static void performCommentOperation(EntityUsers aUser, EntityComment  aComment, String anOperation) {\r
-    MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = getCommentOperationForName(anOperation);\r
-\r
-    try {\r
-      EntityAdapter user = null;\r
-      if (aUser!=null)\r
-          user = localizer().dataModel().adapterModel().makeEntityAdapter("user", aUser);\r
-\r
-      if (operation!=null)\r
-        operation.perform(\r
-            user,\r
-            localizer().dataModel().adapterModel().makeEntityAdapter("comment", aComment));\r
-    }\r
-    catch (Throwable t) {\r
-      throw new RuntimeException(t.toString());\r
-    }\r
-  }\r
-\r
-  private synchronized static MirAdminInterfaceLocalizer.MirSimpleEntityOperation\r
-      getArticleOperationForName(String aName) {\r
-    try {\r
-      if (articleOperations == null) {\r
-        articleOperations = new HashMap();\r
-        Iterator i = localizer().adminInterface().simpleArticleOperations().iterator();\r
-        while (i.hasNext()) {\r
-          MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation =\r
-              (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next();\r
-          articleOperations.put(operation.getName(), operation);\r
-        }\r
-      }\r
-\r
-      return (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) articleOperations.get(aName);\r
-    }\r
-    catch (Throwable t) {\r
-      throw new RuntimeException(t.toString());\r
-    }\r
-  }\r
-\r
-  private synchronized static MirAdminInterfaceLocalizer.MirSimpleEntityOperation\r
-      getCommentOperationForName(String aName) {\r
-    try {\r
-      if (commentOperations == null) {\r
-        commentOperations = new HashMap();\r
-        Iterator i = localizer().adminInterface().simpleCommentOperations().iterator();\r
-        while (i.hasNext()) {\r
-          MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation =\r
-              (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next();\r
-          commentOperations.put(operation.getName(), operation);\r
-        }\r
-      }\r
-\r
-      return (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) commentOperations.get(aName);\r
-    }\r
-    catch (Throwable t) {\r
-      throw new RuntimeException(t.toString());\r
-    }\r
-  }\r
-\r
-  public static boolean isUserLoggedIn(String anId) {\r
-    synchronized (loggedInUserIds) {\r
-      return loggedInUserIds.containsKey(anId);\r
-    }\r
-  }\r
-\r
-  public static List getLoggedInUsers() {\r
-    List result = new ArrayList();\r
-\r
-    synchronized (loggedInUsers) {\r
-      Iterator i = loggedInUsers.entrySet().iterator();\r
-\r
-      while (i.hasNext()) {\r
-        Map.Entry entry = (Map.Entry) i.next();\r
-\r
-        Map item = new HashMap();\r
-        item.put("name", entry.getKey());\r
-        item.put("count", entry.getValue());\r
-        result.add(item);\r
-      }\r
-    }\r
-\r
-    return result;\r
-  }\r
-\r
-  public static BundleFactory getBundleFactory() {\r
-    return bundleFactory;\r
-  }\r
-\r
-  public static void registerLogin(String aName, String anId) {\r
-    modifyLoggedInCount(aName, anId, 1);\r
-  }\r
-\r
-  public static void registerLogout(String aName, String anId) {\r
-    modifyLoggedInCount(aName, anId, -1);\r
-  }\r
-\r
-  private static void modifyLoggedInCount(String aName, String anId, int aModifier) {\r
-    synchronized (loggedInUsers) {\r
-      Integer count = (Integer) loggedInUsers.get(aName);\r
-      if (count==null)\r
-        count = new Integer(0);\r
-\r
-      if (count.intValue()+aModifier<=0) {\r
-        loggedInUsers.remove(aName);\r
-      }\r
-      else {\r
-        loggedInUsers.put(aName, new Integer(count.intValue() + aModifier));\r
-      }\r
-    }\r
-\r
-    synchronized (loggedInUserIds) {\r
-      Integer count = (Integer) loggedInUserIds.get(anId);\r
-      if (count==null)\r
-        count = new Integer(0);\r
-\r
-      if (count.intValue()+aModifier<=0) {\r
-        loggedInUserIds.remove(anId);\r
-      }\r
-      else {\r
-        loggedInUserIds.put(anId, new Integer(count.intValue() + aModifier));\r
-      }\r
-    }\r
-  }\r
-\r
-  /**\r
-   * Called whenever a modifying admin action occurs. Used to log\r
-   * the action, if admin activity logging is turned on,\r
-   */\r
-  public static void logAdminUsage(EntityUsers aUser, String anObject, String aDescription) {\r
-    try {\r
-      if (config().getString("Mir.Admin.LogAdminActivity", "0").equals("1")) {\r
-        String user = "unknown (" + aUser.toString() + ")";\r
-        if (aUser != null)\r
-          user = aUser.getFieldValue("login");\r
-        adminUsageLogger.info(user + " | " + anObject + " | " + aDescription);\r
-      }\r
-    }\r
-    catch (Throwable t) {\r
-      logger.error("Error while logging admin usage ("+\r
-          aUser.toString()+", "+aDescription+"): " +t.toString());\r
-    }\r
-  }\r
-\r
-  /**\r
-   * Reloads all reloadable configurations, such as the producer subsystem.\r
-   */\r
-  public static void reloadConfigurations() throws MirGlobalExc, MirGlobalFailure {\r
-    getProducerEngine().reloadConfiguration();\r
-    try {\r
-      LoggerEngine.reload();\r
-    }\r
-    catch (Throwable e) {\r
-      throw new MirGlobalFailure(e);\r
-    }\r
-    getBundleFactory().reload();\r
-  }\r
-}\r
-\r
-\r
+/*
+ * 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.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import mir.bundle.BasicBundleFactory;
+import mir.bundle.BundleFactory;
+import mir.bundle.CascadingBundleFactory;
+import mir.bundle.PropertiesFileBundleLoader;
+import mir.config.MirPropertiesConfiguration;
+import mir.entity.adapter.EntityAdapter;
+import mir.log.LoggerEngine;
+import mir.log.LoggerWrapper;
+import mir.misc.ConfigException;
+import mircoders.accesscontrol.AccessControl;
+import mircoders.entity.EntityComment;
+import mircoders.entity.EntityContent;
+import mircoders.entity.EntityUsers;
+import mircoders.localizer.MirAdminInterfaceLocalizer;
+import mircoders.localizer.MirCachingLocalizerDecorator;
+import mircoders.localizer.MirLocalizer;
+import mircoders.localizer.MirLocalizerExc;
+
+public class MirGlobal {
+  static private MirLocalizer localizer;
+  static private ProducerEngine producerEngine;
+  static private Abuse abuse;
+  static private MRUCache mruCache;
+  static private AccessControl accessControl;
+  static private Map articleOperations;
+  static private Map commentOperations;
+  static private Map loggedInUsers = new HashMap();
+  static private Map loggedInUserIds = new HashMap();
+  static private LoggerWrapper logger = new LoggerWrapper("Global");
+  static private LoggerWrapper adminUsageLogger = new LoggerWrapper("AdminUsage");
+//  static private ChangeEngine changeEngine = new ChangeEngine();
+  static private DatabaseEngine databaseEngine;
+
+  static private BundleFactory bundleFactory =
+      new CascadingBundleFactory(
+        new BasicBundleFactory(
+            new PropertiesFileBundleLoader(
+                config().getHome())));
+
+  public synchronized static MirLocalizer localizer() {
+    String localizerClassName;
+    Class localizerClass;
+
+    if (localizer == null ) {
+      localizerClassName = config().getString("Mir.Localizer", "mirlocal.localizer.basic.MirBasicLocalizer");
+
+      try {
+        localizerClass = Class.forName(localizerClassName);
+      }
+      catch (Throwable t) {
+        throw new ConfigException("localizer class '" +
+            localizerClassName + "' not found: " + t.toString());
+      }
+
+      if (!(MirLocalizer.class.isAssignableFrom(localizerClass)))
+        throw new ConfigException("localizer class '" +
+            localizerClassName + "' is not assignable from MirLocalizer");
+
+      try {
+        localizer = new MirCachingLocalizerDecorator((MirLocalizer) localizerClass.newInstance());
+      }
+      catch (Throwable t) {
+        throw new ConfigException("localizer class '" +
+            localizerClassName + "' cannot be instantiated: " + t.toString());
+      }
+    }
+
+    return localizer;
+  }
+
+  /**
+   * Returns a string that provides some global status information
+   */
+  public static String getStatus() {
+    StringBuffer result = new StringBuffer();
+
+    result.append((Runtime.getRuntime().totalMemory()-Runtime.getRuntime().freeMemory())/(1024*1024));
+    result.append("M in use, ");
+    result.append(Thread.activeCount()).append(" threads, ");
+    result.append(getDatabaseEngine().getStatus());
+
+    return result.toString();
+  }
+
+  public synchronized static Abuse abuse() {
+    if (abuse==null) {
+      try {
+        abuse = new Abuse(localizer().dataModel().adapterModel());
+      }
+      catch (MirLocalizerExc e) {
+        throw new RuntimeException(e.getMessage());
+      }
+    }
+
+    return abuse;
+  }
+
+  /**
+   * returns the global change engine (used to track changed files)
+   */
+//  public static ChangeEngine getChangeEngine() {
+//    return changeEngine;
+//  }
+
+  public static MirPropertiesConfiguration config() {
+    return MirPropertiesConfiguration.instance();
+  }
+
+  public synchronized static DatabaseEngine getDatabaseEngine() {
+    if (databaseEngine==null)
+      databaseEngine = new DatabaseEngine();
+
+    return databaseEngine;
+  }
+
+  public static ProducerEngine getProducerEngine() {
+    if (producerEngine == null) {
+      producerEngine = new ProducerEngine();
+    }
+
+    return producerEngine;
+  }
+
+  public static MRUCache mruCache() {
+    synchronized(MirGlobal.class) {
+      if (mruCache == null) {
+        mruCache = new MRUCache();
+      }
+      return mruCache;
+    }
+  }
+
+  public static synchronized AccessControl accessControl() {
+    if (accessControl == null) {
+      accessControl=new AccessControl();
+    }
+
+    return accessControl;
+  }
+
+  public static void performArticleOperation(EntityUsers aUser, EntityContent  anArticle, String anOperation) {
+    MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = getArticleOperationForName(anOperation);
+
+    try {
+      EntityAdapter user = null;
+      if (aUser!=null)
+          user = localizer().dataModel().adapterModel().makeEntityAdapter("user", aUser);
+
+      if (operation!=null)
+        operation.perform(
+            user,
+            localizer().dataModel().adapterModel().makeEntityAdapter("content", anArticle));
+    }
+    catch (Throwable t) {
+      t.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
+
+      throw new RuntimeException(t.toString());
+    }
+  }
+
+  public static void performCommentOperation(EntityUsers aUser, EntityComment  aComment, String anOperation) {
+    MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = getCommentOperationForName(anOperation);
+
+    try {
+      EntityAdapter user = null;
+      if (aUser!=null)
+          user = localizer().dataModel().adapterModel().makeEntityAdapter("user", aUser);
+
+      if (operation!=null)
+        operation.perform(
+            user,
+            localizer().dataModel().adapterModel().makeEntityAdapter("comment", aComment));
+    }
+    catch (Throwable t) {
+      throw new RuntimeException(t.toString());
+    }
+  }
+
+  private synchronized static MirAdminInterfaceLocalizer.MirSimpleEntityOperation
+      getArticleOperationForName(String aName) {
+    try {
+      if (articleOperations == null) {
+        articleOperations = new HashMap();
+        Iterator i = localizer().adminInterface().simpleArticleOperations().iterator();
+        while (i.hasNext()) {
+          MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation =
+              (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next();
+          articleOperations.put(operation.getName(), operation);
+        }
+      }
+
+      return (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) articleOperations.get(aName);
+    }
+    catch (Throwable t) {
+      throw new RuntimeException(t.toString());
+    }
+  }
+
+  private synchronized static MirAdminInterfaceLocalizer.MirSimpleEntityOperation
+      getCommentOperationForName(String aName) {
+    try {
+      if (commentOperations == null) {
+        commentOperations = new HashMap();
+        Iterator i = localizer().adminInterface().simpleCommentOperations().iterator();
+        while (i.hasNext()) {
+          MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation =
+              (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next();
+          commentOperations.put(operation.getName(), operation);
+        }
+      }
+
+      return (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) commentOperations.get(aName);
+    }
+    catch (Throwable t) {
+      throw new RuntimeException(t.toString());
+    }
+  }
+
+  public static boolean isUserLoggedIn(String anId) {
+    synchronized (loggedInUserIds) {
+      return loggedInUserIds.containsKey(anId);
+    }
+  }
+
+  public static List getLoggedInUsers() {
+    List result = new ArrayList();
+
+    synchronized (loggedInUsers) {
+      Iterator i = loggedInUsers.entrySet().iterator();
+
+      while (i.hasNext()) {
+        Map.Entry entry = (Map.Entry) i.next();
+
+        Map item = new HashMap();
+        item.put("name", entry.getKey());
+        item.put("count", entry.getValue());
+        result.add(item);
+      }
+    }
+
+    return result;
+  }
+
+  public static BundleFactory getBundleFactory() {
+    return bundleFactory;
+  }
+
+  public static void registerLogin(String aName, String anId) {
+    modifyLoggedInCount(aName, anId, 1);
+  }
+
+  public static void registerLogout(String aName, String anId) {
+    modifyLoggedInCount(aName, anId, -1);
+  }
+
+  private static void modifyLoggedInCount(String aName, String anId, int aModifier) {
+    synchronized (loggedInUsers) {
+      Integer count = (Integer) loggedInUsers.get(aName);
+      if (count==null)
+        count = new Integer(0);
+
+      if (count.intValue()+aModifier<=0) {
+        loggedInUsers.remove(aName);
+      }
+      else {
+        loggedInUsers.put(aName, new Integer(count.intValue() + aModifier));
+      }
+    }
+
+    synchronized (loggedInUserIds) {
+      Integer count = (Integer) loggedInUserIds.get(anId);
+      if (count==null)
+        count = new Integer(0);
+
+      if (count.intValue()+aModifier<=0) {
+        loggedInUserIds.remove(anId);
+      }
+      else {
+        loggedInUserIds.put(anId, new Integer(count.intValue() + aModifier));
+      }
+    }
+  }
+
+  /**
+   * Called whenever a modifying admin action occurs. Used to log
+   * the action, if admin activity logging is turned on,
+   */
+  public static void logAdminUsage(EntityUsers aUser, String anObject, String aDescription) {
+    try {
+      if (config().getString("Mir.Admin.LogAdminActivity", "0").equals("1")) {
+        String user = "unknown (" + aUser.toString() + ")";
+        if (aUser != null)
+          user = aUser.getFieldValue("login");
+        adminUsageLogger.info(user + " | " + anObject + " | " + aDescription);
+      }
+    }
+    catch (Throwable t) {
+      logger.error("Error while logging admin usage ("+
+          aUser.toString()+", "+aDescription+"): " +t.toString());
+    }
+  }
+
+  /**
+   * Reloads all reloadable configurations, such as the producer subsystem.
+   */
+  public static void reloadConfigurations() throws MirGlobalExc, MirGlobalFailure {
+    getProducerEngine().reloadConfiguration();
+    try {
+      LoggerEngine.reload();
+    }
+    catch (Throwable e) {
+      throw new MirGlobalFailure(e);
+    }
+    getBundleFactory().reload();
+  }
+}
+
+
index 33942e0..3de07ea 100755 (executable)
  */
 package mircoders.global;
 
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
 import mir.config.MirPropertiesConfiguration;
 import mir.log.LoggerToWriterAdapter;
 import mir.log.LoggerWrapper;
@@ -37,9 +44,6 @@ import mir.producer.ProducerFactory;
 import mir.util.GeneratorFormatAdapters;
 import mir.util.StringRoutines;
 
-import java.io.PrintWriter;
-import java.util.*;
-
 public class ProducerEngine {
   private JobQueue producerJobQueue;
   private LoggerWrapper logger;
@@ -120,14 +124,14 @@ public class ProducerEngine {
    */
   public void cancelJobs(List aJobs) {
     producerJobQueue.cancelJobs(aJobs);
-  };
+  }
 
   /**
    * Cancels all jobs in the queue
    */
   public void cancelAllJobs() {
     producerJobQueue.cancelAllJobs();
-  };
+  }
 
   public void addTask(ProducerTask aTask) throws MirGlobalExc, MirGlobalFailure {
     addJob(aTask.getProducer(), aTask.getVerb());
@@ -286,8 +290,7 @@ public class ProducerEngine {
 
           if (parts.size() != 2)
             throw new MirGlobalExc("Invalid producer expression: '" + taskExpression + "'");
-          else
-            result.add(new ProducerEngine.ProducerTask( (String) parts.get(0), (String) parts.get(1)));
+          result.add(new ProducerEngine.ProducerTask( (String) parts.get(0), (String) parts.get(1)));
         }
       }
 
index 5dfaa15..3577723 100755 (executable)
  */
 package mircoders.localizer;
 
-import mir.entity.adapter.EntityAdapter;
-import mir.generator.Generator;
-
 import java.util.List;
 import java.util.Map;
 
+import mir.entity.adapter.EntityAdapter;
+import mir.generator.Generator;
+
 /**
  * Interface to allow for localized changed to the workings of the admin system
  *
index e2165af..759a881 100755 (executable)
@@ -94,7 +94,7 @@ public class MirCachingLocalizerDecorator implements MirLocalizer {
     }
 
     return adminInterfaceLocalizer;
-  };
+  }
 
   public MirMediaLocalizer media() throws MirLocalizerFailure, MirLocalizerExc {
     if (mediaLocalizer==null) {
@@ -119,7 +119,7 @@ public class MirCachingLocalizerDecorator implements MirLocalizer {
       }
 
       return adapterModel;
-    };
+    }
 
   }
 
@@ -140,7 +140,7 @@ public class MirCachingLocalizerDecorator implements MirLocalizer {
       }
 
       return writerEngine;
-    };
+    }
 
     public Generator.Library makeProducerGeneratorLibrary() throws MirLocalizerExc, MirLocalizerFailure {
       if (producerGeneratorLibrary==null) {
@@ -148,7 +148,7 @@ public class MirCachingLocalizerDecorator implements MirLocalizer {
       }
 
       return producerGeneratorLibrary;
-    };
+    }
 
     public Generator.Library makeAdminGeneratorLibrary() throws MirLocalizerExc, MirLocalizerFailure {
       if (adminGeneratorLibrary==null) {
@@ -156,7 +156,7 @@ public class MirCachingLocalizerDecorator implements MirLocalizer {
       }
 
       return adminGeneratorLibrary;
-    };
+    }
 
     public Generator.Library makeOpenPostingGeneratorLibrary() throws MirLocalizerExc, MirLocalizerFailure {
       if (openPostingGeneratorLibrary==null) {
@@ -164,7 +164,7 @@ public class MirCachingLocalizerDecorator implements MirLocalizer {
       }
 
       return openPostingGeneratorLibrary;
-    };
+    }
   }
 
 }
\ No newline at end of file
index fba4761..727e3bb 100755 (executable)
 
 package mircoders.localizer.basic;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 import mir.bundle.Bundle;
 import mir.config.MirPropertiesConfiguration;
 import mir.entity.Entity;
@@ -54,8 +65,6 @@ import mircoders.localizer.MirLocalizerFailure;
 import mircoders.module.ModuleLanguage;
 import mircoders.storage.DatabaseContent;
 
-import java.util.*;
-
 
 public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocalizer {
   /** preview page name (String) -> generator name (String) */
@@ -67,7 +76,7 @@ public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocaliz
   private Map simpleCommentOperationsMap;
   private Map simpleArticleOperationsMap;
 
-  protected static LoggerWrapper logger = new LoggerWrapper("Localizer.AdminInterface");;
+  protected static LoggerWrapper logger = new LoggerWrapper("Localizer.AdminInterface");
   protected MirPropertiesConfiguration configuration = MirPropertiesConfiguration.instance();
 
   public MirBasicAdminInterfaceLocalizer() throws MirLocalizerFailure {
@@ -148,9 +157,7 @@ public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocaliz
         throw new MirLocalizerFailure(e);
       }
     }
-    else {
-      throw new MirLocalizerExc("Unknown preview: " + aPreviewPage);
-    }
+               throw new MirLocalizerExc("Unknown preview: " + aPreviewPage);
   }
 
   /** {@inheritDoc} */
@@ -166,23 +173,23 @@ public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocaliz
   public void initializeArticle(Map anArticle) {
     anArticle.put("is_published", "0");
     anArticle.put("date", StringUtil.date2webdbDate(new GregorianCalendar()));
-  };
+  }
 
   public List simpleCommentOperations() {
     return Collections.unmodifiableList(simpleCommentOperations);
-  };
+  }
 
   public List simpleArticleOperations() {
     return Collections.unmodifiableList(simpleArticleOperations);
-  };
+  }
 
   public MirSimpleEntityOperation simpleArticleOperationForName(String aName) {
     return (MirSimpleEntityOperation) simpleArticleOperationsMap.get(aName);
-  };
+  }
 
   public MirSimpleEntityOperation simpleCommentOperationForName(String aName) {
     return (MirSimpleEntityOperation) simpleCommentOperationsMap.get(aName);
-  };
+  }
 
   public void removeSimpleArticleOperation(String aName) {
     simpleArticleOperations.remove(simpleArticleOperationsMap.get(aName));
@@ -217,7 +224,7 @@ public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocaliz
 
     public String getName() {
       return name;
-    };
+    }
 
     public boolean isAvailable(EntityAdapter anEntity) {
       try {
@@ -227,7 +234,7 @@ public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocaliz
       catch (Throwable t) {
         return false;
       }
-    };
+    }
 
     public void perform(EntityAdapter aUser, EntityAdapter anEntity) throws MirLocalizerExc, MirLocalizerFailure {
       Entity entity = anEntity.getEntity();
@@ -262,7 +269,7 @@ public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocaliz
       catch (Throwable t) {
         throw new MirLocalizerFailure(t);
       }
-    };
+    }
 
     protected abstract boolean isAvailable(Entity anEntity) throws StorageObjectFailure ;
     protected abstract void performModification(EntityAdapter aUser, Entity anEntity)  throws MirLocalizerExc, MirLocalizerFailure ;
@@ -284,7 +291,7 @@ public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocaliz
     protected void performModification(EntityAdapter aUser, Entity anEntity) throws StorageObjectFailure {
       performModification(aUser, (EntityComment) anEntity);
       DatabaseContent.getInstance().setUnproduced("id="+anEntity.getFieldValue("to_media"));
-    };
+    }
 
     protected abstract boolean isAvailable(EntityComment aComment) throws StorageObjectFailure ;
     protected abstract void performModification(EntityAdapter aUser, EntityComment aComment) throws StorageObjectFailure ;
@@ -302,7 +309,7 @@ public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocaliz
     protected void performModification(EntityAdapter aUser, Entity anEntity) throws StorageObjectFailure {
       performModification(aUser, (EntityContent) anEntity);
       anEntity.setFieldValue("is_produced", "0");
-    };
+    }
 
     protected abstract boolean isAvailable(EntityContent anArticle) throws StorageObjectFailure ;
     protected abstract void performModification(EntityAdapter aUser, EntityContent anArticle) throws StorageObjectFailure ;
index 8c26f8d..da19f7a 100755 (executable)
 
 package mircoders.localizer.basic;
 
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
 import mir.entity.Entity;
 import mir.misc.StringUtil;
-import mir.session.*;
+import mir.session.Request;
+import mir.session.Response;
+import mir.session.Session;
+import mir.session.SessionExc;
+import mir.session.SessionFailure;
+import mir.session.ValidationHelper;
 import mir.util.EntityUtility;
 import mircoders.entity.EntityContent;
 import mircoders.global.MirGlobal;
@@ -43,8 +54,6 @@ import mircoders.storage.DatabaseContent;
 import mircoders.storage.DatabaseContentToMedia;
 import mircoders.storage.DatabaseContentToTopics;
 
-import java.util.*;
-
 /**
  * Extensible handler for open article postings
  */
@@ -192,6 +201,6 @@ public class MirBasicArticlePostingHandler extends MirBasicPostingSessionHandler
       throw new SessionFailure(t);
     }
     logger.info("article posted");
-  };
+  }
 
 }
index f8c49fe..311f126 100755 (executable)
@@ -74,5 +74,5 @@ public class MirBasicChildArticlePostingHandler extends MirBasicArticlePostingHa
       throw new SessionExc("initializeSession: parent id not set!");
 
     aSession.setAttribute("to_content", parentId);
-  };
+  }
 }
\ No newline at end of file
index 199fba4..2ab1b70 100755 (executable)
@@ -45,7 +45,6 @@ import mir.util.EntityUtility;
 import mircoders.entity.EntityComment;
 import mircoders.global.MirGlobal;
 import mircoders.media.MediaUploadProcessor;
-import mircoders.module.ModuleComment;
 import mircoders.module.ModuleCommentStatus;
 import mircoders.module.ModuleMediafolder;
 import mircoders.storage.DatabaseComment;
@@ -104,7 +103,7 @@ public class MirBasicCommentPostingHandler extends MirBasicPostingSessionHandler
       throw new SessionExc("initializeSession: article id not set!");
 
     aSession.setAttribute("to_media", articleId);
-  };
+  }
 
   public void finalizeComment(Request aRequest, Session aSession, EntityComment aComment) throws SessionExc, SessionFailure {
     try {
@@ -177,7 +176,7 @@ public class MirBasicCommentPostingHandler extends MirBasicPostingSessionHandler
     }
     DatabaseContent.getInstance().setUnproduced("id=" + comment.getFieldValue("to_media"));
     logger.info("Comment posted");
-  };
+  }
 
   protected static class DuplicateCommentExc extends SessionExc {
     public DuplicateCommentExc(String aMessage) {
index 89e1914..54d914e 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with  any library licensed under the Apache Software License,\r
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library\r
- * (or with modified versions of the above that use the same license as the above),\r
- * and distribute linked combinations including the two.  You must obey the\r
- * GNU General Public License in all respects for all of the code used other than\r
- * the above mentioned libraries.  If you modify this file, you may extend this\r
- * exception to your version of the file, but you are not obligated to do so.\r
- * If you do not wish to do so, delete this exception statement from your version.\r
- */\r
-package mircoders.localizer.basic;\r
-\r
-import mir.config.MirPropertiesConfiguration;\r
-import mir.entity.Entity;\r
-import mir.entity.adapter.*;\r
-import mir.generator.Generator;\r
-import mir.generator.GeneratorExc;\r
-import mir.generator.GeneratorFailure;\r
-import mir.log.LoggerWrapper;\r
-import mir.media.MediaHandler;\r
-import mir.misc.NumberUtils;\r
-import mir.util.JDBCStringRoutines;\r
-import mir.util.ParameterExpander;\r
-import mir.util.RewindableIterator;\r
-import mir.util.StructuredContentParser;\r
-import mircoders.entity.EntityUploadedMedia;\r
-import mircoders.global.MirGlobal;\r
-import mircoders.localizer.MirAdminInterfaceLocalizer;\r
-import mircoders.localizer.MirDataModelLocalizer;\r
-import mircoders.localizer.MirLocalizerExc;\r
-import mircoders.localizer.MirLocalizerFailure;\r
-import mircoders.media.MediaHelper;\r
-import mircoders.module.ModuleContent;\r
-import mircoders.module.ModuleLanguage;\r
-import mircoders.storage.*;\r
-import multex.Failure;\r
-\r
-import java.util.*;\r
-\r
-public class MirBasicDataModelLocalizer implements MirDataModelLocalizer {\r
-  protected LoggerWrapper logger = new LoggerWrapper("Localizer.DataModel");\r
-  protected MirPropertiesConfiguration configuration = MirPropertiesConfiguration.instance();\r
-  protected ModuleLanguage languageModule = new ModuleLanguage();\r
-\r
-  protected void constructContentAdapterDefinition(EntityAdapterDefinition anEntityAdapterDefinition) throws MirLocalizerFailure, MirLocalizerExc {\r
-    try {\r
-      anEntityAdapterDefinition.addDBDateField("creationdate", "webdb_create", configuration.getString("Mir.DefaultTimezone"));\r
-      anEntityAdapterDefinition.addDBDateField("changedate", "webdb_lastchange", configuration.getString("Mir.DefaultTimezone"));\r
-      anEntityAdapterDefinition.addMirDateField("date", "date", configuration.getString("Mir.DefaultTimezone"));\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("lockinguser", new ToOneRelationField("to_locking_user", "id", "user"));\r
-      anEntityAdapterDefinition.addCalculatedField("is_locked", new ContentToIsLockedField());\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("to_topics", new ContentToTopicsField());\r
-      anEntityAdapterDefinition.addCalculatedField("to_comments", new ContentToCommentsField());\r
-      anEntityAdapterDefinition.addCalculatedField("language", new ToOneRelationField("to_language", "language", "id"));\r
-      anEntityAdapterDefinition.addCalculatedField("commentcount", new ContentCommentCountField(" and is_published='1'"));\r
-      anEntityAdapterDefinition.addCalculatedField("fullcommentcount", new ContentCommentCountField(""));\r
-\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("mediacount", new ContentMediaCountField("uploaded_media", true));\r
-      anEntityAdapterDefinition.addCalculatedField("fullmediacount", new ContentMediaCountField("uploaded_media", false));\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("to_uploaded_media", new ContentToMediaField( "uploadedMedia" ));\r
-      anEntityAdapterDefinition.addCalculatedField("to_media_images",  new ContentToMediaField( "image" ));\r
-      anEntityAdapterDefinition.addCalculatedField("to_media_audio", new ContentToMediaField( "audio" ));\r
-      anEntityAdapterDefinition.addCalculatedField("to_media_video", new ContentToMediaField( "video" ));\r
-      anEntityAdapterDefinition.addCalculatedField("to_media_other", new ContentToMediaField( "otherMedia" ));\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("firstImage",  new ContentToFirstMediaField( "image" ));\r
-      anEntityAdapterDefinition.addCalculatedField("firstAudio", new ContentToFirstMediaField( "audio" ));\r
-      anEntityAdapterDefinition.addCalculatedField("firstVideo", new ContentToFirstMediaField( "video" ));\r
-      anEntityAdapterDefinition.addCalculatedField("firstOther", new ContentToFirstMediaField( "otherMedia" ));\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("to_all_uploaded_media", new ContentToMediaField( "uploadedMedia", false));\r
-      anEntityAdapterDefinition.addCalculatedField("to_all_media_images",  new ContentToMediaField( "image", false));\r
-      anEntityAdapterDefinition.addCalculatedField("to_all_media_audio", new ContentToMediaField( "audio", false));\r
-      anEntityAdapterDefinition.addCalculatedField("to_all_media_video", new ContentToMediaField( "video", false));\r
-      anEntityAdapterDefinition.addCalculatedField("to_all_media_other", new ContentToMediaField( "otherMedia", false));\r
-      anEntityAdapterDefinition.addCalculatedField("to_media_icon", new ContentToIconField());\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("article_type", new ToOneRelationField("to_article_type", "articleType", "id"));\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("description_parsed", new FilteredField("description"));\r
-      anEntityAdapterDefinition.addCalculatedField("content_data_parsed", new FilteredField("content_data"));\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("children", new ContentToChildrenField());\r
-      anEntityAdapterDefinition.addCalculatedField("parent", new ToOneRelationField("to_content", "content", "id"));\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("publicurl", new ExpandedField(configuration.getString("Article.PublicUrl")));\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("operations",\r
-          new EntityToSimpleOperationsField(MirGlobal.localizer().adminInterface().simpleArticleOperations()));\r
-      \r
-      anEntityAdapterDefinition.addCalculatedField("languagename", new ContentToLanguageNameField());\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("is_original", new ContentIsOriginalField());\r
-      anEntityAdapterDefinition.addCalculatedField("to_original", new ContentToOriginalField());\r
-      anEntityAdapterDefinition.addCalculatedField("to_translations", new ContentToTranslationsField());\r
-      anEntityAdapterDefinition.addCalculatedField("to_translation", new ContentToTranslationField());\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("previews", new EntityAdapterDefinition.CalculatedField() {\r
-        public Object getValue(EntityAdapter anEntityAdapter) {\r
-          try {\r
-            return MirGlobal.localizer().adminInterface().getPreviewPages(anEntityAdapter);\r
-          }\r
-          catch (MirLocalizerExc e) {\r
-            throw new Failure("Cannot get previews for article", e);\r
-          }\r
-        }\r
-      });\r
-    }\r
-    catch (Throwable t) {\r
-      throw new MirLocalizerFailure(t.getMessage(), t);\r
-    }\r
-  }\r
-\r
-\r
-\r
-  protected void constructCommentAdapterDefinition(EntityAdapterDefinition anEntityAdapterDefinition) throws MirLocalizerFailure {\r
-    try {\r
-      anEntityAdapterDefinition.addDBDateField("creationdate", "webdb_create", configuration.getString("Mir.DefaultTimezone"));\r
-      anEntityAdapterDefinition.addCalculatedField("to_content", new ToOneRelationField("to_media", "content", "id"));\r
-      anEntityAdapterDefinition.addCalculatedField("status", new CommentToStatusField());\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("to_uploaded_media", new CommentToMediaField( "uploadedMedia" ));\r
-      anEntityAdapterDefinition.addCalculatedField("to_media_images",  new CommentToMediaField( "image" ));\r
-      anEntityAdapterDefinition.addCalculatedField("to_media_audio", new CommentToMediaField( "audio" ));\r
-      anEntityAdapterDefinition.addCalculatedField("to_media_video", new CommentToMediaField( "video" ));\r
-      anEntityAdapterDefinition.addCalculatedField("to_media_other", new CommentToMediaField( "otherMedia" ));\r
-      anEntityAdapterDefinition.addCalculatedField("to_all_uploaded_media", new CommentToMediaField( "uploadedMedia", false));\r
-      anEntityAdapterDefinition.addCalculatedField("to_all_media_images",  new CommentToMediaField( "image", false));\r
-      anEntityAdapterDefinition.addCalculatedField("to_all_media_audio", new CommentToMediaField( "audio", false));\r
-      anEntityAdapterDefinition.addCalculatedField("to_all_media_video", new CommentToMediaField( "video", false));\r
-      anEntityAdapterDefinition.addCalculatedField("to_all_media_other", new CommentToMediaField( "otherMedia", false));\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("publicurl", new ExpandedField(configuration.getString("Comment.PublicUrl")));\r
-\r
-      anEntityAdapterDefinition.addCalculatedField("description_parsed", new FilteredField("description"));\r
-      anEntityAdapterDefinition.addCalculatedField("operations",\r
-          new EntityToSimpleOperationsField(MirGlobal.localizer().adminInterface().simpleCommentOperations()));\r
-    }\r
-    catch (Throwable t) {\r
-      throw new MirLocalizerFailure(t.getMessage(), t);\r
-    }\r
-  }\r
-\r
-  public EntityAdapterModel adapterModel() throws MirLocalizerFailure, MirLocalizerExc {\r
-    EntityAdapterModel result = new EntityAdapterModel();\r
-\r
-    try {\r
-      EntityAdapterDefinition definition;\r
-\r
-      definition = new EntityAdapterDefinition();\r
-      constructContentAdapterDefinition( definition );\r
-      result.addMapping( "content", DatabaseContent.getInstance(), definition);\r
-\r
-      definition = new EntityAdapterDefinition();\r
-      constructCommentAdapterDefinition( definition );\r
-      result.addMapping( "comment", DatabaseComment.getInstance(), definition);\r
-      result.addMapping( "commentStatus", DatabaseCommentStatus.getInstance(), new EntityAdapterDefinition());\r
-\r
-      result.addMapping( "articleType", DatabaseArticleType.getInstance(), new EntityAdapterDefinition());\r
-\r
-      result.addMapping( "mediaType", DatabaseMediaType.getInstance(), new EntityAdapterDefinition());\r
-\r
-\r
-      definition = new EntityAdapterDefinition();\r
-      definition.addDBDateField("creationdate", "webdb_create", configuration.getString("Mir.DefaultTimezone"));\r
-      result.addMapping( "breakingNews", DatabaseBreaking.getInstance(), definition);\r
-\r
-      definition = new EntityAdapterDefinition();\r
-      definition.addDBDateField("creationdate", "webdb_create", configuration.getString("Mir.DefaultTimezone"));\r
-      result.addMapping( "internalMessage", DatabaseMessages.getInstance(), definition);\r
-\r
-      definition = new EntityAdapterDefinition();\r
-      definition.addCalculatedField("mediafolder", new ToOneRelationField("to_media_folder", "mediaFolder", "id"));\r
-      definition.addCalculatedField("human_readable_size", new HumanReadableSizeField("value"));\r
-      definition.addDBDateField("creationdate", "webdb_create", configuration.getString("Mir.DefaultTimezone"));\r
-      definition.addCalculatedField("info", new MediaToMediaInfoField());\r
-      result.addMapping( "uploadedMedia", DatabaseUploadedMedia.getInstance(), definition);\r
-      definition = new EntityAdapterDefinition();\r
-      definition.addCalculatedField("mediafolder", new ToOneRelationField("to_media_folder", "mediaFolder", "id"));\r
-      definition.addCalculatedField("human_readable_size", new HumanReadableSizeField("value"));\r
-      definition.addDBDateField("creationdate", "webdb_create", configuration.getString("Mir.DefaultTimezone"));\r
-      definition.addCalculatedField("info", new MediaToMediaInfoField());\r
-      definition.addCalculatedField("big_icon", new MediaToBigIconField());\r
-      result.addMapping( "image", DatabaseImages.getInstance(), definition);\r
-      definition = new EntityAdapterDefinition();\r
-      definition.addCalculatedField("mediafolder", new ToOneRelationField("to_media_folder", "mediaFolder", "id"));\r
-      definition.addCalculatedField("human_readable_size", new HumanReadableSizeField("value"));\r
-      definition.addDBDateField("creationdate", "webdb_create", configuration.getString("Mir.DefaultTimezone"));\r
-      definition.addCalculatedField("info", new MediaToMediaInfoField());\r
-      definition.addCalculatedField("big_icon", new MediaToBigIconField());\r
-      result.addMapping( "audio", DatabaseAudio.getInstance(), definition);\r
-      definition = new EntityAdapterDefinition();\r
-      definition.addCalculatedField("mediafolder", new ToOneRelationField("to_media_folder", "mediaFolder", "id"));\r
-      definition.addCalculatedField("human_readable_size", new HumanReadableSizeField("value"));\r
-      definition.addDBDateField("creationdate", "webdb_create", configuration.getString("Mir.DefaultTimezone"));\r
-      definition.addCalculatedField("info", new MediaToMediaInfoField());\r
-      definition.addCalculatedField("big_icon", new MediaToBigIconField());\r
-      result.addMapping( "video", DatabaseVideo.getInstance(), definition);\r
-\r
-      definition = new EntityAdapterDefinition();\r
-      definition.addCalculatedField("mediafolder", new ToOneRelationField("to_media_folder", "mediaFolder", "id"));\r
-      definition.addCalculatedField("human_readable_size", new HumanReadableSizeField("value"));\r
-      definition.addDBDateField("creationdate", "webdb_create", configuration.getString("Mir.DefaultTimezone"));\r
-      definition.addCalculatedField("info", new MediaToMediaInfoField());\r
-      definition.addCalculatedField("big_icon", new MediaToBigIconField());\r
-      result.addMapping( "otherMedia", DatabaseOther.getInstance(), definition);\r
-\r
-\r
-      result.addMapping( "mediaFolder", DatabaseMediafolder.getInstance(), new EntityAdapterDefinition());\r
-      result.addMapping( "imageType", DatabaseImageType.getInstance(), new EntityAdapterDefinition());\r
-      result.addMapping( "language", DatabaseLanguage.getInstance(), new EntityAdapterDefinition());\r
-      result.addMapping( "mediaType", DatabaseMediaType.getInstance(), new EntityAdapterDefinition());\r
-      result.addMapping( "topic", DatabaseTopics.getInstance(), new EntityAdapterDefinition());\r
-\r
-      definition = new EntityAdapterDefinition();\r
-      definition.addDBDateField("creationdate", "webdb_create", configuration.getString("Mir.DefaultTimezone"));\r
-      definition.addDBDateField("lastlogindate", "lastlogin", configuration.getString("Mir.DefaultTimezone"));\r
-      definition.addCalculatedField("structuredProfile", new StructuredContentField("profile"));\r
-      result.addMapping( "user", DatabaseUsers.getInstance(), definition);\r
-\r
-      result.addMapping( "content_x_topic", DatabaseContentToTopics.getInstance(), new EntityAdapterDefinition());\r
-\r
-      definition = new EntityAdapterDefinition();\r
-      definition.addCalculatedField("to_filters",\r
-          new ToManyRelationField("id", "filter", "filter_group_id", "priority asc"));\r
-      result.addMapping("filterGroup", DatabaseFilterGroup.getInstance(), definition);\r
-      definition = new EntityAdapterDefinition();\r
-      definition.addDBDateField("lasthit", "last_hit", configuration.getString("Mir.DefaultTimezone"));\r
-      definition.addCalculatedField("to_filter_group",\r
-          new ToOneRelationField("filter_group_id", "filter_group", "id"));\r
-      result.addMapping("filter", DatabaseFilter.getInstance(), definition);\r
-    }\r
-    catch (Throwable t) {\r
-      throw new MirLocalizerFailure(t.getMessage(), t);\r
-    }\r
-\r
-    return result;\r
-  }\r
-\r
-  protected class CommentToStatusField implements EntityAdapterDefinition.CalculatedField {\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        return anEntityAdapter.getToOneRelation(\r
-                    "id="+anEntityAdapter.get("to_comment_status"),\r
-                    "id",\r
-                    "commentStatus" );\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class EntityToSimpleOperationsField implements EntityAdapterDefinition.CalculatedField {\r
-    private List operations;\r
-\r
-    public EntityToSimpleOperationsField(List anOperations) {\r
-      operations = anOperations;\r
-    }\r
-\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        Iterator i = operations.iterator();\r
-        List availableOperations = new ArrayList();\r
-\r
-        while (i.hasNext()) {\r
-          MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation =\r
-            (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next();\r
-\r
-          if (operation.isAvailable(anEntityAdapter)) {\r
-            availableOperations.add(operation.getName());\r
-          }\r
-        };\r
-\r
-        return availableOperations;\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class FilteredField implements EntityAdapterDefinition.CalculatedField {\r
-    private String fieldName;\r
-\r
-    public FilteredField(String aFieldName) {\r
-      fieldName = aFieldName;\r
-    }\r
-\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        if (anEntityAdapter.get("is_html")!=null && anEntityAdapter.get("is_html").equals("1")) {\r
-          return MirGlobal.localizer().producerAssistant().filterHTMLText((String) anEntityAdapter.get(fieldName));\r
-        }\r
-        else {\r
-          return MirGlobal.localizer().producerAssistant().filterNonHTMLText((String) anEntityAdapter.get(fieldName));\r
-        }\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class StructuredContentField implements EntityAdapterDefinition.CalculatedField {\r
-    private String expression;\r
-\r
-    public StructuredContentField(String anExpression) {\r
-      expression = anExpression;\r
-    }\r
-\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        return StructuredContentParser.parse(ParameterExpander.evaluateStringExpression(anEntityAdapter, expression));\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class ExpandedField implements EntityAdapterDefinition.CalculatedField {\r
-    private String expression;\r
-\r
-    public ExpandedField(String anExpression) {\r
-      expression = anExpression;\r
-    }\r
-\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        return ParameterExpander.expandExpression(anEntityAdapter, expression);\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class EvaluatedField implements EntityAdapterDefinition.CalculatedField {\r
-    private String expression;\r
-\r
-    public EvaluatedField(String anExpression) {\r
-      expression = anExpression;\r
-    }\r
-\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        return ParameterExpander.evaluateExpression(anEntityAdapter, expression);\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class ContentToChildrenField implements EntityAdapterDefinition.CalculatedField {\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        return anEntityAdapter.getRelation(\r
-                    "to_content="+anEntityAdapter.get("id"),\r
-                    "id",\r
-                    "content" );\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-  public static class MediaInfo {\r
-    private MediaHandler mediaHandler;\r
-\r
-    public MediaInfo(MediaHandler aHandler) {\r
-      mediaHandler = aHandler;\r
-    }\r
-    public String getBigIcon() {\r
-      if (mediaHandler == null)\r
-        return "bla";\r
-      else\r
-        return mediaHandler.getBigIconName();\r
-    }\r
-\r
-    public String getSmallIcon() {\r
-      if (mediaHandler == null)\r
-        return "bla";\r
-      else\r
-        return mediaHandler.getTinyIconName();\r
-    }\r
-\r
-    public String getMediaType() {\r
-      return "";\r
-    }\r
-  }\r
-\r
-  protected class MediaToMediaInfoField implements EntityAdapterDefinition.CalculatedField {\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        MediaHandler mediaHandler = MediaHelper.getHandler(((EntityUploadedMedia) anEntityAdapter.getEntity()).getMediaType());\r
-\r
-        return new MediaInfo(mediaHandler);\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class MediaToBigIconField implements EntityAdapterDefinition.CalculatedField {\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        return MediaHelper.getHandler(((EntityUploadedMedia) anEntityAdapter.getEntity()).getMediaType()).getBigIconName();\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class ContentToCommentsField implements EntityAdapterDefinition.CalculatedField {\r
-    private String extracondition;\r
-    private String order;\r
-\r
-    public ContentToCommentsField() {\r
-      this ( " and is_published='1'", "webdb_create");\r
-    }\r
-\r
-    public ContentToCommentsField(String anExtraCondition, String anOrder) {\r
-      order = anOrder;\r
-      extracondition = anExtraCondition;\r
-    }\r
-\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        return anEntityAdapter.getRelation(\r
-                    "to_media="+anEntityAdapter.get("id")+" " + extracondition,\r
-                    order,\r
-                    "comment" );\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class ContentToTopicsField implements EntityAdapterDefinition.CalculatedField {\r
-    private String topicCondition;\r
-    private String topicOrder;\r
-\r
-    public ContentToTopicsField() {\r
-      this(null);\r
-    }\r
-\r
-    public ContentToTopicsField(String aTopicCondition) {\r
-      this(aTopicCondition, "title");\r
-    }\r
-\r
-    public ContentToTopicsField(String aTopicCondition, String aTopicOrder) {\r
-      topicCondition = aTopicCondition;\r
-      topicOrder = aTopicOrder;\r
-    }\r
-\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-\r
-        ArrayList extraTable = new ArrayList();\r
-        extraTable.add("content_x_topic cxt");\r
-        String condition = "cxt.content_id="+anEntityAdapter.get("id")+\r
-          " and cxt.topic_id=t.id";\r
-\r
-        if (topicCondition!=null && topicCondition.length()>0)\r
-          condition = "(" + topicCondition + ") and " + condition;\r
-\r
-        return anEntityAdapter.getComplexRelation("t", extraTable,\r
-                    condition, topicOrder, "topic" );\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class ContentToMediaField implements EntityAdapterDefinition.CalculatedField {\r
-    private String definition;\r
-    private boolean published;\r
-\r
-    public ContentToMediaField(String aDefinition, boolean anOnlyPublished) {\r
-      definition = aDefinition;\r
-      published = anOnlyPublished;\r
-    }\r
-\r
-    public ContentToMediaField(String aDefinition) {\r
-      this(aDefinition, true);\r
-    }\r
-\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        String condition = "cxm.content_id="+ anEntityAdapter.get("id") +\r
-          " and cxm.media_id = m.id";\r
-        if (published)\r
-          condition = "is_published='t' and " + condition;\r
-\r
-        List extraTables = new ArrayList();\r
-        extraTables.add("content_x_media cxm");\r
-\r
-        return anEntityAdapter.getComplexRelation("m", extraTables, condition, "id", definition);\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class ContentToFirstMediaField implements EntityAdapterDefinition.CalculatedField {\r
-    private String definition;\r
-    private boolean published;\r
-\r
-    public ContentToFirstMediaField(String aDefinition, boolean anOnlyPublished) {\r
-      definition = aDefinition;\r
-      published = anOnlyPublished;\r
-    }\r
-\r
-    public ContentToFirstMediaField(String aDefinition) {\r
-      this(aDefinition, true);\r
-    }\r
-\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        String condition = "cxm.content_id="+ anEntityAdapter.get("id") +\r
-          " and cxm.media_id = m.id";\r
-        if (published)\r
-          condition = "is_published='t' and " + condition;\r
-\r
-        List extraTables = new ArrayList();\r
-        extraTables.add("content_x_media cxm");\r
-\r
-        return anEntityAdapter.getComplexToOneRelation("m", extraTables, condition, "id", definition);\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class CommentToMediaField implements EntityAdapterDefinition.CalculatedField {\r
-    private String definition;\r
-    private boolean published;\r
-\r
-    public CommentToMediaField(String aDefinition, boolean anOnlyPublished) {\r
-      definition = aDefinition;\r
-      published = anOnlyPublished;\r
-    }\r
-\r
-    public CommentToMediaField(String aDefinition) {\r
-      this(aDefinition, true);\r
-    }\r
-\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-\r
-        String condition = "cxm.comment_id="+ anEntityAdapter.get("id") +\r
-                  " and cxm.media_id = m.id";\r
-        if (published)\r
-           condition = "is_published='t' and " + condition;\r
-\r
-        List extraTables = new ArrayList();\r
-        extraTables.add("comment_x_media cxm");\r
-        return anEntityAdapter.getComplexRelation("m", extraTables, condition, "id", definition);\r
-\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class ContentToIconField implements EntityAdapterDefinition.CalculatedField {\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      EntityAdapter media;\r
-      Entity mediaType;\r
-      RewindableIterator iterator;\r
-      Map result;\r
-      MediaHandler mediaHandler;\r
-      String tinyIcon;\r
-      String iconAlt;\r
-\r
-      try {\r
-        iterator = (RewindableIterator) (anEntityAdapter.get("to_uploaded_media"));\r
-        iterator.rewind();\r
-\r
-        tinyIcon = MirGlobal.config().getString("Producer.Icon.TinyText");\r
-        iconAlt = "Text";\r
-\r
-        if (iterator.hasNext()) {\r
-          media = (EntityAdapter) iterator.next();\r
-\r
-          mediaType = ((EntityUploadedMedia) (media.getEntity())).getMediaType();\r
-          mediaHandler = MediaHelper.getHandler( mediaType );\r
-\r
-          tinyIcon = mediaHandler.getTinyIconName();\r
-          iconAlt = mediaHandler.getIconAltName();\r
-        }\r
-      }\r
-      catch (Throwable t) {\r
-        logger.error("ContentToIconField: " +t.getMessage());\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-\r
-      result = new HashMap();\r
-      result.put("tiny_icon", MirGlobal.config().getString("Producer.ImageRoot") + "/" + tinyIcon);\r
-      result.put("icon_alt", iconAlt);\r
-\r
-      return result;\r
-    }\r
-  }\r
-\r
-  protected class ContentCommentCountField implements EntityAdapterDefinition.CalculatedField {\r
-    private String extraCondition;\r
-\r
-    public ContentCommentCountField(String anExtraCondition) {\r
-      super();\r
-\r
-      extraCondition = anExtraCondition;\r
-    }\r
-\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        return Integer.toString(\r
-            DatabaseComment.getInstance().getSize(\r
-                  "to_media="+anEntityAdapter.get("id")+" " + extraCondition));\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class HumanReadableSizeField implements EntityAdapterDefinition.CalculatedField {\r
-      private String fieldName;\r
-\r
-      public HumanReadableSizeField(String aFieldName) {\r
-        fieldName= aFieldName;\r
-      }\r
-\r
-      public Object getValue(EntityAdapter anEntityAdapter) {\r
-        try {\r
-          String size = (String) anEntityAdapter.get(fieldName);\r
-          if (size!=null)\r
-            return NumberUtils.humanReadableSize(Double.parseDouble(size));\r
-          else\r
-            return "";\r
-        }\r
-        catch (Throwable t) {\r
-          throw new RuntimeException(t.getMessage());\r
-        }\r
-      }\r
-    }\r
-\r
-\r
-  protected class ContentMediaCountField implements EntityAdapterDefinition.CalculatedField {\r
-    private String table;\r
-    private boolean published;\r
-\r
-    public ContentMediaCountField(String aTable, boolean anOnlyPublished) {\r
-      table = aTable;\r
-      published = anOnlyPublished;\r
-    }\r
-\r
-    public ContentMediaCountField(String aTable) {\r
-      this(aTable, true);\r
-    }\r
-\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        ArrayList extraTable = new ArrayList();\r
-        extraTable.add(table+" m");\r
-        String selectSql = "cxm.media_id=m.id and cxm.content_id="+\r
-          anEntityAdapter.get("id");\r
-        if (published)\r
-          selectSql+= " and m.is_published='t'";\r
-\r
-        return Integer.toString(\r
-            DatabaseContentToMedia.getInstance().getSize(\r
-              "cxm", extraTable, selectSql));\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class ContentToIsLockedField implements EntityAdapterDefinition.CalculatedField {\r
-    private ModuleContent contentModule;\r
-\r
-    public ContentToIsLockedField() {\r
-      contentModule = new ModuleContent();\r
-    }\r
-\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        return new Boolean(contentModule.queryArticleLock(anEntityAdapter.getEntity().getId())!=null);\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-    protected class ContentIsOriginalField implements EntityAdapterDefinition.CalculatedField {\r
-    public Object getValue(EntityAdapter anEntityAdapter) throws MirLocalizerFailure {\r
-      try {\r
-\r
-        //ML: add check on article type\r
-        boolean result = (anEntityAdapter.get("parent")==null);\r
-\r
-        return new Boolean(result);\r
-      }\r
-      catch (Throwable t) {\r
-        throw new MirLocalizerFailure(t);\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class ContentToOriginalField implements EntityAdapterDefinition.CalculatedField {\r
-    public Object getValue(EntityAdapter anEntityAdapter) throws MirLocalizerFailure {\r
-      try {\r
-        if (anEntityAdapter.get("parent")!=null)\r
-          return anEntityAdapter.get("parent");\r
-        else\r
-          return anEntityAdapter;\r
-      }\r
-      catch (Throwable t) {\r
-        throw new MirLocalizerFailure(t);\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class ContentToTranslationsField implements EntityAdapterDefinition.CalculatedField {\r
-    public Object getValue(EntityAdapter anEntityAdapter) {\r
-      try {\r
-        return anEntityAdapter.getRelation(\r
-                    "is_published='t' and to_content="+anEntityAdapter.get("id"),\r
-                    "id",\r
-                    "content" );\r
-      }\r
-      catch (Throwable t) {\r
-        throw new RuntimeException(t.getMessage());\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class ContentToLanguageNameField implements EntityAdapterDefinition.CalculatedField {\r
-    public Object getValue(EntityAdapter anEntityAdapter) throws MirLocalizerFailure {\r
-      try {\r
-        String result = "";\r
-        EntityAdapter language = (EntityAdapter) anEntityAdapter.get("language");\r
-        if (language != null) {\r
-          if (language.get("code").equals("ot")) {\r
-            result = ((String) anEntityAdapter.get("subtitle")).trim();\r
-            if (result == null || result.equals(""))\r
-              result = (String) language.get("name");\r
-          } else {\r
-            result = (String) language.get("name");\r
-          }\r
-        }\r
-\r
-        return result;\r
-      }\r
-      catch (Throwable t) {\r
-        throw new MirLocalizerFailure(t);\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class ContentToTranslationFunction implements Generator.Function {\r
-    private EntityAdapter target;\r
-    private String targetId;\r
-    private String targetLanguageId;\r
-\r
-    public ContentToTranslationFunction(EntityAdapter aTarget) {\r
-      target = aTarget;\r
-      targetId = (String) target.get("id");\r
-      targetLanguageId = (String) target.get("to_language");\r
-    }\r
-\r
-    public Object perform(List aParameters) throws GeneratorExc, GeneratorFailure {\r
-      if (aParameters.size()!=1 || !(aParameters.get(0) instanceof String))\r
-        throw new GeneratorExc("1 string parameter expected");\r
-\r
-      try {\r
-        String language = (String) aParameters.get(0);\r
-        String languageId = languageModule.languageIdForCode(language);\r
-        Object result = null;\r
-\r
-        if (languageId != null && !targetLanguageId.equals(languageId)) {\r
-          result = target.getToOneRelation(\r
-              "is_published='t' and to_content=" + targetId + " and to_language='" + JDBCStringRoutines.escapeStringLiteral(languageId) + "'",\r
-              "id", "content");\r
-        }\r
-\r
-        if (result == null)\r
-          result = target;\r
-\r
-        return result;\r
-      }\r
-      catch (Throwable t) {\r
-        t.printStackTrace(System.out);\r
-        throw new GeneratorFailure(t);\r
-      }\r
-    }\r
-  }\r
-\r
-  protected class ContentToTranslationField implements EntityAdapterDefinition.CalculatedField {\r
-    public Object getValue(EntityAdapter anEntityAdapter) throws MirLocalizerFailure {\r
-      try {\r
-        return new ContentToTranslationFunction((EntityAdapter) anEntityAdapter.get("to_original"));\r
-      }\r
-      catch (Throwable t) {\r
-        throw new MirLocalizerFailure(t);\r
-      }\r
-    }\r
-  }\r
-}\r
-\r
+/*
+ * 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.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+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.entity.adapter.ToManyRelationField;
+import mir.entity.adapter.ToOneRelationField;
+import mir.generator.Generator;
+import mir.generator.GeneratorExc;
+import mir.generator.GeneratorFailure;
+import mir.log.LoggerWrapper;
+import mir.media.MediaHandler;
+import mir.misc.NumberUtils;
+import mir.util.JDBCStringRoutines;
+import mir.util.ParameterExpander;
+import mir.util.RewindableIterator;
+import mir.util.StructuredContentParser;
+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.media.MediaHelper;
+import mircoders.module.ModuleContent;
+import mircoders.module.ModuleLanguage;
+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.DatabaseContentToMedia;
+import mircoders.storage.DatabaseContentToTopics;
+import mircoders.storage.DatabaseFilter;
+import mircoders.storage.DatabaseFilterGroup;
+import mircoders.storage.DatabaseImageType;
+import mircoders.storage.DatabaseImages;
+import mircoders.storage.DatabaseLanguage;
+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;
+import multex.Failure;
+
+public class MirBasicDataModelLocalizer implements MirDataModelLocalizer {
+  protected LoggerWrapper logger = new LoggerWrapper("Localizer.DataModel");
+  protected MirPropertiesConfiguration configuration = MirPropertiesConfiguration.instance();
+  protected ModuleLanguage languageModule = new ModuleLanguage();
+
+  protected void constructContentAdapterDefinition(EntityAdapterDefinition anEntityAdapterDefinition) throws MirLocalizerFailure, MirLocalizerExc {
+    try {
+      anEntityAdapterDefinition.addDBDateField("creationdate", "webdb_create", configuration.getString("Mir.DefaultTimezone"));
+      anEntityAdapterDefinition.addDBDateField("changedate", "webdb_lastchange", configuration.getString("Mir.DefaultTimezone"));
+      anEntityAdapterDefinition.addMirDateField("date", "date", configuration.getString("Mir.DefaultTimezone"));
+
+      anEntityAdapterDefinition.addCalculatedField("lockinguser", new ToOneRelationField("to_locking_user", "id", "user"));
+      anEntityAdapterDefinition.addCalculatedField("is_locked", new ContentToIsLockedField());
+
+      anEntityAdapterDefinition.addCalculatedField("to_topics", new ContentToTopicsField());
+      anEntityAdapterDefinition.addCalculatedField("to_comments", new ContentToCommentsField());
+      anEntityAdapterDefinition.addCalculatedField("language", new ToOneRelationField("to_language", "language", "id"));
+      anEntityAdapterDefinition.addCalculatedField("commentcount", new ContentCommentCountField(" and is_published='1'"));
+      anEntityAdapterDefinition.addCalculatedField("fullcommentcount", new ContentCommentCountField(""));
+
+
+      anEntityAdapterDefinition.addCalculatedField("mediacount", new ContentMediaCountField("uploaded_media", true));
+      anEntityAdapterDefinition.addCalculatedField("fullmediacount", new ContentMediaCountField("uploaded_media", false));
+
+      anEntityAdapterDefinition.addCalculatedField("to_uploaded_media", new ContentToMediaField( "uploadedMedia" ));
+      anEntityAdapterDefinition.addCalculatedField("to_media_images",  new ContentToMediaField( "image" ));
+      anEntityAdapterDefinition.addCalculatedField("to_media_audio", new ContentToMediaField( "audio" ));
+      anEntityAdapterDefinition.addCalculatedField("to_media_video", new ContentToMediaField( "video" ));
+      anEntityAdapterDefinition.addCalculatedField("to_media_other", new ContentToMediaField( "otherMedia" ));
+
+      anEntityAdapterDefinition.addCalculatedField("firstImage",  new ContentToFirstMediaField( "image" ));
+      anEntityAdapterDefinition.addCalculatedField("firstAudio", new ContentToFirstMediaField( "audio" ));
+      anEntityAdapterDefinition.addCalculatedField("firstVideo", new ContentToFirstMediaField( "video" ));
+      anEntityAdapterDefinition.addCalculatedField("firstOther", new ContentToFirstMediaField( "otherMedia" ));
+
+      anEntityAdapterDefinition.addCalculatedField("to_all_uploaded_media", new ContentToMediaField( "uploadedMedia", false));
+      anEntityAdapterDefinition.addCalculatedField("to_all_media_images",  new ContentToMediaField( "image", false));
+      anEntityAdapterDefinition.addCalculatedField("to_all_media_audio", new ContentToMediaField( "audio", false));
+      anEntityAdapterDefinition.addCalculatedField("to_all_media_video", new ContentToMediaField( "video", false));
+      anEntityAdapterDefinition.addCalculatedField("to_all_media_other", new ContentToMediaField( "otherMedia", false));
+      anEntityAdapterDefinition.addCalculatedField("to_media_icon", new ContentToIconField());
+
+      anEntityAdapterDefinition.addCalculatedField("article_type", new ToOneRelationField("to_article_type", "articleType", "id"));
+
+      anEntityAdapterDefinition.addCalculatedField("description_parsed", new FilteredField("description"));
+      anEntityAdapterDefinition.addCalculatedField("content_data_parsed", new FilteredField("content_data"));
+
+      anEntityAdapterDefinition.addCalculatedField("children", new ContentToChildrenField());
+      anEntityAdapterDefinition.addCalculatedField("parent", new ToOneRelationField("to_content", "content", "id"));
+
+      anEntityAdapterDefinition.addCalculatedField("publicurl", new ExpandedField(configuration.getString("Article.PublicUrl")));
+
+      anEntityAdapterDefinition.addCalculatedField("operations",
+          new EntityToSimpleOperationsField(MirGlobal.localizer().adminInterface().simpleArticleOperations()));
+      
+      anEntityAdapterDefinition.addCalculatedField("languagename", new ContentToLanguageNameField());
+
+      anEntityAdapterDefinition.addCalculatedField("is_original", new ContentIsOriginalField());
+      anEntityAdapterDefinition.addCalculatedField("to_original", new ContentToOriginalField());
+      anEntityAdapterDefinition.addCalculatedField("to_translations", new ContentToTranslationsField());
+      anEntityAdapterDefinition.addCalculatedField("to_translation", new ContentToTranslationField());
+
+      anEntityAdapterDefinition.addCalculatedField("previews", new EntityAdapterDefinition.CalculatedField() {
+        public Object getValue(EntityAdapter anEntityAdapter) {
+          try {
+            return MirGlobal.localizer().adminInterface().getPreviewPages(anEntityAdapter);
+          }
+          catch (MirLocalizerExc e) {
+            throw new Failure("Cannot get previews for article", e);
+          }
+        }
+      });
+    }
+    catch (Throwable t) {
+      throw new MirLocalizerFailure(t.getMessage(), t);
+    }
+  }
+
+
+
+  protected void constructCommentAdapterDefinition(EntityAdapterDefinition anEntityAdapterDefinition) throws MirLocalizerFailure {
+    try {
+      anEntityAdapterDefinition.addDBDateField("creationdate", "webdb_create", configuration.getString("Mir.DefaultTimezone"));
+      anEntityAdapterDefinition.addCalculatedField("to_content", new ToOneRelationField("to_media", "content", "id"));
+      anEntityAdapterDefinition.addCalculatedField("status", new CommentToStatusField());
+
+      anEntityAdapterDefinition.addCalculatedField("to_uploaded_media", new CommentToMediaField( "uploadedMedia" ));
+      anEntityAdapterDefinition.addCalculatedField("to_media_images",  new CommentToMediaField( "image" ));
+      anEntityAdapterDefinition.addCalculatedField("to_media_audio", new CommentToMediaField( "audio" ));
+      anEntityAdapterDefinition.addCalculatedField("to_media_video", new CommentToMediaField( "video" ));
+      anEntityAdapterDefinition.addCalculatedField("to_media_other", new CommentToMediaField( "otherMedia" ));
+      anEntityAdapterDefinition.addCalculatedField("to_all_uploaded_media", new CommentToMediaField( "uploadedMedia", false));
+      anEntityAdapterDefinition.addCalculatedField("to_all_media_images",  new CommentToMediaField( "image", false));
+      anEntityAdapterDefinition.addCalculatedField("to_all_media_audio", new CommentToMediaField( "audio", false));
+      anEntityAdapterDefinition.addCalculatedField("to_all_media_video", new CommentToMediaField( "video", false));
+      anEntityAdapterDefinition.addCalculatedField("to_all_media_other", new CommentToMediaField( "otherMedia", false));
+
+      anEntityAdapterDefinition.addCalculatedField("publicurl", new ExpandedField(configuration.getString("Comment.PublicUrl")));
+
+      anEntityAdapterDefinition.addCalculatedField("description_parsed", new FilteredField("description"));
+      anEntityAdapterDefinition.addCalculatedField("operations",
+          new EntityToSimpleOperationsField(MirGlobal.localizer().adminInterface().simpleCommentOperations()));
+    }
+    catch (Throwable t) {
+      throw new MirLocalizerFailure(t.getMessage(), t);
+    }
+  }
+
+  public EntityAdapterModel adapterModel() throws MirLocalizerFailure, MirLocalizerExc {
+    EntityAdapterModel result = new EntityAdapterModel();
+
+    try {
+      EntityAdapterDefinition definition;
+
+      definition = new EntityAdapterDefinition();
+      constructContentAdapterDefinition( definition );
+      result.addMapping( "content", DatabaseContent.getInstance(), definition);
+
+      definition = new EntityAdapterDefinition();
+      constructCommentAdapterDefinition( definition );
+      result.addMapping( "comment", DatabaseComment.getInstance(), definition);
+      result.addMapping( "commentStatus", DatabaseCommentStatus.getInstance(), new EntityAdapterDefinition());
+
+      result.addMapping( "articleType", DatabaseArticleType.getInstance(), new EntityAdapterDefinition());
+
+      result.addMapping( "mediaType", DatabaseMediaType.getInstance(), new EntityAdapterDefinition());
+
+
+      definition = new EntityAdapterDefinition();
+      definition.addDBDateField("creationdate", "webdb_create", configuration.getString("Mir.DefaultTimezone"));
+      result.addMapping( "breakingNews", DatabaseBreaking.getInstance(), definition);
+
+      definition = new EntityAdapterDefinition();
+      definition.addDBDateField("creationdate", "webdb_create", configuration.getString("Mir.DefaultTimezone"));
+      result.addMapping( "internalMessage", DatabaseMessages.getInstance(), definition);
+
+      definition = new EntityAdapterDefinition();
+      definition.addCalculatedField("mediafolder", new ToOneRelationField("to_media_folder", "mediaFolder", "id"));
+      definition.addCalculatedField("human_readable_size", new HumanReadableSizeField("value"));
+      definition.addDBDateField("creationdate", "webdb_create", configuration.getString("Mir.DefaultTimezone"));
+      definition.addCalculatedField("info", new MediaToMediaInfoField());
+      result.addMapping( "uploadedMedia", DatabaseUploadedMedia.getInstance(), definition);
+      definition = new EntityAdapterDefinition();
+      definition.addCalculatedField("mediafolder", new ToOneRelationField("to_media_folder", "mediaFolder", "id"));
+      definition.addCalculatedField("human_readable_size", new HumanReadableSizeField("value"));
+      definition.addDBDateField("creationdate", "webdb_create", configuration.getString("Mir.DefaultTimezone"));
+      definition.addCalculatedField("info", new MediaToMediaInfoField());
+      definition.addCalculatedField("big_icon", new MediaToBigIconField());
+      result.addMapping( "image", DatabaseImages.getInstance(), definition);
+      definition = new EntityAdapterDefinition();
+      definition.addCalculatedField("mediafolder", new ToOneRelationField("to_media_folder", "mediaFolder", "id"));
+      definition.addCalculatedField("human_readable_size", new HumanReadableSizeField("value"));
+      definition.addDBDateField("creationdate", "webdb_create", configuration.getString("Mir.DefaultTimezone"));
+      definition.addCalculatedField("info", new MediaToMediaInfoField());
+      definition.addCalculatedField("big_icon", new MediaToBigIconField());
+      result.addMapping( "audio", DatabaseAudio.getInstance(), definition);
+      definition = new EntityAdapterDefinition();
+      definition.addCalculatedField("mediafolder", new ToOneRelationField("to_media_folder", "mediaFolder", "id"));
+      definition.addCalculatedField("human_readable_size", new HumanReadableSizeField("value"));
+      definition.addDBDateField("creationdate", "webdb_create", configuration.getString("Mir.DefaultTimezone"));
+      definition.addCalculatedField("info", new MediaToMediaInfoField());
+      definition.addCalculatedField("big_icon", new MediaToBigIconField());
+      result.addMapping( "video", DatabaseVideo.getInstance(), definition);
+
+      definition = new EntityAdapterDefinition();
+      definition.addCalculatedField("mediafolder", new ToOneRelationField("to_media_folder", "mediaFolder", "id"));
+      definition.addCalculatedField("human_readable_size", new HumanReadableSizeField("value"));
+      definition.addDBDateField("creationdate", "webdb_create", configuration.getString("Mir.DefaultTimezone"));
+      definition.addCalculatedField("info", new MediaToMediaInfoField());
+      definition.addCalculatedField("big_icon", new MediaToBigIconField());
+      result.addMapping( "otherMedia", DatabaseOther.getInstance(), definition);
+
+
+      result.addMapping( "mediaFolder", DatabaseMediafolder.getInstance(), new EntityAdapterDefinition());
+      result.addMapping( "imageType", DatabaseImageType.getInstance(), new EntityAdapterDefinition());
+      result.addMapping( "language", DatabaseLanguage.getInstance(), new EntityAdapterDefinition());
+      result.addMapping( "mediaType", DatabaseMediaType.getInstance(), new EntityAdapterDefinition());
+      result.addMapping( "topic", DatabaseTopics.getInstance(), new EntityAdapterDefinition());
+
+      definition = new EntityAdapterDefinition();
+      definition.addDBDateField("creationdate", "webdb_create", configuration.getString("Mir.DefaultTimezone"));
+      definition.addDBDateField("lastlogindate", "lastlogin", configuration.getString("Mir.DefaultTimezone"));
+      definition.addCalculatedField("structuredProfile", new StructuredContentField("profile"));
+      result.addMapping( "user", DatabaseUsers.getInstance(), definition);
+
+      result.addMapping( "content_x_topic", DatabaseContentToTopics.getInstance(), new EntityAdapterDefinition());
+
+      definition = new EntityAdapterDefinition();
+      definition.addCalculatedField("to_filters",
+          new ToManyRelationField("id", "filter", "filter_group_id", "priority asc"));
+      result.addMapping("filterGroup", DatabaseFilterGroup.getInstance(), definition);
+      definition = new EntityAdapterDefinition();
+      definition.addDBDateField("lasthit", "last_hit", configuration.getString("Mir.DefaultTimezone"));
+      definition.addCalculatedField("to_filter_group",
+          new ToOneRelationField("filter_group_id", "filter_group", "id"));
+      result.addMapping("filter", DatabaseFilter.getInstance(), definition);
+    }
+    catch (Throwable t) {
+      throw new MirLocalizerFailure(t.getMessage(), t);
+    }
+
+    return result;
+  }
+
+  protected class CommentToStatusField implements EntityAdapterDefinition.CalculatedField {
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        return anEntityAdapter.getToOneRelation(
+                    "id="+anEntityAdapter.get("to_comment_status"),
+                    "id",
+                    "commentStatus" );
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class EntityToSimpleOperationsField implements EntityAdapterDefinition.CalculatedField {
+    private List operations;
+
+    public EntityToSimpleOperationsField(List anOperations) {
+      operations = anOperations;
+    }
+
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        Iterator i = operations.iterator();
+        List availableOperations = new ArrayList();
+
+        while (i.hasNext()) {
+          MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation =
+            (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next();
+
+          if (operation.isAvailable(anEntityAdapter)) {
+            availableOperations.add(operation.getName());
+          }
+        }
+
+        return availableOperations;
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class FilteredField implements EntityAdapterDefinition.CalculatedField {
+    private String fieldName;
+
+    public FilteredField(String aFieldName) {
+      fieldName = aFieldName;
+    }
+
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        if (anEntityAdapter.get("is_html")!=null && anEntityAdapter.get("is_html").equals("1")) {
+          return MirGlobal.localizer().producerAssistant().filterHTMLText((String) anEntityAdapter.get(fieldName));
+        }
+                               return MirGlobal.localizer().producerAssistant().filterNonHTMLText((String) anEntityAdapter.get(fieldName));
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class StructuredContentField implements EntityAdapterDefinition.CalculatedField {
+    private String expression;
+
+    public StructuredContentField(String anExpression) {
+      expression = anExpression;
+    }
+
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        return StructuredContentParser.parse(ParameterExpander.evaluateStringExpression(anEntityAdapter, expression));
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class ExpandedField implements EntityAdapterDefinition.CalculatedField {
+    private String expression;
+
+    public ExpandedField(String anExpression) {
+      expression = anExpression;
+    }
+
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        return ParameterExpander.expandExpression(anEntityAdapter, expression);
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class EvaluatedField implements EntityAdapterDefinition.CalculatedField {
+    private String expression;
+
+    public EvaluatedField(String anExpression) {
+      expression = anExpression;
+    }
+
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        return ParameterExpander.evaluateExpression(anEntityAdapter, expression);
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class ContentToChildrenField implements EntityAdapterDefinition.CalculatedField {
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        return anEntityAdapter.getRelation(
+                    "to_content="+anEntityAdapter.get("id"),
+                    "id",
+                    "content" );
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+  public static class MediaInfo {
+    private MediaHandler mediaHandler;
+
+    public MediaInfo(MediaHandler aHandler) {
+      mediaHandler = aHandler;
+    }
+    public String getBigIcon() {
+      if (mediaHandler == null)
+        return "bla";
+                       return mediaHandler.getBigIconName();
+    }
+
+    public String getSmallIcon() {
+      if (mediaHandler == null)
+        return "bla";
+                       return mediaHandler.getTinyIconName();
+    }
+
+    public String getMediaType() {
+      return "";
+    }
+  }
+
+  protected class MediaToMediaInfoField implements EntityAdapterDefinition.CalculatedField {
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        MediaHandler mediaHandler = MediaHelper.getHandler(((EntityUploadedMedia) anEntityAdapter.getEntity()).getMediaType());
+
+        return new MediaInfo(mediaHandler);
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class MediaToBigIconField implements EntityAdapterDefinition.CalculatedField {
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        return MediaHelper.getHandler(((EntityUploadedMedia) anEntityAdapter.getEntity()).getMediaType()).getBigIconName();
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class ContentToCommentsField implements EntityAdapterDefinition.CalculatedField {
+    private String extracondition;
+    private String order;
+
+    public ContentToCommentsField() {
+      this ( " and is_published='1'", "webdb_create");
+    }
+
+    public ContentToCommentsField(String anExtraCondition, String anOrder) {
+      order = anOrder;
+      extracondition = anExtraCondition;
+    }
+
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        return anEntityAdapter.getRelation(
+                    "to_media="+anEntityAdapter.get("id")+" " + extracondition,
+                    order,
+                    "comment" );
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class ContentToTopicsField implements EntityAdapterDefinition.CalculatedField {
+    private String topicCondition;
+    private String topicOrder;
+
+    public ContentToTopicsField() {
+      this(null);
+    }
+
+    public ContentToTopicsField(String aTopicCondition) {
+      this(aTopicCondition, "title");
+    }
+
+    public ContentToTopicsField(String aTopicCondition, String aTopicOrder) {
+      topicCondition = aTopicCondition;
+      topicOrder = aTopicOrder;
+    }
+
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+
+        ArrayList extraTable = new ArrayList();
+        extraTable.add("content_x_topic cxt");
+        String condition = "cxt.content_id="+anEntityAdapter.get("id")+
+          " and cxt.topic_id=t.id";
+
+        if (topicCondition!=null && topicCondition.length()>0)
+          condition = "(" + topicCondition + ") and " + condition;
+
+        return anEntityAdapter.getComplexRelation("t", extraTable,
+                    condition, topicOrder, "topic" );
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class ContentToMediaField implements EntityAdapterDefinition.CalculatedField {
+    private String definition;
+    private boolean published;
+
+    public ContentToMediaField(String aDefinition, boolean anOnlyPublished) {
+      definition = aDefinition;
+      published = anOnlyPublished;
+    }
+
+    public ContentToMediaField(String aDefinition) {
+      this(aDefinition, true);
+    }
+
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        String condition = "cxm.content_id="+ anEntityAdapter.get("id") +
+          " and cxm.media_id = m.id";
+        if (published)
+          condition = "is_published='t' and " + condition;
+
+        List extraTables = new ArrayList();
+        extraTables.add("content_x_media cxm");
+
+        return anEntityAdapter.getComplexRelation("m", extraTables, condition, "id", definition);
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class ContentToFirstMediaField implements EntityAdapterDefinition.CalculatedField {
+    private String definition;
+    private boolean published;
+
+    public ContentToFirstMediaField(String aDefinition, boolean anOnlyPublished) {
+      definition = aDefinition;
+      published = anOnlyPublished;
+    }
+
+    public ContentToFirstMediaField(String aDefinition) {
+      this(aDefinition, true);
+    }
+
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        String condition = "cxm.content_id="+ anEntityAdapter.get("id") +
+          " and cxm.media_id = m.id";
+        if (published)
+          condition = "is_published='t' and " + condition;
+
+        List extraTables = new ArrayList();
+        extraTables.add("content_x_media cxm");
+
+        return anEntityAdapter.getComplexToOneRelation("m", extraTables, condition, "id", definition);
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class CommentToMediaField implements EntityAdapterDefinition.CalculatedField {
+    private String definition;
+    private boolean published;
+
+    public CommentToMediaField(String aDefinition, boolean anOnlyPublished) {
+      definition = aDefinition;
+      published = anOnlyPublished;
+    }
+
+    public CommentToMediaField(String aDefinition) {
+      this(aDefinition, true);
+    }
+
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+
+        String condition = "cxm.comment_id="+ anEntityAdapter.get("id") +
+                  " and cxm.media_id = m.id";
+        if (published)
+           condition = "is_published='t' and " + condition;
+
+        List extraTables = new ArrayList();
+        extraTables.add("comment_x_media cxm");
+        return anEntityAdapter.getComplexRelation("m", extraTables, condition, "id", definition);
+
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class ContentToIconField implements EntityAdapterDefinition.CalculatedField {
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      EntityAdapter media;
+      Entity mediaType;
+      RewindableIterator iterator;
+      Map result;
+      MediaHandler mediaHandler;
+      String tinyIcon;
+      String iconAlt;
+
+      try {
+        iterator = (RewindableIterator) (anEntityAdapter.get("to_uploaded_media"));
+        iterator.rewind();
+
+        tinyIcon = MirGlobal.config().getString("Producer.Icon.TinyText");
+        iconAlt = "Text";
+
+        if (iterator.hasNext()) {
+          media = (EntityAdapter) iterator.next();
+
+          mediaType = ((EntityUploadedMedia) (media.getEntity())).getMediaType();
+          mediaHandler = MediaHelper.getHandler( mediaType );
+
+          tinyIcon = mediaHandler.getTinyIconName();
+          iconAlt = mediaHandler.getIconAltName();
+        }
+      }
+      catch (Throwable t) {
+        logger.error("ContentToIconField: " +t.getMessage());
+        throw new RuntimeException(t.getMessage());
+      }
+
+      result = new HashMap();
+      result.put("tiny_icon", MirGlobal.config().getString("Producer.ImageRoot") + "/" + tinyIcon);
+      result.put("icon_alt", iconAlt);
+
+      return result;
+    }
+  }
+
+  protected class ContentCommentCountField implements EntityAdapterDefinition.CalculatedField {
+    private String extraCondition;
+
+    public ContentCommentCountField(String anExtraCondition) {
+      super();
+
+      extraCondition = anExtraCondition;
+    }
+
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        return Integer.toString(
+            DatabaseComment.getInstance().getSize(
+                  "to_media="+anEntityAdapter.get("id")+" " + extraCondition));
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class HumanReadableSizeField implements EntityAdapterDefinition.CalculatedField {
+      private String fieldName;
+
+      public HumanReadableSizeField(String aFieldName) {
+        fieldName= aFieldName;
+      }
+
+      public Object getValue(EntityAdapter anEntityAdapter) {
+        try {
+          String size = (String) anEntityAdapter.get(fieldName);
+          if (size!=null)
+            return NumberUtils.humanReadableSize(Double.parseDouble(size));
+                                       return "";
+        }
+        catch (Throwable t) {
+          throw new RuntimeException(t.getMessage());
+        }
+      }
+    }
+
+
+  protected class ContentMediaCountField implements EntityAdapterDefinition.CalculatedField {
+    private String table;
+    private boolean published;
+
+    public ContentMediaCountField(String aTable, boolean anOnlyPublished) {
+      table = aTable;
+      published = anOnlyPublished;
+    }
+
+    public ContentMediaCountField(String aTable) {
+      this(aTable, true);
+    }
+
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        ArrayList extraTable = new ArrayList();
+        extraTable.add(table+" m");
+        String selectSql = "cxm.media_id=m.id and cxm.content_id="+
+          anEntityAdapter.get("id");
+        if (published)
+          selectSql+= " and m.is_published='t'";
+
+        return Integer.toString(
+            DatabaseContentToMedia.getInstance().getSize(
+              "cxm", extraTable, selectSql));
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class ContentToIsLockedField implements EntityAdapterDefinition.CalculatedField {
+    private ModuleContent contentModule;
+
+    public ContentToIsLockedField() {
+      contentModule = new ModuleContent();
+    }
+
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        return new Boolean(contentModule.queryArticleLock(anEntityAdapter.getEntity().getId())!=null);
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+    protected class ContentIsOriginalField implements EntityAdapterDefinition.CalculatedField {
+    public Object getValue(EntityAdapter anEntityAdapter) throws MirLocalizerFailure {
+      try {
+
+        //ML: add check on article type
+        boolean result = (anEntityAdapter.get("parent")==null);
+
+        return new Boolean(result);
+      }
+      catch (Throwable t) {
+        throw new MirLocalizerFailure(t);
+      }
+    }
+  }
+
+  protected class ContentToOriginalField implements EntityAdapterDefinition.CalculatedField {
+    public Object getValue(EntityAdapter anEntityAdapter) throws MirLocalizerFailure {
+      try {
+        if (anEntityAdapter.get("parent")!=null)
+          return anEntityAdapter.get("parent");
+                               return anEntityAdapter;
+      }
+      catch (Throwable t) {
+        throw new MirLocalizerFailure(t);
+      }
+    }
+  }
+
+  protected class ContentToTranslationsField implements EntityAdapterDefinition.CalculatedField {
+    public Object getValue(EntityAdapter anEntityAdapter) {
+      try {
+        return anEntityAdapter.getRelation(
+                    "is_published='t' and to_content="+anEntityAdapter.get("id"),
+                    "id",
+                    "content" );
+      }
+      catch (Throwable t) {
+        throw new RuntimeException(t.getMessage());
+      }
+    }
+  }
+
+  protected class ContentToLanguageNameField implements EntityAdapterDefinition.CalculatedField {
+    public Object getValue(EntityAdapter anEntityAdapter) throws MirLocalizerFailure {
+      try {
+        String result = "";
+        EntityAdapter language = (EntityAdapter) anEntityAdapter.get("language");
+        if (language != null) {
+          if (language.get("code").equals("ot")) {
+            result = ((String) anEntityAdapter.get("subtitle")).trim();
+            if (result == null || result.equals(""))
+              result = (String) language.get("name");
+          } else {
+            result = (String) language.get("name");
+          }
+        }
+
+        return result;
+      }
+      catch (Throwable t) {
+        throw new MirLocalizerFailure(t);
+      }
+    }
+  }
+
+  protected class ContentToTranslationFunction implements Generator.Function {
+    private EntityAdapter target;
+    private String targetId;
+    private String targetLanguageId;
+
+    public ContentToTranslationFunction(EntityAdapter aTarget) {
+      target = aTarget;
+      targetId = (String) target.get("id");
+      targetLanguageId = (String) target.get("to_language");
+    }
+
+    public Object perform(List aParameters) throws GeneratorExc, GeneratorFailure {
+      if (aParameters.size()!=1 || !(aParameters.get(0) instanceof String))
+        throw new GeneratorExc("1 string parameter expected");
+
+      try {
+        String language = (String) aParameters.get(0);
+        String languageId = languageModule.languageIdForCode(language);
+        Object result = null;
+
+        if (languageId != null && !targetLanguageId.equals(languageId)) {
+          result = target.getToOneRelation(
+              "is_published='t' and to_content=" + targetId + " and to_language='" + JDBCStringRoutines.escapeStringLiteral(languageId) + "'",
+              "id", "content");
+        }
+
+        if (result == null)
+          result = target;
+
+        return result;
+      }
+      catch (Throwable t) {
+        t.printStackTrace(System.out);
+        throw new GeneratorFailure(t);
+      }
+    }
+  }
+
+  protected class ContentToTranslationField implements EntityAdapterDefinition.CalculatedField {
+    public Object getValue(EntityAdapter anEntityAdapter) throws MirLocalizerFailure {
+      try {
+        return new ContentToTranslationFunction((EntityAdapter) anEntityAdapter.get("to_original"));
+      }
+      catch (Throwable t) {
+        throw new MirLocalizerFailure(t);
+      }
+    }
+  }
+}
+
index 1df0a86..bcfc089 100755 (executable)
@@ -32,12 +32,12 @@ package mircoders.localizer.basic;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
-import java.util.ArrayList;
 
 import mir.config.MirPropertiesConfiguration;
 import mir.generator.Generator;
@@ -143,11 +143,9 @@ public class MirBasicEmailArticleHandler implements SessionHandler {
           || to.indexOf(',') != -1) {
        throw new SessionExc("Invalid to address"); // we might want to see this in a log, so it is not a validation error
       }
-      else return true; // go for it
-    }
-    else{
-      return false; //validation failed, but not in a potentially abusive way
+                       return true; // go for it
     }
+               return false; //validation failed, but not in a potentially abusive way
 
   }
 
@@ -211,7 +209,7 @@ public class MirBasicEmailArticleHandler implements SessionHandler {
 
   protected String getExtraEmailHeaders(Request aRequest,String to,String from) throws SessionExc {
 
-    String headers = "To: " + to + "\nReply-To: "+ from+"\n";;
+    String headers = "To: " + to + "\nReply-To: "+ from+"\n";
     if (configuration.getString("Localizer.OpenSession.email.includeSenderIP","no").equals("yes"))
       headers= headers+"X-Originating-IP: "+ ((HTTPRequestAdapter)aRequest).getRequest().getRemoteAddr() + "\n";
 
@@ -258,8 +256,7 @@ public class MirBasicEmailArticleHandler implements SessionHandler {
      // mission accomplished??
      if (! trueIfItWorked)
        throw new SessionExc(client.getReplyString());
-     else
-       return trueIfItWorked;
+               return trueIfItWorked;
    }
    catch(IOException e) {
       if(client.isConnected()) {
index 05e43a2..db5dd61 100755 (executable)
 package mircoders.localizer.basic;
 
 import mir.generator.FreemarkerGenerator;
-import mir.generator.VelocityGenerator;
-import mir.generator.TALGenerator;
 import mir.generator.Generator;
 import mir.generator.GeneratorLibraryRepository;
+import mir.generator.TALGenerator;
+import mir.generator.VelocityGenerator;
 import mir.generator.WriterEngine;
 import mir.log.LoggerWrapper;
 import mircoders.global.MirGlobal;
@@ -72,7 +72,7 @@ public class MirBasicGeneratorLocalizer implements MirGeneratorLocalizer {
     catch (Throwable t) {
       throw new MirLocalizerFailure(t);
     }
-  };
+  }
 
   public Generator.Library makeAdminGeneratorLibrary() throws MirLocalizerExc, MirLocalizerFailure {
     try {
@@ -81,7 +81,7 @@ public class MirBasicGeneratorLocalizer implements MirGeneratorLocalizer {
     catch (Throwable t) {
       throw new MirLocalizerFailure(t);
     }
-  };
+  }
 
   public Generator.Library makeOpenPostingGeneratorLibrary() throws MirLocalizerExc, MirLocalizerFailure {
     try {
@@ -90,7 +90,7 @@ public class MirBasicGeneratorLocalizer implements MirGeneratorLocalizer {
     catch (Throwable t) {
       throw new MirLocalizerFailure(t);
     }
-  };
+  }
 
   public WriterEngine makeWriterEngine() throws MirLocalizerExc, MirLocalizerFailure {
     return new MirBasicWriterEngine(MirGlobal.config().getString("Mir.DefaultEncoding"));
index d5de268..a688c58 100755 (executable)
@@ -35,10 +35,10 @@ import mircoders.localizer.MirGeneratorLocalizer;
 import mircoders.localizer.MirLocalizer;
 import mircoders.localizer.MirLocalizerExc;
 import mircoders.localizer.MirLocalizerFailure;
+import mircoders.localizer.MirMediaLocalizer;
 import mircoders.localizer.MirOpenPostingLocalizer;
 import mircoders.localizer.MirProducerAssistantLocalizer;
 import mircoders.localizer.MirProducerLocalizer;
-import mircoders.localizer.MirMediaLocalizer;
 
 public class MirBasicLocalizer implements MirLocalizer {
 
@@ -60,7 +60,7 @@ public class MirBasicLocalizer implements MirLocalizer {
 
   public MirDataModelLocalizer dataModel() throws MirLocalizerFailure, MirLocalizerExc {
     return new MirBasicDataModelLocalizer();
-  };
+  }
 
   public MirAdminInterfaceLocalizer adminInterface() throws MirLocalizerFailure, MirLocalizerExc {
     return new MirBasicAdminInterfaceLocalizer();
index ea55ad7..b5bdd7f 100755 (executable)
@@ -32,12 +32,22 @@ package mircoders.localizer.basic;
 import java.util.HashMap;
 import java.util.Map;
 
+import mir.config.MirPropertiesConfiguration;
 import mir.media.MediaHandler;
-import mir.config.*;
 import mircoders.localizer.MirLocalizerExc;
 import mircoders.localizer.MirLocalizerFailure;
 import mircoders.localizer.MirMediaLocalizer;
-import mircoders.media.*;
+import mircoders.media.MediaHandlerAudio;
+import mircoders.media.MediaHandlerGeneric;
+import mircoders.media.MediaHandlerImagesExtern;
+import mircoders.media.MediaHandlerImagesJpeg;
+import mircoders.media.MediaHandlerImagesPng;
+import mircoders.media.MediaHandlerMp3;
+import mircoders.media.MediaHandlerOgg;
+import mircoders.media.MediaHandlerRealAudio;
+import mircoders.media.MediaHandlerRealVideo;
+import mircoders.media.MediaHandlerVideo;
+import mircoders.media.URLMediaHandler;
 
 /**
  * <p>Title: </p>
index e621cc4..0009383 100755 (executable)
  */
 package mircoders.localizer.basic;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+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.abuse.FilterType;
-import mircoders.abuse.ThrottleFilter;
 import mircoders.abuse.IPFilterType;
 import mircoders.abuse.RegularExpressionFilterType;
+import mircoders.abuse.ThrottleFilter;
 import mircoders.entity.EntityComment;
 import mircoders.entity.EntityContent;
 import mircoders.global.MirGlobal;
@@ -46,8 +53,6 @@ import mircoders.localizer.MirLocalizerExc;
 import mircoders.localizer.MirLocalizerFailure;
 import mircoders.localizer.MirOpenPostingLocalizer;
 
-import java.util.*;
-
 public class MirBasicOpenPostingLocalizer implements MirOpenPostingLocalizer {
   private List afterContentProducerTasks;
   private List afterCommentProducerTasks;
index 75e7978..dcd50d7 100755 (executable)
@@ -64,7 +64,7 @@ import mircoders.media.UnsupportedMediaTypeExc;
  */
 public abstract class MirBasicPostingSessionHandler implements SessionHandler {
   protected static LoggerWrapper logger = new LoggerWrapper("Localizer.OpenPosting");
-  protected MirPropertiesConfiguration configuration = MirPropertiesConfiguration.instance();;
+  protected MirPropertiesConfiguration configuration = MirPropertiesConfiguration.instance();
 
   /** Previously uploaded files */
   protected List attachments;
@@ -110,7 +110,7 @@ public abstract class MirBasicPostingSessionHandler implements SessionHandler {
         subsequentRequest(aRequest, aSession, aResponse);
       }
     }
-  };
+  }
 
   protected void initialRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure {
     initializeSession(aRequest, aSession);
@@ -360,16 +360,16 @@ public abstract class MirBasicPostingSessionHandler implements SessionHandler {
 
   protected void makeInitialResponse(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure {
     aResponse.setResponseGenerator(normalResponseGenerator);
-  };
+  }
 
   protected void makeResponse(Request aRequest, Session aSession, Response aResponse, List anErrors) throws SessionExc, SessionFailure {
     aResponse.setResponseValue("errors", anErrors);
     aResponse.setResponseGenerator(normalResponseGenerator);
-  };
+  }
 
   protected void makeFinalResponse(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure {
     aResponse.setResponseGenerator(finalResponseGenerator);
-  };
+  }
 
   protected void makeErrorResponse(Request aRequest, Session aSession, Response aResponse, Throwable anError) throws SessionExc, SessionFailure {
     Throwable rootCause = ExceptionFunctions.traceCauseException(anError);
@@ -386,7 +386,7 @@ public abstract class MirBasicPostingSessionHandler implements SessionHandler {
           new Object[] {anError.getMessage()}));
       makeResponse(aRequest, aSession, aResponse, errors);
     }
-  };
+  }
 
   protected void makeOpenPostingDisabledResponse(Request aRequest, Session aSession, Response aResponse) {
     aResponse.setResponseGenerator(configuration.getString("ServletModule.OpenIndy.PostingDisabledTemplate"));
@@ -396,13 +396,13 @@ public abstract class MirBasicPostingSessionHandler implements SessionHandler {
    *
    */
   protected void preProcessRequest(Request aRequest, Session aSession) throws SessionExc, SessionFailure {
-  };
+  }
   public void processAttachment(Request aRequest, Session aSession, Attachment aFile) throws SessionExc, SessionFailure {
-  };
+  }
   public void processAttachmentError(Request aRequest, Session aSession, Attachment aFile, Throwable anError) {
-  };
+  }
   protected void postProcessRequest(Request aRequest, Session aSession) throws SessionExc, SessionFailure {
-  };
+  }
 
   /**
    * Determine whether the request shoudl be processed: that is, the validate,
@@ -412,10 +412,8 @@ public abstract class MirBasicPostingSessionHandler implements SessionHandler {
   protected boolean shouldProcessRequest(Request aRequest, Session aSession, List aValidationErrors) throws SessionExc, SessionFailure {
     if (aRequest.getParameter("post")==null)
       return false;
-    else {
-      validate(aValidationErrors, aRequest, aSession);
-      return (aValidationErrors == null || aValidationErrors.size() == 0);
-    }
+               validate(aValidationErrors, aRequest, aSession);
+               return (aValidationErrors == null || aValidationErrors.size() == 0);
   }
 
   /**
index d774733..e4a1629 100755 (executable)
  */
 package mircoders.localizer.basic;
 
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
 import mir.config.MirPropertiesConfiguration;
 import mir.entity.adapter.EntityAdapter;
 import mir.entity.adapter.EntityIteratorAdapter;
@@ -37,27 +46,20 @@ import mir.generator.GeneratorExc;
 import mir.generator.GeneratorFailure;
 import mir.log.LoggerWrapper;
 import mir.misc.StringUtil;
-import mir.util.*;
+import mir.util.GeneratorDateTimeFunctions;
+import mir.util.GeneratorFormatAdapters;
 import mir.util.generator.ReflectionGeneratorFunctionsAdapter;
 import mircoders.global.MirGlobal;
 import mircoders.localizer.MirLocalizerExc;
 import mircoders.localizer.MirLocalizerFailure;
 import mircoders.localizer.MirProducerAssistantLocalizer;
+
 import org.w3c.dom.Document;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
-import org.w3c.tidy.Tidy;
 import org.w3c.tidy.Configuration;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.util.GregorianCalendar;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import org.w3c.tidy.Tidy;
 
 public class MirBasicProducerAssistantLocalizer implements MirProducerAssistantLocalizer {
   protected LoggerWrapper logger;
@@ -129,7 +131,8 @@ public class MirBasicProducerAssistantLocalizer implements MirProducerAssistantL
       throw new MirLocalizerFailure(t);
     }
 
-  };
+  }
+  
   public static class getLanguageIdFunction implements Generator.Function {
     private Map languageCodeToId;
     private String otherLanguageId;
@@ -173,7 +176,7 @@ public class MirBasicProducerAssistantLocalizer implements MirProducerAssistantL
       catch (Throwable t) {
         throw new GeneratorFailure("getLanguageIdFunction: " + t.getMessage(), t);
       }
-    };
+    }
   }
 
 
@@ -218,8 +221,7 @@ public class MirBasicProducerAssistantLocalizer implements MirProducerAssistantL
   private boolean checkAttr(String attrName) {
     if (attrName.equals("onLoad") || attrName.equals("onClick") || attrName.equals("onFocus") || attrName.equals("onBlur") || attrName.equals("onMouseOver") || attrName.equals("onMouseOut") || attrName.equals("style") || attrName.equals("STYLE") || attrName.equals("height") || attrName.equals("width") || attrName.equals("HEIGHT") || attrName.equals("WIDTH"))
       return false;
-    else
-      return true;
+               return true;
 
   }
 
@@ -251,10 +253,8 @@ public class MirBasicProducerAssistantLocalizer implements MirProducerAssistantL
         nodeName.equals("li")
     ) {
       return true;
-    } else {
-
-      return false;
     }
+               return false;
   }
 
   private void print(Node node, StringWriter out) throws IOException {
index a1a0982..541d60b 100755 (executable)
 package mircoders.localizer.basic;
 
 import java.io.File;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 import mir.entity.adapter.EntityAdapterModel;
 import mir.generator.Generator;
@@ -150,7 +154,7 @@ public class MirBasicProducerLocalizer implements MirProducerLocalizer {
             t.getMessage());
         throw new MirLocalizerFailure(t);
       }
-  };
+  }
 
   /**
    * Sets up a {@link ProducerNodeBuilderLibrary} for use by the producer
index 6c5a405..5072ea0 100755 (executable)
@@ -85,7 +85,7 @@ public class MirBasicTranslationPostingHandler extends MirBasicChildArticlePosti
     catch (Throwable t) {
       throw new SessionFailure(t);
     }
-  };
+  }
 
   protected void initializeResponseData(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure {
     try {
index 1e6b304..e22c347 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with  any library licensed under the Apache Software License,\r
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library\r
- * (or with modified versions of the above that use the same license as the above),\r
- * and distribute linked combinations including the two.  You must obey the\r
- * GNU General Public License in all respects for all of the code used other than\r
- * the above mentioned libraries.  If you modify this file, you may extend this\r
- * exception to your version of the file, but you are not obligated to do so.\r
- * If you do not wish to do so, delete this exception statement from your version.\r
- */\r
-package mircoders.localizer.basic;\r
-\r
-import java.util.Collections;\r
-import java.util.List;\r
-\r
-import mir.util.HTMLRoutines;\r
-import mir.util.JDBCStringRoutines;\r
-import mir.util.ParameterExpander;\r
-import mir.util.RewindableIterator;\r
-import mir.util.StringRoutines;\r
-import mir.util.StructuredContentParser;\r
-import mir.util.SubsetIterator;\r
-\r
-public class MirBasicUtilityFunctions {\r
-  public String encodeXML(Object anObject) throws Exception {\r
-    return HTMLRoutines.encodeXML(StringRoutines.interpretAsString(anObject));\r
-  }\r
-\r
-  public String encodeHTML(Object aString) throws Exception {\r
-    return HTMLRoutines.encodeHTML(StringRoutines.interpretAsString(aString));\r
-  }\r
-\r
-  public String prettyEncodeHTML(Object aString) throws Exception {\r
-    return HTMLRoutines.prettyEncodeHTML(StringRoutines.interpretAsString(aString));\r
-  }\r
-\r
-  public String encodeURI(Object aString) throws Exception {\r
-    return HTMLRoutines.encodeURL(StringRoutines.interpretAsString(aString));\r
-  }\r
-\r
-  public String encodeURI(Object aString, Object anEncoding) throws Exception {\r
-    return HTMLRoutines.encodeURL(\r
-        StringRoutines.interpretAsString(aString),\r
-        StringRoutines.interpretAsString(anEncoding));\r
-  }\r
-\r
-  public String subString(Object aString, Object aFrom) throws Exception {\r
-    return StringRoutines.interpretAsString(aString).substring(StringRoutines.interpretAsInteger(aFrom));\r
-  }\r
-\r
-  public String subString(Object aString, Object aFrom, Object aLength) throws Exception {\r
-    int length = StringRoutines.interpretAsInteger(aLength);\r
-    String target = StringRoutines.interpretAsString(aString);\r
-    if (length<0 || length>target.length()) {\r
-      length=target.length();\r
-    }\r
-\r
-    return target.substring(StringRoutines.interpretAsInteger(aFrom), length);\r
-  }\r
-\r
-  public String escapeJDBCString(Object aString) throws Exception {\r
-    return JDBCStringRoutines.escapeStringLiteral(StringRoutines.interpretAsString(aString));\r
-  }\r
-\r
-  public String constructString(Object aString) throws Exception {\r
-    if (aString==null)\r
-      return StructuredContentParser.constructStringLiteral("");\r
-    else\r
-      return StructuredContentParser.constructStringLiteral(StringRoutines.interpretAsString(aString));\r
-  }\r
-\r
-  public Object parseStructuredString(Object aString) throws Exception {\r
-    if (aString==null)\r
-      return null;\r
-    else\r
-      return StructuredContentParser.parse(StringRoutines.interpretAsString(aString));\r
-  }\r
-\r
-  public boolean isOdd(Object anInteger) throws Exception {\r
-    return (StringRoutines.interpretAsInteger(anInteger) & 1) == 1;\r
-  }\r
-\r
-  public int increment(Object anInteger) throws Exception {\r
-    final Integer ONE = new Integer(1);\r
-\r
-    return increment(anInteger, ONE);\r
-  }\r
-\r
-  public int increment(Object anInteger, Object anIncrement) throws Exception {\r
-    return StringRoutines.interpretAsInteger(anInteger) +\r
-           StringRoutines.interpretAsInteger(anIncrement);\r
-  }\r
-\r
-  public Object subList(Object aList, Object aSkip) throws Exception {\r
-    return subList(aList, aSkip, new Integer(-1));\r
-  }\r
-\r
-  public Object subList(Object aList, Object aSkip, Object aMaxSize) throws Exception {\r
-    int skip = StringRoutines.interpretAsInteger(aSkip);\r
-    int maxSize = StringRoutines.interpretAsInteger(aMaxSize);\r
-\r
-    if (aList instanceof RewindableIterator)\r
-      return new SubsetIterator((RewindableIterator) aList, skip, maxSize);\r
-    else {\r
-      List list = (List) aList;\r
-\r
-      if (skip>=list.size())\r
-        return Collections.EMPTY_LIST;\r
-      if (maxSize<0 || (skip+maxSize)>=list.size())\r
-        return list.subList(skip, list.size());\r
-      else\r
-        return list.subList(skip, skip+maxSize);\r
-    }\r
-  }\r
-\r
-  public int listSize(RewindableIterator anIterator) {\r
-    anIterator.rewind();\r
-    int result=0;\r
-\r
-    while (anIterator.hasNext()) {\r
-      result++;\r
-      anIterator.next();\r
-    }\r
-\r
-    anIterator.rewind();\r
-\r
-    return result;\r
-  }\r
-\r
-  public int listSize(List aList) {\r
-    return aList.size();\r
-  }\r
-\r
-  public Object evaluate(Object aTarget, String anExpression) throws Exception {\r
-    return ParameterExpander.expandExpression(aTarget, anExpression);\r
-  }\r
-\r
-  public String regexpreplace(String aString, String anExpression, String aReplacement) {\r
-    return StringRoutines.performRegularExpressionReplacement(aString, anExpression, aReplacement);\r
-  }\r
-\r
-  public boolean regexpmatch(String aString, String anExpression) {\r
-    return StringRoutines.performRegularExpressionSearch(aString, anExpression);\r
-  }\r
-}\r
+/*
+ * 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.Collections;
+import java.util.List;
+
+import mir.util.HTMLRoutines;
+import mir.util.JDBCStringRoutines;
+import mir.util.ParameterExpander;
+import mir.util.RewindableIterator;
+import mir.util.StringRoutines;
+import mir.util.StructuredContentParser;
+import mir.util.SubsetIterator;
+
+public class MirBasicUtilityFunctions {
+  public String encodeXML(Object anObject) throws Exception {
+    return HTMLRoutines.encodeXML(StringRoutines.interpretAsString(anObject));
+  }
+
+  public String encodeHTML(Object aString) throws Exception {
+    return HTMLRoutines.encodeHTML(StringRoutines.interpretAsString(aString));
+  }
+
+  public String prettyEncodeHTML(Object aString) throws Exception {
+    return HTMLRoutines.prettyEncodeHTML(StringRoutines.interpretAsString(aString));
+  }
+
+  public String encodeURI(Object aString) throws Exception {
+    return HTMLRoutines.encodeURL(StringRoutines.interpretAsString(aString));
+  }
+
+  public String encodeURI(Object aString, Object anEncoding) throws Exception {
+    return HTMLRoutines.encodeURL(
+        StringRoutines.interpretAsString(aString),
+        StringRoutines.interpretAsString(anEncoding));
+  }
+
+  public String subString(Object aString, Object aFrom) throws Exception {
+    return StringRoutines.interpretAsString(aString).substring(StringRoutines.interpretAsInteger(aFrom));
+  }
+
+  public String subString(Object aString, Object aFrom, Object aLength) throws Exception {
+    int length = StringRoutines.interpretAsInteger(aLength);
+    String target = StringRoutines.interpretAsString(aString);
+    if (length<0 || length>target.length()) {
+      length=target.length();
+    }
+
+    return target.substring(StringRoutines.interpretAsInteger(aFrom), length);
+  }
+
+  public String escapeJDBCString(Object aString) throws Exception {
+    return JDBCStringRoutines.escapeStringLiteral(StringRoutines.interpretAsString(aString));
+  }
+
+  public String constructString(Object aString) throws Exception {
+    if (aString==null)
+      return StructuredContentParser.constructStringLiteral("");
+               return StructuredContentParser.constructStringLiteral(StringRoutines.interpretAsString(aString));
+  }
+
+  public Object parseStructuredString(Object aString) throws Exception {
+    if (aString==null)
+      return null;
+               return StructuredContentParser.parse(StringRoutines.interpretAsString(aString));
+  }
+
+  public boolean isOdd(Object anInteger) throws Exception {
+    return (StringRoutines.interpretAsInteger(anInteger) & 1) == 1;
+  }
+
+  public int increment(Object anInteger) throws Exception {
+    final Integer ONE = new Integer(1);
+
+    return increment(anInteger, ONE);
+  }
+
+  public int increment(Object anInteger, Object anIncrement) throws Exception {
+    return StringRoutines.interpretAsInteger(anInteger) +
+           StringRoutines.interpretAsInteger(anIncrement);
+  }
+
+  public Object subList(Object aList, Object aSkip) throws Exception {
+    return subList(aList, aSkip, new Integer(-1));
+  }
+
+  public Object subList(Object aList, Object aSkip, Object aMaxSize) throws Exception {
+    int skip = StringRoutines.interpretAsInteger(aSkip);
+    int maxSize = StringRoutines.interpretAsInteger(aMaxSize);
+
+    if (aList instanceof RewindableIterator)
+      return new SubsetIterator((RewindableIterator) aList, skip, maxSize);
+               
+    List list = (List) aList;
+               if (skip>=list.size())
+                 return Collections.EMPTY_LIST;
+               if (maxSize<0 || (skip+maxSize)>=list.size())
+                 return list.subList(skip, list.size());
+               return list.subList(skip, skip+maxSize);
+  }
+
+  public int listSize(RewindableIterator anIterator) {
+    anIterator.rewind();
+    int result=0;
+
+    while (anIterator.hasNext()) {
+      result++;
+      anIterator.next();
+    }
+
+    anIterator.rewind();
+
+    return result;
+  }
+
+  public int listSize(List aList) {
+    return aList.size();
+  }
+
+  public Object evaluate(Object aTarget, String anExpression) throws Exception {
+    return ParameterExpander.expandExpression(aTarget, anExpression);
+  }
+
+  public String regexpreplace(String aString, String anExpression, String aReplacement) {
+    return StringRoutines.performRegularExpressionReplacement(aString, anExpression, aReplacement);
+  }
+
+  public boolean regexpmatch(String aString, String anExpression) {
+    return StringRoutines.performRegularExpressionSearch(aString, anExpression);
+  }
+}
index 0cb2922..218a50d 100755 (executable)
@@ -74,9 +74,9 @@ public class MirBasicWriterEngine implements WriterEngine {
     catch (Throwable t) {
       throw new MirLocalizerFailure("Failure while opening a PrintWriter: " + t.getMessage(), t);
     }
-  };
+  }
 
   public void closeWriter(Object aWriter) {
     ((PrintWriter) aWriter).close();
-  };
+  }
 }
\ No newline at end of file
index 7770ff3..3675016 100755 (executable)
@@ -30,8 +30,8 @@
 package mircoders.localizer.basic.actions;
 
 import java.util.ArrayList;
-import java.util.List;
 import java.util.Iterator;
+import java.util.List;
 
 import mir.entity.adapter.EntityAdapter;
 import mircoders.localizer.MirLocalizerExc;
index 05db1ed..94cbb9b 100755 (executable)
@@ -1,60 +1,58 @@
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with  any library licensed under the Apache Software License,\r
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library\r
- * (or with modified versions of the above that use the same license as the above),\r
- * and distribute linked combinations including the two.  You must obey the\r
- * GNU General Public License in all respects for all of the code used other than\r
- * the above mentioned libraries.  If you modify this file, you may extend this\r
- * exception to your version of the file, but you are not obligated to do so.\r
- * If you do not wish to do so, delete this exception statement from your version.\r
- */\r
-package mircoders.media;\r
-\r
-import mir.media.MediaHandler;\r
-import mir.media.MediaExc;\r
-import mir.media.MediaFailure;\r
-import mir.entity.Entity;\r
-import mir.misc.StringUtil;\r
-\r
-import java.io.File;\r
-\r
-public abstract class AbstractMediaHandler implements MediaHandler {\r
-  public File getStorageFile(Entity aMedia, Entity aMediaType) throws MediaExc, MediaFailure {\r
-    return new File(new File(getStoragePath()), getRelativeStorageFile(aMedia, aMediaType));\r
-  }\r
-\r
-  public String getRelativeStorageFile(Entity aMedia, Entity aMediaType) throws MediaExc, MediaFailure {\r
-    String publishPath = aMedia.getFieldValue("publish_path");\r
-\r
-    if (publishPath==null || publishPath.length()==0) {\r
-      String extension = aMediaType.getFieldValue("name");\r
-      String mediaFileName = aMedia.getId() + "." + extension;\r
-      String date = aMedia.getFieldValue("date");\r
-      String datePath = StringUtil.webdbDate2path(date);\r
-      return (new File(datePath, mediaFileName)).getPath();\r
-    }\r
-    else {\r
-      return publishPath;\r
-    }\r
-  }\r
-\r
-}\r
+/*
+ * 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 mir.entity.Entity;
+import mir.media.MediaExc;
+import mir.media.MediaFailure;
+import mir.media.MediaHandler;
+import mir.misc.StringUtil;
+
+public abstract class AbstractMediaHandler implements MediaHandler {
+  public File getStorageFile(Entity aMedia, Entity aMediaType) throws MediaExc, MediaFailure {
+    return new File(new File(getStoragePath()), getRelativeStorageFile(aMedia, aMediaType));
+  }
+
+  public String getRelativeStorageFile(Entity aMedia, Entity aMediaType) throws MediaExc, MediaFailure {
+    String publishPath = aMedia.getFieldValue("publish_path");
+
+    if (publishPath==null || publishPath.length()==0) {
+      String extension = aMediaType.getFieldValue("name");
+      String mediaFileName = aMedia.getId() + "." + extension;
+      String date = aMedia.getFieldValue("date");
+      String datePath = StringUtil.webdbDate2path(date);
+      return (new File(datePath, mediaFileName)).getPath();
+    }
+               return publishPath;
+  }
+
+}
index d023b3d..e8e66ca 100755 (executable)
  */
 package  mircoders.media;
 
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+import javax.servlet.ServletContext;
+
 import mir.config.MirPropertiesConfiguration;
 import mir.entity.Entity;
 import mir.log.LoggerWrapper;
@@ -38,12 +45,6 @@ import mir.misc.StringUtil;
 import mir.session.UploadedFile;
 import mir.util.FileFunctions;
 
-import javax.servlet.ServletContext;
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-
 
 /**
  * This is the Generic MediaHandler. It stores the media data on
@@ -62,7 +63,7 @@ import java.io.InputStream;
  *
  * @see mir.media.MediaHandler
  * @author mh <mh@nadir.org>
- * @version $Id: MediaHandlerGeneric.java,v 1.20.2.7 2004/11/21 22:07:14 zapata Exp $
+ * @version $Id: MediaHandlerGeneric.java,v 1.20.2.8 2005/02/10 16:22:23 rhindes Exp $
  */
 
 public class MediaHandlerGeneric extends AbstractMediaHandler
@@ -146,7 +147,7 @@ public class MediaHandlerGeneric extends AbstractMediaHandler
     String fileName = aMediaEntity.getId() + "." + aMediaType.getFieldValue("name");
 
     return servletContext.getMimeType(fileName);
-  };
+  }
 
   public String getStoragePath() {
     return configuration.getString("Producer.Media.Path");
index 2deb304..9b4cd04 100755 (executable)
@@ -29,6 +29,8 @@
  */
 package  mircoders.media;
 
+import java.io.StringReader;
+
 import mir.entity.Entity;
 import mir.log.LoggerWrapper;
 import mir.media.MediaExc;
@@ -37,8 +39,6 @@ import mir.media.MediaHandler;
 import mir.misc.FileUtil;
 import mir.misc.StringUtil;
 
-import java.io.StringReader;
-
 /**
  * Please note: this media handler produces
  * 3 media files, the raw .mp3, a .m3u which is
@@ -63,7 +63,7 @@ import java.io.StringReader;
  *
  * @see mir.media.MediaHandler
  * @author mh <mh@nadir.org>
- * @version $Id: MediaHandlerMp3.java,v 1.15.2.5 2004/11/21 22:07:14 zapata Exp $
+ * @version $Id: MediaHandlerMp3.java,v 1.15.2.6 2005/02/10 16:22:23 rhindes Exp $
  */
 
 public class MediaHandlerMp3 extends MediaHandlerAudio implements MediaHandler
index d6f8454..07935a3 100755 (executable)
@@ -67,8 +67,7 @@ import mir.misc.StringUtil;
 
 public class MediaHandlerOgg extends MediaHandlerAudio implements MediaHandler
 {
-  protected LoggerWrapper logger;
-
+  
   public MediaHandlerOgg() {
     logger = new LoggerWrapper("Media.Audio.Ogg");
   }
index 54aa624..608ead8 100755 (executable)
@@ -49,7 +49,7 @@ import mir.misc.StringUtil;
  * @see mir.media.MediaHandlerGeneric
  * @see mir.media.MediaHandler
  * @author john <john@manifestor.org>, mh <heckmann@hbe.ca>
- * @version $Id: MediaHandlerRealAudio.java,v 1.19.2.6 2005/01/09 20:37:12 zapata Exp $
+ * @version $Id: MediaHandlerRealAudio.java,v 1.19.2.7 2005/02/10 16:22:23 rhindes Exp $
  */
 
 
@@ -64,10 +64,8 @@ public class MediaHandlerRealAudio extends MediaHandlerAudio implements MediaHan
     // first see if the file exists
     super.produce(ent, mediaTypeEnt);
 
-    String baseName = ent.getId();
     String date = ent.getFieldValue("date");
     String datePath = StringUtil.webdbDate2path(date);
-    String rtspDir = configuration.getString("Producer.RealMedia.Path");
     String rtspMediaHost = configuration.getString("Producer.RealMedia.Host");
 
     String RealMediaPointer = rtspMediaHost+ent.getFieldValue("publish_path");
index 0807c39..26fe197 100755 (executable)
@@ -29,6 +29,9 @@
  */
 package  mircoders.media;
 
+import java.io.File;
+import java.io.StringReader;
+
 import mir.entity.Entity;
 import mir.log.LoggerWrapper;
 import mir.media.MediaExc;
@@ -37,9 +40,6 @@ import mir.media.MediaHandler;
 import mir.misc.FileUtil;
 import mir.misc.StringUtil;
 
-import java.io.File;
-import java.io.StringReader;
-
 
 
 /**
@@ -49,7 +49,7 @@ import java.io.StringReader;
  *
  * @see mir.media.MediaHandler
  * @author john <john@manifestor.org>, mh <mh@nadir.org>
- * @version $Id: MediaHandlerRealVideo.java,v 1.19.2.5 2004/11/21 22:07:14 zapata Exp $
+ * @version $Id: MediaHandlerRealVideo.java,v 1.19.2.6 2005/02/10 16:22:23 rhindes Exp $
  */
 
 
@@ -64,10 +64,8 @@ public class MediaHandlerRealVideo extends MediaHandlerVideo implements MediaHan
     // first see if the file exists
     super.produce(ent, mediaTypeEnt);
 
-    String baseName = ent.getId();
     String date = ent.getFieldValue("date");
     String datePath = StringUtil.webdbDate2path(date);
-    String rtspDir = configuration.getString("Producer.RealMedia.Path");
     String rtspMediaHost = configuration.getString("Producer.RealMedia.Host");
 
     String RealMediaPointer = rtspMediaHost+ent.getFieldValue("publish_path");
index db32939..762cce0 100755 (executable)
  */
 package mircoders.media;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import mir.entity.Entity;
+import mir.media.MediaExc;
+import mir.media.MediaFailure;
+import mir.media.MediaHandler;
 import mir.storage.Database;
-import java.util.Map;
-import java.util.HashMap;
-import mircoders.global.*;
-import mircoders.storage.*;
-import mir.media.*;
+import mircoders.global.MirGlobal;
 import mircoders.localizer.MirLocalizerExc;
+import mircoders.storage.DatabaseAudio;
+import mircoders.storage.DatabaseImages;
+import mircoders.storage.DatabaseOther;
+import mircoders.storage.DatabaseVideo;
 
 /**
  * helper class to resolve media handlers using reflection
@@ -48,8 +54,7 @@ import mircoders.localizer.MirLocalizerExc;
 
 public final class MediaHelper {
   private static Map nameToMediaHandler = new HashMap();
-  private static String defaultMediaHandler = null;
-
+  
   public static void addHandler(String aName, MediaHandler aHandler) {
     synchronized (nameToMediaHandler) {
       nameToMediaHandler.put(aName, aHandler);
index beb7795..b3f8b34 100755 (executable)
  */
 package mircoders.media;
 
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.Map;
+
 import mir.entity.Entity;
 import mir.log.LoggerWrapper;
 import mir.media.MediaFailure;
@@ -39,10 +43,6 @@ import mir.storage.Database;
 import mir.util.FileFunctions;
 import mircoders.module.ModuleMediaType;
 
-import java.util.GregorianCalendar;
-import java.util.HashMap;
-import java.util.Map;
-
 public class MediaUploadProcessor {
   private static LoggerWrapper logger = new LoggerWrapper("Media.UploadProcessor");
   private static ModuleMediaType mediaTypeModule = new ModuleMediaType();
index 8401074..68d54f6 100755 (executable)
@@ -1,14 +1,14 @@
 package mircoders.media;
 
+import java.io.File;
+import java.io.InputStream;
+
 import mir.entity.Entity;
 import mir.media.MediaExc;
 import mir.media.MediaFailure;
 import mir.media.MediaHandler;
 import mir.session.UploadedFile;
 
-import java.io.File;
-import java.io.InputStream;
-
 /**
  * <p>URLMediaHandler</p>
  * <p>Description:
index d850cfa..e64ea24 100755 (executable)
@@ -29,6 +29,8 @@
  */
 package mircoders.module;
 
+import java.util.Map;
+
 import mir.entity.Entity;
 import mir.log.LoggerWrapper;
 import mir.module.AbstractModule;
@@ -37,8 +39,6 @@ import mir.module.ModuleFailure;
 import mircoders.storage.DatabaseComment;
 import mircoders.storage.DatabaseContent;
 
-import java.util.Map;
-
 
 /*
  *  ModuleComment - methods and access for comments
@@ -57,7 +57,7 @@ public class ModuleComment extends AbstractModule
 
   public void deleteById (String anId) throws ModuleExc, ModuleFailure {
     try {
-      Entity theEntity = database.selectById((String)anId);
+      Entity theEntity = database.selectById(anId);
       if (theEntity != null)
         DatabaseContent.getInstance().setUnproduced("id=" + theEntity.getFieldValue("to_media"));
 
index 2001c77..9997ed6 100755 (executable)
  */
 package mircoders.module;
 
+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.util.JDBCStringRoutines;
-import mir.entity.Entity;
-import mir.entity.EntityList;
 import mircoders.storage.DatabaseLanguage;
 
 /**
@@ -70,9 +70,7 @@ public class ModuleLanguage extends AbstractModule {
       if (list.size()>0) {
         return list.elementAt(0);
       }
-      else {
-        throw new ModuleExc("No language found for code " + aCode);
-      }
+                       throw new ModuleExc("No language found for code " + aCode);
     }
     catch (Throwable t) {
       throw new ModuleFailure(t);
index 19850a5..dc82fef 100755 (executable)
@@ -30,6 +30,8 @@
 
 package mircoders.module;
 
+import java.util.List;
+
 import mir.entity.Entity;
 import mir.entity.EntityList;
 import mir.log.LoggerWrapper;
@@ -38,8 +40,6 @@ import mir.util.JDBCStringRoutines;
 import mir.util.StringRoutines;
 import mircoders.storage.DatabaseMediaType;
 
-import java.util.List;
-
 public class ModuleMediaType extends AbstractModule {
   static LoggerWrapper logger = new LoggerWrapper("Module.Content");
 
@@ -65,7 +65,7 @@ public class ModuleMediaType extends AbstractModule {
       return null;
     }
 
-    return (Entity) mediaTypes.elementAt(0);
+    return mediaTypes.elementAt(0);
   }
 
   public Entity findMediaTypeForExtension(String anExtension) {
@@ -74,8 +74,6 @@ public class ModuleMediaType extends AbstractModule {
     if (mediaTypes.size() == 0) {
       return null;
     }
-    else {
-      return (Entity) mediaTypes.elementAt(0);
-    }
+               return mediaTypes.elementAt(0);
   }
 }
\ No newline at end of file
index bf03447..5aede0b 100755 (executable)
@@ -30,6 +30,9 @@
 
 package mircoders.module;
 
+import java.util.HashMap;
+import java.util.Map;
+
 import mir.entity.EntityList;
 import mir.log.LoggerWrapper;
 import mir.module.AbstractModule;
@@ -40,9 +43,6 @@ import mircoders.entity.EntityUsers;
 import mircoders.global.MirGlobal;
 import mircoders.storage.DatabaseUsers;
 
-import java.util.HashMap;
-import java.util.Map;
-
 
 /*
  *  Users Module -
index 049f8b3..e1a2fa8 100755 (executable)
  */
 package mircoders.pdf;
 
-import com.lowagie.text.*;
-import com.lowagie.text.pdf.*;
 import gnu.regexp.RE;
 import gnu.regexp.REException;
 import gnu.regexp.REMatch;
 import gnu.regexp.REMatchEnumeration;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
 import mir.config.MirPropertiesConfiguration;
 import mir.entity.EntityBrowser;
 import mir.log.LoggerWrapper;
@@ -44,12 +50,20 @@ import mircoders.entity.EntityContent;
 import mircoders.entity.EntityImages;
 import mircoders.storage.DatabaseImages;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+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;
 
 public class PDFGenerator{
 
@@ -116,11 +130,11 @@ public class PDFGenerator{
       footerText = configuration.getString("PDF.Footer.String");
       footerFontSize   = Integer.parseInt(configuration.getString("PDF.Footer.FontSize"));
       footerFontFamily = getFontByName(configuration.getString("PDF.Footer.FontFamily"));
-      footerHeight = Integer.parseInt(configuration.getString("PDF.Footer.Height"));;
+      footerHeight = Integer.parseInt(configuration.getString("PDF.Footer.Height"));
 
       metaFontSize   = Integer.parseInt(configuration.getString("PDF.Meta.FontSize"));
       metaFontFamily = getFontByName(configuration.getString("PDF.Meta.FontFamily"));
-      metaHeight = Integer.parseInt(configuration.getString("PDF.Meta.Height"));;
+      metaHeight = Integer.parseInt(configuration.getString("PDF.Meta.Height"));
 
       descriptionFontSize   = Integer.parseInt(configuration.getString("PDF.Description.FontSize"));
       descriptionLineHeight = Integer.parseInt(configuration.getString("PDF.Description.LineHeight"));
@@ -600,8 +614,7 @@ public class PDFGenerator{
   private boolean enoughY(int heightOfBlockToAdd){
     if ((currentYPosition - heightOfBlockToAdd - footerHeight) < bottomEdge )
       return false;
-    else
-      return true;
+               return true;
   }
 
 
index db12ed7..8be3d63 100755 (executable)
  */
 package mircoders.producer;
 
+import java.io.File;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.GregorianCalendar;
 import java.util.Map;
-import java.io.File;
 
 import mir.entity.Entity;
 import mir.entity.adapter.EntityAdapter;
@@ -42,8 +42,8 @@ import mir.log.LoggerWrapper;
 import mir.misc.StringUtil;
 import mir.producer.ProducerFailure;
 import mir.producer.ProducerNode;
-import mir.util.ParameterExpander;
 import mir.util.FileFunctions;
+import mir.util.ParameterExpander;
 import mircoders.entity.EntityContent;
 import mircoders.search.AudioSearchTerm;
 import mircoders.search.ContentSearchTerm;
index 501e893..4d6f3d8 100755 (executable)
@@ -35,12 +35,12 @@ import java.util.Map;
 import mir.entity.Entity;
 import mir.entity.adapter.EntityAdapter;
 import mir.log.LoggerWrapper;
-import mircoders.media.MediaHelper;
 import mir.media.MediaHandler;
 import mir.producer.ProducerExc;
 import mir.producer.ProducerNode;
 import mir.util.ParameterExpander;
 import mircoders.entity.EntityUploadedMedia;
+import mircoders.media.MediaHelper;
 import mircoders.storage.DatabaseUploadedMedia;
 
 public class MediaGeneratingProducerNode implements ProducerNode {
index 4427b67..597872e 100755 (executable)
 package mircoders.producer;
 
 import java.io.PrintWriter;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 import mir.entity.Entity;
 import mir.entity.EntityBrowser;
index 9dc4abf..3990b6d 100755 (executable)
  */
 package mircoders.producer;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Vector;
 
 import mir.log.LoggerWrapper;
 import mir.producer.ProducerFailure;
index 371ece7..95ed7a5 100755 (executable)
  */
 package mircoders.producer;
 
-import java.util.Map;
 import java.io.File;
+import java.util.Map;
 
 import mir.entity.Entity;
 import mir.entity.adapter.EntityAdapter;
 import mir.log.LoggerWrapper;
 import mir.producer.ProducerFailure;
 import mir.producer.ProducerNode;
-import mir.util.ParameterExpander;
 import mir.util.FileFunctions;
+import mir.util.ParameterExpander;
 import mircoders.entity.EntityContent;
 import mircoders.search.IndexUtil;
 
index 783010e..a0a1a1c 100755 (executable)
  */
 package mircoders.producer.reader;
 
-import java.util.Map;
 import java.io.File;
+import java.util.Map;
 
 import mir.producer.ProducerNode;
 import mir.producer.reader.DefaultProducerNodeBuilders;
 import mir.producer.reader.ProducerConfigExc;
-import mir.producer.reader.ProducerNodeBuilderLibrary;
 import mir.producer.reader.ProducerNodeBuilder;
+import mir.producer.reader.ProducerNodeBuilderLibrary;
 import mir.util.xml.XMLParserExc;
 import mir.util.xml.XMLReaderTool;
 import mircoders.producer.ContentMarkingProducerNode;
@@ -81,11 +81,11 @@ public class SupplementalProducerNodeBuilders {
       XMLReaderTool.checkAttributes(anAttributes, MARKER_REQUIRED_ATTRIBUTES, MARKER_OPTIONAL_ATTRIBUTES);
 
       key = (String) anAttributes.get(MARKER_KEY_ATTRIBUTE);
-    };
+    }
 
     public ProducerNode constructNode() {
       return new ContentMarkingProducerNode(key);
-    };
+    }
   }
   private final static String   INDEXER_KEY_ATTRIBUTE = DefaultProducerNodeBuilders.KEY_ATTRIBUTE;
   private final static String   INDEXER_INDEX_ATTRIBUTE = "pathToIndex";
@@ -121,11 +121,11 @@ public class SupplementalProducerNodeBuilders {
 
       key = (String) anAttributes.get(INDEXER_KEY_ATTRIBUTE);
       pathToIndex = (String) anAttributes.get(INDEXER_INDEX_ATTRIBUTE);
-    };
+    }
 
     public ProducerNode constructNode() {
       return new IndexingProducerNode(indexBasePath, key, pathToIndex);
-    };
+    }
   }
 
   private final static String   UNINDEXER_KEY_ATTRIBUTE = DefaultProducerNodeBuilders.KEY_ATTRIBUTE;
@@ -163,11 +163,11 @@ public class SupplementalProducerNodeBuilders {
 
       key = (String) anAttributes.get(UNINDEXER_KEY_ATTRIBUTE);
       pathToIndex = (String) anAttributes.get(UNINDEXER_INDEX_ATTRIBUTE);
-    };
+    }
 
     public ProducerNode constructNode() {
       return new UnIndexingProducerNode(indexBasePath, key,pathToIndex);
-    };
+    }
   }
 
   private final static String   CONTENT_MODIFIER_KEY_ATTRIBUTE = DefaultProducerNodeBuilders.KEY_ATTRIBUTE;
@@ -193,11 +193,11 @@ public class SupplementalProducerNodeBuilders {
       key = (String) anAttributes.get(CONTENT_MODIFIER_KEY_ATTRIBUTE);
       field = (String) anAttributes.get(CONTENT_MODIFIER_FIELD_ATTRIBUTE);
       value = (String) anAttributes.get(CONTENT_MODIFIER_VALUE_ATTRIBUTE);
-    };
+    }
 
     public ProducerNode constructNode() {
       return new ContentModifyingProducerNode(key, field, value);
-    };
+    }
   }
 
   private final static String   MEDIA_KEY_ATTRIBUTE = DefaultProducerNodeBuilders.KEY_ATTRIBUTE;
@@ -217,11 +217,11 @@ public class SupplementalProducerNodeBuilders {
       XMLReaderTool.checkAttributes(anAttributes, MEDIA_REQUIRED_ATTRIBUTES, MEDIA_OPTIONAL_ATTRIBUTES);
 
       key = (String) anAttributes.get(MEDIA_KEY_ATTRIBUTE);
-    };
+    }
 
     public ProducerNode constructNode() {
       return new MediaGeneratingProducerNode(key);
-    };
+    }
   }
 
   public static class PDFPreFormattingProducerNodeBuilder extends DefaultProducerNodeBuilders.AbstractProducerNodeBuilder {
@@ -255,13 +255,11 @@ public class SupplementalProducerNodeBuilders {
       characterWidthCM = (String) anAttributes.get(PDF_CHAR_WIDTH_ATTRIBUTE);
       pixelWidthCM   = (String) anAttributes.get(PDF_PIXEL_WIDTH_ATTRIBUTE);
       lineHeightCM = (String) anAttributes.get(PDF_LINE_HEIGHT_ATTRIBUTE);
-
-
-    };
+    }
 
     public ProducerNode constructNode() {
       return new PDFPreFormattingProducerNode(key,numLinesBetweenImages,contentAreaWidthCM,characterWidthCM,pixelWidthCM,lineHeightCM);
-    };
+    }
   }
 
   public static class PDFGeneratingProducerNodeBuilder extends DefaultProducerNodeBuilders.AbstractProducerNodeBuilder {
@@ -287,11 +285,11 @@ public class SupplementalProducerNodeBuilders {
       generator = (String) anAttributes.get(PDF_GENERATOR_ATTRIBUTE);
       destination = (String) anAttributes.get(PDF_DESTINATION_ATTRIBUTE);
       stylesheet = (String) anAttributes.get(PDF_STYLESHEET_ATTRIBUTE);
-    };
+    }
 
     public ProducerNode constructNode() {
       return new PDFGeneratingProducerNode(generator,destination,stylesheet);
-    };
+    }
   }
 
     public static class RadicalendarProducerNodeBuilder extends DefaultProducerNodeBuilders.AbstractProducerNodeBuilder {
index e4aefc6..1fc2fdc 100755 (executable)
 
 package mircoders.search;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 
@@ -67,9 +70,7 @@ public class AudioSearchTerm extends SearchTerm{
     if (wanted != null && wanted.equals("y")){
       return matchField + ":" + "\"" + wanted + "\"";
     }
-    else {
-      return null;
-    }
+               return null;
   }
 
   public void returnMeta(Map result,Document doc){
index 8ea3d6f..9b74640 100755 (executable)
@@ -91,9 +91,7 @@ public class ContentSearchTerm extends SearchTerm{
           }
         }
       }
-      else {
-        return null;
-      }
+                       return null;
   }
 
   public void returnMeta(Map result,Document doc){
index 10673d8..c509060 100755 (executable)
@@ -35,7 +35,6 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.StringTokenizer;
-import java.util.Vector;
 
 import javax.servlet.http.HttpServletRequest;
 
@@ -84,9 +83,7 @@ public class ImagesSearchTerm extends SearchTerm{
     if (wanted != null && wanted.equals("y")){
       return matchField + ":y";
     }
-    else {
-      return null;
-    }
+               return null;
   }
 
   public void returnMeta(Map result,Document doc){
index 55104c5..2716aa2 100755 (executable)
 
 package mircoders.search;
 
-import java.io.IOException;
 import java.io.File;
+import java.io.IOException;
+
+import mircoders.entity.EntityContent;
 
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.store.FSDirectory;
-import mircoders.entity.EntityContent;
 
 /**
  * Some utility functions for article (un)indexing
index dfee688..3486f71 100755 (executable)
@@ -67,9 +67,7 @@ public class KeywordSearchTerm extends SearchTerm{
       if (wanted != null && !(wanted.equals(""))){
         return matchField + ":" + "\"" + wanted + "\"";
       }
-      else {
-        return null;
-      }
+                       return null;
   }
   public void returnMeta(Map result,Document doc){
     result.put(templateVariable,doc.get(dataField));
index 7d16cd2..7ac2696 100755 (executable)
@@ -55,9 +55,7 @@ public class MediaSearchTerm extends SearchTerm{
     if (wanted != null && (wanted.equals("hasImages") || wanted.equals("hasAudio") || wanted.equals("hasVideo") )){
       return wanted + ":\"y\"";
     }
-    else {
-      return null;
-    }
+               return null;
   }
 
   public void returnMeta(Map result,Document doc){
index 6ed5079..6e7bdca 100755 (executable)
 package mircoders.search;
 
 import java.util.Map;
+
 import javax.servlet.http.HttpServletRequest;
+
 import mir.entity.Entity;
+
 import org.apache.lucene.document.Document;
 
 
index 334a424..3b5cd44 100755 (executable)
@@ -67,9 +67,7 @@ public class TextSearchTerm extends SearchTerm{
       if (wanted != null && !(wanted.equals(""))){
         return matchField + ":" + "\"" + wanted + "\"";
       }
-      else {
-        return null;
-      }
+                       return null;
   }
   public void returnMeta(Map result,Document doc){
     result.put(templateVariable, doc.get(dataField));
index e6be2a1..1d41b65 100755 (executable)
@@ -74,9 +74,7 @@ public class TopicMatrixSearchTerm extends SearchTerm{
     if (queryTerm.equals("")){
       return null;
     }
-    else {
-      return "( "+queryTerm+ " )";
-    }
+               return "( "+queryTerm+ " )";
 
   }
 
index cc1e279..1421002 100755 (executable)
@@ -61,9 +61,7 @@ public class TopicSearchTerm extends SearchTerm{
     if (wanted != null && !(wanted.equals(""))){
       return matchField + ":" + "\"" + wanted + "\"";
     }
-    else {
-      return null;
-    }
+               return null;
   }
 
   public void returnMeta(Map result,Document doc){
index d0aa297..55db890 100755 (executable)
@@ -61,9 +61,7 @@ public class UnStoredSearchTerm extends SearchTerm{
       if (wanted != null && !(wanted.equals(""))){
         return matchField + ":" + "\"" + wanted + "\"";
       }
-      else {
-        return null;
-      }
+                       return null;
   }
   public void returnMeta(Map result,Document doc){
     return;
index 40c1934..caa9e27 100755 (executable)
  */
 package mircoders.search;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 
@@ -68,9 +71,8 @@ public class VideoSearchTerm extends SearchTerm {
 
     if ((wanted != null) && wanted.equals("y")) {
       return matchField + ":" + "\"" + wanted + "\"";
-    } else {
-      return null;
     }
+               return null;
   }
 
   public void returnMeta(Map result, Document doc) {
index 1fa0901..7963a03 100755 (executable)
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with  any library licensed under the Apache Software License,\r
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library\r
- * (or with modified versions of the above that use the same license as the above),\r
- * and distribute linked combinations including the two.  You must obey the\r
- * GNU General Public License in all respects for all of the code used other than\r
- * the above mentioned libraries.  If you modify this file, you may extend this\r
- * exception to your version of the file, but you are not obligated to do so.\r
- * If you do not wish to do so, delete this exception statement from your version.\r
- */\r
-package mircoders.servlet;\r
-\r
-import java.io.PrintWriter;\r
-import java.io.IOException;\r
-import java.util.Locale;\r
-import java.util.Map;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-\r
-import mir.config.MirPropertiesConfiguration;\r
-import mir.entity.adapter.EntityAdapter;\r
-import mir.generator.Generator;\r
-import mir.generator.GeneratorHelper;\r
-import mir.log.LoggerWrapper;\r
-import mir.servlet.ServletModuleExc;\r
-import mir.servlet.ServletModuleFailure;\r
-import mircoders.entity.EntityUsers;\r
-import mircoders.global.MirGlobal;\r
-\r
-\r
-public class ServletHelper {\r
-  private static LoggerWrapper logger = new LoggerWrapper("ServletModule.Helper");\r
-\r
-  public static Map makeGenerationData(HttpServletRequest aRequest, HttpServletResponse aResponse, Locale[] aLocales) throws ServletModuleExc {\r
-    return makeGenerationData(aRequest, aResponse, aLocales, "etc/bundles/adminlocal", "bundles/admin");\r
-  }\r
-\r
-  public static Map makeGenerationData(HttpServletRequest aRequest, HttpServletResponse aResponse, Locale[] aLocales, String aBundle) throws ServletModuleExc {\r
-    return makeGenerationData(aRequest, aResponse, aLocales, aBundle, aBundle);\r
-  }\r
-\r
-  public static Map makeGenerationData(HttpServletRequest aRequest, HttpServletResponse aResponse, Locale[] aLocales, String aBundle, String aDefaultBundle) throws ServletModuleExc {\r
-    try {\r
-      MirPropertiesConfiguration configuration = MirPropertiesConfiguration.instance();\r
-      Map result = GeneratorHelper.makeBasicGenerationData(aLocales, aBundle, aDefaultBundle);\r
-      if (configuration.getString("Mir.Admin.ShowLoggedinUsers").equals("1")) {\r
-        result.put("loggedinusers", MirGlobal.getLoggedInUsers());\r
-      }\r
-      else {\r
-        result.put("loggedinusers", null);\r
-      }\r
-      result.put("systemstatus", MirGlobal.getStatus());\r
-\r
-      // ML: hackish\r
-      ((Map) result.get("config")).put("actionRoot",\r
-             aResponse.encodeURL(MirGlobal.config().getString("RootUri") + "/servlet/Mir"));\r
-\r
-      result.put("returnurl", null);\r
-      result.put("login_user", getUserAdapter(aRequest));\r
-\r
-      return result;\r
-    }\r
-    catch (Throwable t) {\r
-      throw new ServletModuleFailure(t);\r
-    }\r
-  }\r
-\r
-  public static void generateResponse(PrintWriter aWriter, Map aGenerationData, String aGenerator) throws ServletModuleExc {\r
-    logger.debug("generator used: " + aGenerator);\r
-\r
-    Generator generator;\r
-\r
-    try {\r
-      generator = MirGlobal.localizer().generators().makeAdminGeneratorLibrary().makeGenerator(aGenerator);\r
-\r
-      generator.generate(aWriter, aGenerationData, logger);\r
-    }\r
-    catch (Throwable t) {\r
-      throw new ServletModuleFailure(t);\r
-    }\r
-  }\r
-\r
-  public static void generateOpenPostingResponse(PrintWriter aWriter, Map aGenerationData, String aGenerator) throws ServletModuleExc {\r
-    Generator generator;\r
-\r
-    try {\r
-      generator = MirGlobal.localizer().generators().makeOpenPostingGeneratorLibrary().makeGenerator(aGenerator);\r
-\r
-      generator.generate(aWriter, aGenerationData, logger);\r
-    }\r
-    catch (Throwable t) {\r
-      throw new ServletModuleFailure(t);\r
-    }\r
-  }\r
-\r
-  public static void generateInfoMessage(HttpServletRequest aRequest, HttpServletResponse aResponse,\r
-      Locale[] aLocales, String aBundle, String aDefaultBundle, String aMessage, String anArgument1, String anArgument2) throws ServletModuleExc {\r
-    Map responseData = makeGenerationData(aRequest, aResponse, aLocales, aBundle, aDefaultBundle);\r
-    responseData.put("message", aMessage);\r
-    responseData.put("argument1", anArgument1);\r
-    responseData.put("argument2", anArgument2);\r
-\r
-    try {\r
-      generateResponse(aResponse.getWriter(), responseData, "infomessage.template");\r
-    }\r
-    catch (IOException e) {\r
-      throw new ServletModuleFailure(e);\r
-    }\r
-  }\r
-\r
-  public static void redirect(HttpServletResponse aResponse, String aQuery) throws ServletModuleExc, ServletModuleFailure {\r
-    try {\r
-      aResponse.sendRedirect(aResponse.encodeRedirectURL(MirPropertiesConfiguration.instance().getString("RootUri") + "/servlet/Mir?"+aQuery));\r
-    }\r
-    catch (IOException t) {\r
-      throw new ServletModuleFailure("ServletModule.redirect: " +t.getMessage(), t);\r
-    }\r
-  }\r
-\r
-  public static void redirect(HttpServletResponse aResponse, String aModule, String aMethod) throws ServletModuleExc, ServletModuleFailure {\r
-    redirect(aResponse, "module="+aModule+"&do="+aMethod);\r
-  }\r
-\r
-  public static void setUser(HttpServletRequest aRequest, EntityUsers aUser) {\r
-    if (aUser!=null)\r
-      aRequest.getSession().setAttribute("login.uid", aUser);\r
-    else\r
-      aRequest.getSession().removeAttribute("login.uid");\r
-  }\r
-\r
-  public static EntityUsers getUser(HttpServletRequest aRequest) {\r
-    return (EntityUsers) aRequest.getSession().getAttribute("login.uid");\r
-  }\r
-\r
-  public static EntityAdapter getUserAdapter(HttpServletRequest aRequest) {\r
-    try {\r
-      return MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter( "user", (EntityUsers) aRequest.getSession().getAttribute("login.uid"));\r
-    }\r
-    catch (Throwable t) {\r
-      throw new ServletModuleFailure (t);\r
-    }\r
-  }\r
-\r
-  public static String getUserName(HttpServletRequest aRequest) {\r
-    EntityUsers user = getUser(aRequest);\r
-\r
-    if (user!=null)\r
-      return user.getFieldValue("login");\r
-    else\r
-      return "nobody";\r
-  }\r
-}\r
+/*
+ * 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.IOException;
+import java.io.PrintWriter;
+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.EntityAdapter;
+import mir.generator.Generator;
+import mir.generator.GeneratorHelper;
+import mir.log.LoggerWrapper;
+import mir.servlet.ServletModuleExc;
+import mir.servlet.ServletModuleFailure;
+import mircoders.entity.EntityUsers;
+import mircoders.global.MirGlobal;
+
+
+public class ServletHelper {
+  private static LoggerWrapper logger = new LoggerWrapper("ServletModule.Helper");
+
+  public static Map makeGenerationData(HttpServletRequest aRequest, HttpServletResponse aResponse, Locale[] aLocales) throws ServletModuleExc {
+    return makeGenerationData(aRequest, aResponse, aLocales, "etc/bundles/adminlocal", "bundles/admin");
+  }
+
+  public static Map makeGenerationData(HttpServletRequest aRequest, HttpServletResponse aResponse, Locale[] aLocales, String aBundle) throws ServletModuleExc {
+    return makeGenerationData(aRequest, aResponse, aLocales, aBundle, aBundle);
+  }
+
+  public static Map makeGenerationData(HttpServletRequest aRequest, HttpServletResponse aResponse, Locale[] aLocales, String aBundle, String aDefaultBundle) throws ServletModuleExc {
+    try {
+      MirPropertiesConfiguration configuration = MirPropertiesConfiguration.instance();
+      Map result = GeneratorHelper.makeBasicGenerationData(aLocales, aBundle, aDefaultBundle);
+      if (configuration.getString("Mir.Admin.ShowLoggedinUsers").equals("1")) {
+        result.put("loggedinusers", MirGlobal.getLoggedInUsers());
+      }
+      else {
+        result.put("loggedinusers", null);
+      }
+      result.put("systemstatus", MirGlobal.getStatus());
+
+      // ML: hackish
+      ((Map) result.get("config")).put("actionRoot",
+             aResponse.encodeURL(MirGlobal.config().getString("RootUri") + "/servlet/Mir"));
+
+      result.put("returnurl", null);
+      result.put("login_user", getUserAdapter(aRequest));
+
+      return result;
+    }
+    catch (Throwable t) {
+      throw new ServletModuleFailure(t);
+    }
+  }
+
+  public static void generateResponse(PrintWriter aWriter, Map aGenerationData, String aGenerator) throws ServletModuleExc {
+    logger.debug("generator used: " + aGenerator);
+
+    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);
+    }
+  }
+
+  public static void generateInfoMessage(HttpServletRequest aRequest, HttpServletResponse aResponse,
+      Locale[] aLocales, String aBundle, String aDefaultBundle, String aMessage, String anArgument1, String anArgument2) throws ServletModuleExc {
+    Map responseData = makeGenerationData(aRequest, aResponse, aLocales, aBundle, aDefaultBundle);
+    responseData.put("message", aMessage);
+    responseData.put("argument1", anArgument1);
+    responseData.put("argument2", anArgument2);
+
+    try {
+      generateResponse(aResponse.getWriter(), responseData, "infomessage.template");
+    }
+    catch (IOException e) {
+      throw new ServletModuleFailure(e);
+    }
+  }
+
+  public static void redirect(HttpServletResponse aResponse, String aQuery) throws ServletModuleExc, ServletModuleFailure {
+    try {
+      aResponse.sendRedirect(aResponse.encodeRedirectURL(MirPropertiesConfiguration.instance().getString("RootUri") + "/servlet/Mir?"+aQuery));
+    }
+    catch (IOException t) {
+      throw new ServletModuleFailure("ServletModule.redirect: " +t.getMessage(), t);
+    }
+  }
+
+  public static void redirect(HttpServletResponse aResponse, String aModule, String aMethod) throws ServletModuleExc, ServletModuleFailure {
+    redirect(aResponse, "module="+aModule+"&do="+aMethod);
+  }
+
+  public static void setUser(HttpServletRequest aRequest, EntityUsers aUser) {
+    if (aUser!=null)
+      aRequest.getSession().setAttribute("login.uid", aUser);
+    else
+      aRequest.getSession().removeAttribute("login.uid");
+  }
+
+  public static EntityUsers getUser(HttpServletRequest aRequest) {
+    return (EntityUsers) aRequest.getSession().getAttribute("login.uid");
+  }
+
+  public static EntityAdapter getUserAdapter(HttpServletRequest aRequest) {
+    try {
+      return MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter( "user", (EntityUsers) aRequest.getSession().getAttribute("login.uid"));
+    }
+    catch (Throwable t) {
+      throw new ServletModuleFailure (t);
+    }
+  }
+
+  public static String getUserName(HttpServletRequest aRequest) {
+    EntityUsers user = getUser(aRequest);
+
+    if (user!=null)
+      return user.getFieldValue("login");
+               return "nobody";
+  }
+}
index a44e541..c5bd8c9 100755 (executable)
 
 package mircoders.servlet;
 
+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.ServletModuleExc;
@@ -40,10 +45,6 @@ import mir.util.URLBuilder;
 import mircoders.abuse.FilterEngine;
 import mircoders.global.MirGlobal;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.Map;
-
 public class ServletModuleAbuse extends ServletModule {
   private static ServletModuleAbuse instance = new ServletModuleAbuse();
   private String editFilterTemplate;
index 568983b..38cf70a 100755 (executable)
@@ -32,6 +32,7 @@ package mircoders.servlet;
 import java.io.IOException;
 import java.io.Writer;
 import java.util.Map;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
index 40cdd78..89ce698 100755 (executable)
 
 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.entity.adapter.EntityAdapterModel;
 import mir.entity.adapter.EntityIteratorAdapter;
 import mir.log.LoggerWrapper;
@@ -37,16 +46,16 @@ import mir.servlet.ServletModule;
 import mir.servlet.ServletModuleExc;
 import mir.servlet.ServletModuleFailure;
 import mir.servlet.ServletModuleUserExc;
-import mir.util.*;
+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.storage.DatabaseComment;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.*;
-
 /*
  *  ServletModuleComment - controls navigation for Comments
  *
index e2a7042..d2a56d4 100755 (executable)
 
 package mircoders.servlet;
 
+import java.util.ArrayList;
+import java.util.Collections;
+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 mir.entity.adapter.EntityAdapter;
 import mir.entity.adapter.EntityAdapterModel;
 import mir.entity.adapter.EntityIteratorAdapter;
@@ -39,7 +51,11 @@ import mir.misc.StringUtil;
 import mir.servlet.ServletModule;
 import mir.servlet.ServletModuleExc;
 import mir.servlet.ServletModuleFailure;
-import mir.util.*;
+import mir.util.HTTPRequestParser;
+import mir.util.JDBCStringRoutines;
+import mir.util.SQLQueryBuilder;
+import mir.util.StringRoutines;
+import mir.util.URLBuilder;
 import mircoders.entity.EntityContent;
 import mircoders.entity.EntityUsers;
 import mircoders.global.MirGlobal;
@@ -47,10 +63,6 @@ import mircoders.module.ModuleContent;
 import mircoders.storage.DatabaseContent;
 import mircoders.storage.DatabaseContentToTopics;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.*;
-
 /**
  * Article admin interface code
  */
index c8e0c2e..9303347 100755 (executable)
@@ -37,7 +37,12 @@ import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.FilenameFilter;
 import java.io.StringWriter;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
@@ -55,8 +60,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.13.2.8 $ $Date: 2005/01/09 20:37:13 $
+ * @author $Author: rhindes $
+ * @version $Revision: 1.13.2.9 $ $Date: 2005/02/10 16:22:27 $
  *
  */
 
@@ -289,7 +294,7 @@ public class ServletModuleFileEdit extends ServletModule
 
         // TODO read array
         char[] c = new char[4096];
-        int read;;
+        int read;
         while ( (read=in.read(c)) != -1)
           out.write(c, 0, read);
         in.close();
index 0360630..2aa81ef 100755 (executable)
  */
 package mircoders.servlet;
 
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
 import mir.entity.adapter.EntityIteratorAdapter;
 import mir.log.LoggerWrapper;
 import mir.servlet.ServletModule;
@@ -41,12 +48,6 @@ import mir.util.JDBCStringRoutines;
 import mircoders.global.MirGlobal;
 import mircoders.module.ModuleContent;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Map;
-
 /*
  *  ServletModuleHidden - output of so called "censored" articles
  *  @author mh
index 582334f..e5b92b8 100755 (executable)
  */
 package mircoders.servlet;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+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.ServletModuleExc;
@@ -39,10 +47,6 @@ import mircoders.global.MirGlobal;
 import mircoders.module.ModuleComment;
 import mircoders.module.ModuleContent;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.*;
-
 public class ServletModuleLocalizer extends ServletModule {
   private static ServletModuleLocalizer instance = new ServletModuleLocalizer();
   public static ServletModule getInstance() { return instance; }
index 94007f7..62ac870 100755 (executable)
@@ -32,7 +32,6 @@ package mircoders.servlet;
 import mir.log.LoggerWrapper;
 import mir.servlet.ServletModule;
 import mircoders.module.ModuleMediaType;
-import mircoders.storage.DatabaseMediaType;
 
 public class ServletModuleMediaType extends ServletModule
 {
index 6de49f4..2ec9ec2 100755 (executable)
@@ -50,7 +50,6 @@ import java.util.Locale;
 import java.util.Map;
 import java.util.Random;
 import java.util.Set;
-import java.util.Vector;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -121,7 +120,7 @@ import org.apache.lucene.search.Searcher;
  *    open-postings to the newswire
  *
  * @author mir-coders group
- * @version $Id: ServletModuleOpenIndy.java,v 1.89.2.14 2005/01/23 15:36:05 zapata Exp $
+ * @version $Id: ServletModuleOpenIndy.java,v 1.89.2.15 2005/02/10 16:22:27 rhindes Exp $
  *
  */
 
index 03b4556..c5b02dc 100755 (executable)
  */
 package mircoders.servlet;
 
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+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.generator.Generator;
 import mir.log.LoggerWrapper;
 import mir.producer.ProducerFactory;
@@ -37,12 +49,6 @@ import mir.servlet.ServletModuleFailure;
 import mir.util.HTTPRequestParser;
 import mircoders.global.MirGlobal;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.*;
-
 public class ServletModuleProducer extends ServletModule
 {
   private static ServletModuleProducer instance = new ServletModuleProducer();
index 367ab53..ae3f66f 100755 (executable)
 
 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.entity.adapter.EntityAdapterModel;
 import mir.entity.adapter.EntityIteratorAdapter;
 import mir.log.LoggerWrapper;
@@ -45,10 +54,6 @@ import mircoders.global.MirGlobal;
 import mircoders.module.ModuleUsers;
 import mircoders.storage.DatabaseUsers;
 
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.util.*;
-
 /**
  *
  *
@@ -135,8 +140,7 @@ public class ServletModuleUsers extends ServletModule
 
       return newPassword;
     }
-    else
-      return null;
+               return null;
   }
 
   public void insert(HttpServletRequest aRequest, HttpServletResponse aResponse)
index 9921ee3..0b36989 100755 (executable)
@@ -41,7 +41,6 @@ package mircoders.storage;
 
 import mir.log.LoggerWrapper;
 import mir.storage.Database;
-import mir.storage.Database;
 import mir.storage.StorageObjectFailure;
 
 public class DatabaseArticleType extends Database {
index 9ab4a68..68b25e4 100755 (executable)
  */
 package mircoders.storage;
 
+import java.util.GregorianCalendar;
+
 import mir.entity.Entity;
 import mir.log.LoggerWrapper;
 import mir.misc.StringUtil;
 import mir.storage.Database;
 import mir.storage.StorageObjectFailure;
 
-import java.util.GregorianCalendar;
-
 public class DatabaseAudio extends Database {
 
   private static DatabaseAudio instance;
index a4b07df..e058f50 100755 (executable)
@@ -32,7 +32,6 @@ package mircoders.storage;
 
 import mir.log.LoggerWrapper;
 import mir.storage.Database;
-import mir.storage.Database;
 import mir.storage.StorageObjectFailure;
 
 /**
index ab545b6..12e8da1 100755 (executable)
@@ -36,7 +36,6 @@ import java.sql.Statement;
 
 import mir.log.LoggerWrapper;
 import mir.storage.Database;
-import mir.storage.Database;
 import mir.storage.StorageObjectFailure;
 
 /**
index 337d92b..46bc65b 100755 (executable)
@@ -32,7 +32,6 @@ package mircoders.storage;
 
 import mir.log.LoggerWrapper;
 import mir.storage.Database;
-import mir.storage.Database;
 import mir.storage.StorageObjectFailure;
 
 public class DatabaseCommentStatus extends Database {
index aa6267e..9f8807c 100755 (executable)
 package mircoders.storage;
 
 import java.sql.Connection;
-import java.sql.ResultSet;
 import java.sql.Statement;
 import java.util.ArrayList;
 
 import mir.entity.EntityList;
 import mir.log.LoggerWrapper;
 import mir.storage.Database;
-import mir.storage.Database;
-import mir.storage.StorageObjectExc;
 import mir.storage.StorageObjectFailure;
-import mircoders.entity.EntityComment;
 import mircoders.entity.EntityUploadedMedia;
 
 /**
  * <b>implements abstract DB connection to the comment_x_media SQL table
  *
  * @author RK, mir-coders group
- * @version $Id: DatabaseCommentToMedia.java,v 1.3.2.9 2005/01/23 15:36:05 zapata Exp $
+ * @version $Id: DatabaseCommentToMedia.java,v 1.3.2.10 2005/02/10 16:22:22 rhindes Exp $
  *
  */
 
index c5283a5..cf0258f 100755 (executable)
@@ -35,7 +35,6 @@ import java.sql.Statement;
 
 import mir.log.LoggerWrapper;
 import mir.storage.Database;
-import mir.storage.Database;
 import mir.storage.StorageObjectFailure;
 
 /**
index 8188465..bcdc80e 100755 (executable)
 package mircoders.storage;
 
 import java.sql.Connection;
-import java.sql.ResultSet;
 import java.sql.Statement;
 import java.util.ArrayList;
 
 import mir.entity.EntityList;
 import mir.log.LoggerWrapper;
 import mir.storage.Database;
-import mir.storage.Database;
-import mir.storage.StorageObjectExc;
 import mir.storage.StorageObjectFailure;
-import mircoders.entity.EntityContent;
 import mircoders.entity.EntityUploadedMedia;
 
 /**
  * <b>implements abstract DB connection to the content_x_media SQL table
  *
  * @author RK, mir-coders group
- * @version $Id: DatabaseContentToMedia.java,v 1.19.2.8 2005/01/23 15:36:05 zapata Exp $
+ * @version $Id: DatabaseContentToMedia.java,v 1.19.2.9 2005/02/10 16:22:22 rhindes Exp $
  *
  */
 
index 18ae652..d3f5571 100755 (executable)
 
 package mircoders.storage;
 
-import mir.entity.EntityList;
-import mir.log.LoggerWrapper;
-import mir.storage.Database;
-import mir.storage.Database;
-import mir.storage.StorageObjectFailure;
-import mircoders.entity.EntityContent;
-import mircoders.entity.EntityTopics;
-
 import java.sql.Connection;
 import java.sql.ResultSet;
 import java.sql.Statement;
@@ -46,6 +38,13 @@ import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
+import mir.entity.EntityList;
+import mir.log.LoggerWrapper;
+import mir.storage.Database;
+import mir.storage.StorageObjectFailure;
+import mircoders.entity.EntityContent;
+import mircoders.entity.EntityTopics;
+
 /**
  * <b>This class implements the 1-n-relation between
  * content and topic
index 6c34f7c..3a7fe73 100755 (executable)
@@ -1,58 +1,57 @@
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with  any library licensed under the Apache Software License,\r
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library\r
- * (or with modified versions of the above that use the same license as the above),\r
- * and distribute linked combinations including the two.  You must obey the\r
- * GNU General Public License in all respects for all of the code used other than\r
- * the above mentioned libraries.  If you modify this file, you may extend this\r
- * exception to your version of the file, but you are not obligated to do so.\r
- * If you do not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.storage;\r
-\r
-/**\r
- *\r
- */\r
-\r
-import mir.log.LoggerWrapper;\r
-import mir.storage.Database;\r
-import mir.storage.Database;\r
-\r
-public class DatabaseFilter extends Database {\r
-  private static DatabaseFilter instance;\r
-\r
-  public synchronized static DatabaseFilter getInstance() {\r
-    if (instance == null) {\r
-      instance = new DatabaseFilter();\r
-    }\r
-    \r
-    return instance;\r
-  }\r
-\r
-  private DatabaseFilter() {\r
-    super();\r
-\r
-    logger = new LoggerWrapper("Database.Filter");\r
-    mainTable = "filter";\r
-  }\r
-}\r
+/*
+ * 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;
+
+/**
+ *
+ */
+
+import mir.log.LoggerWrapper;
+import mir.storage.Database;
+
+public class DatabaseFilter extends Database {
+  private static DatabaseFilter instance;
+
+  public synchronized static DatabaseFilter getInstance() {
+    if (instance == null) {
+      instance = new DatabaseFilter();
+    }
+    
+    return instance;
+  }
+
+  private DatabaseFilter() {
+    super();
+
+    logger = new LoggerWrapper("Database.Filter");
+    mainTable = "filter";
+  }
+}
index e6c1696..e91e7f5 100755 (executable)
@@ -1,57 +1,56 @@
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with  any library licensed under the Apache Software License,\r
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library\r
- * (or with modified versions of the above that use the same license as the above),\r
- * and distribute linked combinations including the two.  You must obey the\r
- * GNU General Public License in all respects for all of the code used other than\r
- * the above mentioned libraries.  If you modify this file, you may extend this\r
- * exception to your version of the file, but you are not obligated to do so.\r
- * If you do not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.storage;\r
-\r
-/**\r
- *\r
- */\r
-\r
-import mir.log.LoggerWrapper;\r
-import mir.storage.Database;\r
-import mir.storage.Database;\r
-\r
-public class DatabaseFilterGroup extends Database {\r
-  private static DatabaseFilterGroup instance;\r
-\r
-  public synchronized static DatabaseFilterGroup getInstance() {\r
-    if (instance == null) {\r
-      instance = new DatabaseFilterGroup();\r
-    }\r
-    return instance;\r
-  }\r
-\r
-  private DatabaseFilterGroup() {\r
-    super();\r
-\r
-    logger = new LoggerWrapper("Database.FilterGroup");\r
-    mainTable="filter_group";\r
-  }\r
-}\r
+/*
+ * 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;
+
+/**
+ *
+ */
+
+import mir.log.LoggerWrapper;
+import mir.storage.Database;
+
+public class DatabaseFilterGroup extends Database {
+  private static DatabaseFilterGroup instance;
+
+  public synchronized static DatabaseFilterGroup getInstance() {
+    if (instance == null) {
+      instance = new DatabaseFilterGroup();
+    }
+    return instance;
+  }
+
+  private DatabaseFilterGroup() {
+    super();
+
+    logger = new LoggerWrapper("Database.FilterGroup");
+    mainTable="filter_group";
+  }
+}
index 545f0db..7b0ebda 100755 (executable)
@@ -32,7 +32,6 @@ package mircoders.storage;
 
 import mir.log.LoggerWrapper;
 import mir.storage.Database;
-import mir.storage.Database;
 
 /**
  * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
index e25ee77..6a42f0d 100755 (executable)
@@ -32,7 +32,6 @@ package mircoders.storage;
 
 import mir.log.LoggerWrapper;
 import mir.storage.Database;
-import mir.storage.Database;
 
 /**
  * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
index 2a3c882..066db53 100755 (executable)
@@ -32,7 +32,6 @@ package mircoders.storage;
 
 import mir.log.LoggerWrapper;
 import mir.storage.Database;
-import mir.storage.Database;
 
 /**
  * <b>Diese Klasse implementiert die Datenbankverbindung zur MetaObjekt-Tabelle
index 377767f..78bd2f9 100755 (executable)
@@ -31,7 +31,6 @@ package mircoders.storage;
 
 import mir.log.LoggerWrapper;
 import mir.storage.Database;
-import mir.storage.Database;
 
 /**
  *
index 8b9a70b..87ac2d8 100755 (executable)
@@ -36,7 +36,6 @@ import mir.entity.Entity;
 import mir.log.LoggerWrapper;
 import mir.misc.StringUtil;
 import mir.storage.Database;
-import mir.storage.Database;
 import mir.storage.StorageObjectFailure;
 
 /**
index f9ba4a2..bb0eac8 100755 (executable)
@@ -39,13 +39,16 @@ package mircoders.storage;
  * @version 1.0
  */
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 import mir.entity.Entity;
 import mir.entity.EntityBrowser;
 import mir.log.LoggerWrapper;
 import mir.storage.Database;
-import mir.storage.Database;
 import mir.storage.StorageObjectFailure;
 
 
index 0b1ed4c..b8f3397 100755 (executable)
@@ -31,7 +31,6 @@ package mircoders.storage;
 
 import mir.log.LoggerWrapper;
 import mir.storage.Database;
-import mir.storage.Database;
 import mir.storage.StorageObjectFailure;
 
 /**
index bbf4ecb..d4d113e 100755 (executable)
@@ -36,7 +36,6 @@ package mircoders.storage;
 
 import mir.log.LoggerWrapper;
 import mir.storage.Database;
-import mir.storage.Database;
 
 public class DatabaseMediafolder extends Database {
   private static DatabaseMediafolder instance;
index aeb8a16..87e5bfd 100755 (executable)
@@ -32,7 +32,6 @@ package mircoders.storage;
 
 import mir.log.LoggerWrapper;
 import mir.storage.Database;
-import mir.storage.Database;
 
 
 /**
index 2931809..6fe2936 100755 (executable)
@@ -36,7 +36,6 @@ import mir.entity.Entity;
 import mir.log.LoggerWrapper;
 import mir.misc.StringUtil;
 import mir.storage.Database;
-import mir.storage.Database;
 import mir.storage.StorageObjectFailure;
 
 /**
index 2f38d94..0d018d5 100755 (executable)
@@ -32,7 +32,6 @@ package mircoders.storage;
 
 import mir.log.LoggerWrapper;
 import mir.storage.Database;
-import mir.storage.Database;
 import mir.storage.StorageObjectFailure;
 
 /**
index 49c84d1..a478fef 100755 (executable)
 
 package mircoders.storage;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 import mir.entity.Entity;
 import mir.entity.EntityBrowser;
 import mir.log.LoggerWrapper;
 import mir.storage.Database;
-import mir.storage.Database;
 import mir.storage.StorageObjectFailure;
 
 /**
index 72bf3b5..0e173de 100755 (executable)
@@ -36,7 +36,6 @@ import mir.entity.Entity;
 import mir.entity.EntityBrowser;
 import mir.log.LoggerWrapper;
 import mir.storage.Database;
-import mir.storage.Database;
 import mir.storage.StorageObjectFailure;
 
 public class DatabaseUploadedMedia extends Database  {
index 02bc85e..66ffa86 100755 (executable)
@@ -32,7 +32,6 @@ package mircoders.storage;
 
 import mir.log.LoggerWrapper;
 import mir.storage.Database;
-import mir.storage.Database;
 import mir.storage.StorageObjectFailure;
 
 /**
index 6e253a2..7bcdaef 100755 (executable)
@@ -36,7 +36,6 @@ import mir.entity.Entity;
 import mir.log.LoggerWrapper;
 import mir.misc.StringUtil;
 import mir.storage.Database;
-import mir.storage.Database;
 import mir.storage.StorageObjectFailure;
 
 /**
index 0b007d4..9a76643 100755 (executable)
@@ -48,7 +48,6 @@ public class BundleTool {
   public static void compare(String aMaster, String aSlave) {
     PropertiesManipulator master;
     PropertiesManipulator slave;
-    PropertiesManipulator result;
 
     try {
       master = PropertiesManipulator.readProperties(
index ff68b2c..beadd1c 100755 (executable)
@@ -4,7 +4,6 @@ import java.awt.Transparency;
 import java.awt.image.ColorModel;
 import java.awt.image.DataBuffer;
 import java.awt.image.SampleModel;
-
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;