[seam-commits] Seam SVN: r8319 - in trunk/examples/wiki/src: main/org/jboss/seam/wiki/core/action and 8 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Jun 2 07:58:45 EDT 2008


Author: christian.bauer at jboss.com
Date: 2008-06-02 07:58:44 -0400 (Mon, 02 Jun 2008)
New Revision: 8319

Added:
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiFormattedTextValidator.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/MacroPluginModule.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/PluginModule.java
Removed:
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/module/
Modified:
   trunk/examples/wiki/src/etc/WEB-INF/web.xml
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/cache/PageFragmentCache.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiTextParser.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/FeedEntryManager.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/PluginRegistry.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/WikiPluginMacro.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/binding/lacewiki/PluginBinder.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/Plugin.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/UIWikiFormattedText.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiFormattedTextHandler.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiPluginThemeResource.java
   trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiTextEditor.java
   trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/TopicHome.java
Log:
Minor changes in plugin system, new wiki text validator

Modified: trunk/examples/wiki/src/etc/WEB-INF/web.xml
===================================================================
--- trunk/examples/wiki/src/etc/WEB-INF/web.xml	2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/etc/WEB-INF/web.xml	2008-06-02 11:58:44 UTC (rev 8319)
@@ -69,12 +69,12 @@
 
     <context-param>
         <param-name>com.sun.faces.numberOfViewsInSession</param-name>
-        <param-value>3</param-value>
+        <param-value>15</param-value>
     </context-param>
 
     <context-param>
         <param-name>com.sun.faces.numberOfLogicalViews</param-name>
-        <param-value>3</param-value>
+        <param-value>15</param-value>
     </context-param>
 
     <context-param>

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java	2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java	2008-06-02 11:58:44 UTC (rev 8319)
@@ -8,7 +8,6 @@
 
 import org.jboss.seam.ScopeType;
 import org.jboss.seam.Component;
-import org.jboss.seam.ui.validator.FormattedTextValidator;
 import org.jboss.seam.security.AuthorizationException;
 import org.jboss.seam.security.Identity;
 import org.jboss.seam.core.Events;
@@ -23,6 +22,7 @@
 import org.jboss.seam.wiki.core.action.prefs.CommentsPreferences;
 import org.jboss.seam.wiki.core.exception.InvalidWikiRequestException;
 import org.jboss.seam.wiki.core.ui.WikiRedirect;
+import org.jboss.seam.wiki.core.engine.WikiFormattedTextValidator;
 import org.jboss.seam.wiki.util.WikiUtil;
 
 import static org.jboss.seam.international.StatusMessage.Severity.INFO;
@@ -211,7 +211,7 @@
 
     // TODO: Why again are we using a different validator here for the text editor?
     protected boolean validateContent() {
-        FormattedTextValidator validator = new FormattedTextValidator();
+        WikiFormattedTextValidator validator = new WikiFormattedTextValidator();
         try {
             validator.validate(null, null, getInstance().getContent());
         } catch (ValidatorException e) {

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/cache/PageFragmentCache.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/cache/PageFragmentCache.java	2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/cache/PageFragmentCache.java	2008-06-02 11:58:44 UTC (rev 8319)
@@ -13,14 +13,13 @@
 import org.jboss.seam.ScopeType;
 import org.jboss.seam.wiki.core.plugin.PluginRegistry;
 import org.jboss.seam.wiki.core.plugin.metamodel.Plugin;
-import org.jboss.seam.wiki.core.plugin.metamodel.module.PluginModule;
+import org.jboss.seam.wiki.core.plugin.metamodel.PluginModule;
 import org.jboss.seam.annotations.Create;
 import org.jboss.seam.annotations.intercept.BypassInterceptors;
 import org.jboss.seam.contexts.Contexts;
 import org.jboss.seam.log.LogProvider;
 import org.jboss.seam.log.Logging;
 
-import java.io.Serializable;
 import java.util.*;
 
 /**
@@ -74,7 +73,7 @@
             for (String cacheRegion : requiredCacheRegions) {
                 Cache cache = EHCacheManager.instance().getCache(cacheRegion);
                 if (cache == null) {
-                    log.info("could not find configuration for region '" + cacheRegion + "', using defaults");
+                    log.info("using default configuration for region '" + cacheRegion + "'");
                     manager.addCache(cacheRegion);
                     cache = manager.getCache(cacheRegion);
                     log.debug("started EHCache region: " + cacheRegion);

Added: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiFormattedTextValidator.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiFormattedTextValidator.java	                        (rev 0)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiFormattedTextValidator.java	2008-06-02 11:58:44 UTC (rev 8319)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.seam.wiki.core.engine;
+
+import org.jboss.seam.ui.validator.FormattedTextValidator;
+import org.jboss.seam.text.SeamTextParser;
+import antlr.SemanticException;
+
+/**
+ * Disables the Seam Text validation for link tags, so wiki links are OK.
+ * <p>
+ * Also provides some i18n error messages.
+ * </p>
+ *
+ * @author Christian Bauer
+ */
+public class WikiFormattedTextValidator extends FormattedTextValidator {
+
+    public SeamTextParser getSeamTextParser(String s) {
+        SeamTextParser parser = super.getSeamTextParser(s);
+        parser.setSanitizer(
+            new SeamTextParser.DefaultSanitizer() {
+                @Override
+                public void validateLinkTagURI(String s) throws SemanticException {}
+
+                @Override
+                public String getInvalidURIMessage(String s) {
+                    return super.getInvalidURIMessage(s);
+                }
+
+                @Override
+                public String getInvalidElementMessage(String s) {
+                    return super.getInvalidElementMessage(s);
+                }
+
+                @Override
+                public String getInvalidAttributeMessage(String s, String s1) {
+                    return super.getInvalidAttributeMessage(s, s1);
+                }
+
+                @Override
+                public String getInvalidAttributeValueMessage(String s, String s1, String s2) {
+                    return super.getInvalidAttributeValueMessage(s, s1, s2);
+                }
+            }
+        );
+        return parser;
+    }
+
+    @Override
+    public String getNoViableAltErrorMessage(String s, String s1) {
+        return super.getNoViableAltErrorMessage(s, s1);
+    }
+
+    @Override
+    public String getMismatchedTokenErrorMessage(String s, String s1) {
+        return super.getMismatchedTokenErrorMessage(s, s1);
+    }
+
+    @Override
+    public String getSemanticErrorMessage(String s) {
+        return super.getSemanticErrorMessage(s);
+    }
+
+    @Override
+    public int getNumberOfCharsBeforeErrorLocation() {
+        return 20;
+    }
+
+    @Override
+    public int getNumberOfCharsAfterErrorLocation() {
+        return 20;
+    }
+
+}

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiTextParser.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiTextParser.java	2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/engine/WikiTextParser.java	2008-06-02 11:58:44 UTC (rev 8319)
@@ -7,6 +7,7 @@
 package org.jboss.seam.wiki.core.engine;
 
 import antlr.ANTLRException;
+import antlr.SemanticException;
 import org.jboss.seam.text.SeamTextLexer;
 import org.jboss.seam.text.SeamTextParser;
 import org.jboss.seam.wiki.core.model.*;
@@ -50,6 +51,15 @@
         super(new SeamTextLexer(new StringReader(wikiText)));
         this.renderDuplicateMacros = renderDuplicateMacros;
         this.resolveLinks = resolveLinks;
+
+        setSanitizer(
+            new DefaultSanitizer() {
+                @Override
+                public void validateLinkTagURI(String s) throws SemanticException {
+                    // NOOP, we validate that later in linkTag()
+                }
+            }
+        );
     }
 
     /**

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/FeedEntryManager.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/FeedEntryManager.java	2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/FeedEntryManager.java	2008-06-02 11:58:44 UTC (rev 8319)
@@ -14,10 +14,10 @@
 import org.jboss.seam.annotations.Logger;
 import org.jboss.seam.annotations.Scope;
 import org.jboss.seam.log.Log;
-import org.jboss.seam.ui.validator.FormattedTextValidator;
 import org.jboss.seam.wiki.core.engine.WikiLink;
 import org.jboss.seam.wiki.core.engine.WikiLinkResolver;
 import org.jboss.seam.wiki.core.engine.WikiTextParser;
+import org.jboss.seam.wiki.core.engine.WikiFormattedTextValidator;
 import org.jboss.seam.wiki.core.model.FeedEntry;
 import org.jboss.seam.wiki.core.model.WikiTextMacro;
 import org.jboss.seam.wiki.core.renderer.DefaultWikiTextRenderer;
@@ -70,7 +70,7 @@
 
         } catch (RecognitionException rex) {
             // Swallow and log and low debug level
-            log.debug( "Ignored parse error generating feed entry text: " + FormattedTextValidator.getErrorMessage(wikiText, rex) );
+            log.debug( "Ignored parse error generating feed entry text: " + WikiFormattedTextValidator.getErrorMessage(wikiText, rex) );
         } catch (ANTLRException ex) {
             // All other errors are fatal;
             throw new RuntimeException(ex);

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/PluginRegistry.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/PluginRegistry.java	2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/PluginRegistry.java	2008-06-02 11:58:44 UTC (rev 8319)
@@ -16,10 +16,9 @@
 import org.jboss.seam.log.LogProvider;
 import org.jboss.seam.log.Logging;
 import org.jboss.seam.wiki.core.plugin.metamodel.Plugin;
-import org.jboss.seam.wiki.core.plugin.metamodel.module.MacroPluginModule;
+import org.jboss.seam.wiki.core.plugin.metamodel.MacroPluginModule;
 import org.jboss.seam.wiki.core.plugin.binding.PluginBinder;
 import org.jboss.seam.wiki.core.exception.InvalidWikiConfigurationException;
-import org.jboss.seam.wiki.core.plugin.WikiPluginMacro;
 import org.jboss.seam.wiki.core.model.WikiTextMacro;
 
 import java.util.*;
@@ -67,10 +66,12 @@
         return Collections.unmodifiableSortedMap(plugins);
     }
 
+    // TODO: This should be unmodifiable and additions only allowed through a new registry method
     public SortedMap<String, MacroPluginModule> getMacroPluginModulesByKey() {
         return macroPluginModulesByKey;
     }
 
+    // TODO: This should be unmodifiable and additions only allowed through a new registry method
     public SortedMap<String, MacroPluginModule> getMacroPluginModulesByMacroName() {
         return macroPluginModulesByMacroName;
     }

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/WikiPluginMacro.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/WikiPluginMacro.java	2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/WikiPluginMacro.java	2008-06-02 11:58:44 UTC (rev 8319)
@@ -13,7 +13,7 @@
 import org.jboss.seam.log.Logging;
 import org.jboss.seam.wiki.core.model.WikiDocument;
 import org.jboss.seam.wiki.core.model.WikiTextMacro;
-import org.jboss.seam.wiki.core.plugin.metamodel.module.MacroPluginModule;
+import org.jboss.seam.wiki.core.plugin.metamodel.MacroPluginModule;
 import org.jboss.seam.wiki.util.Hash;
 
 import java.io.Serializable;

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/binding/lacewiki/PluginBinder.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/binding/lacewiki/PluginBinder.java	2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/binding/lacewiki/PluginBinder.java	2008-06-02 11:58:44 UTC (rev 8319)
@@ -13,10 +13,9 @@
 import org.jboss.seam.wiki.core.exception.InvalidWikiConfigurationException;
 import org.jboss.seam.wiki.core.plugin.PluginRegistry;
 import org.jboss.seam.wiki.core.plugin.PluginCacheManager;
-import org.jboss.seam.wiki.core.plugin.metamodel.Plugin;
-import org.jboss.seam.wiki.core.plugin.metamodel.PluginInfo;
-import org.jboss.seam.wiki.core.plugin.metamodel.module.MacroPluginModule;
-import org.jboss.seam.wiki.core.plugin.metamodel.module.PluginModule;
+import org.jboss.seam.wiki.core.plugin.metamodel.MacroPluginModule;
+import org.jboss.seam.wiki.core.plugin.metamodel.*;
+import org.jboss.seam.wiki.core.plugin.metamodel.PluginModule;
 import org.jboss.seam.wiki.preferences.PreferenceVisibility;
 import org.jboss.seam.wiki.preferences.metamodel.PreferenceEntity;
 import org.jboss.seam.wiki.preferences.metamodel.PreferenceRegistry;

Copied: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/MacroPluginModule.java (from rev 8261, trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/module/MacroPluginModule.java)
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/MacroPluginModule.java	                        (rev 0)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/MacroPluginModule.java	2008-06-02 11:58:44 UTC (rev 8319)
@@ -0,0 +1,163 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.seam.wiki.core.plugin.metamodel;
+
+import org.jboss.seam.wiki.core.plugin.metamodel.Plugin;
+import org.jboss.seam.wiki.preferences.metamodel.PreferenceEntity;
+
+import java.util.*;
+
+/**
+ * @author Christian Bauer
+ */
+public class MacroPluginModule extends PluginModule {
+
+    private String name;
+    private String[] skins = {"d"};
+    private DocumentArea[] applicableTo = {DocumentArea.CONTENT};
+    private RenderOption[] renderOptions;
+    private RenderDependency[] renderDependencies;
+    private PreferenceEntity preferenceEntity;
+    private SortedSet<PreferenceEntity.Property> parameters = new TreeSet<PreferenceEntity.Property>();
+
+    public MacroPluginModule(Plugin plugin, String key) {
+        super(plugin, key);
+    }
+
+    // TODO: This is currently not used at all, implement it in metadata/xsd/renderer
+    public static enum DocumentArea {
+        HEADER, CONTENT, FOOTER
+    }
+
+    public static enum RenderOption {
+        SINGLETON
+    }
+
+    // TODO: This is currently not used at all, implement it in metadata/xsd/renderer
+    public static class RenderDependency {
+
+        private String onMacro;
+        private Type type = Type.REQUIRED;
+
+        public RenderDependency(String onMacro, Type type) {
+            this.onMacro = onMacro;
+            this.type = type;
+        }
+
+        public String getOnMacro() {
+            return onMacro;
+        }
+
+        public Type getType() {
+            return type;
+        }
+
+        public enum Type {
+            REQUIRED, INCOMPATIBLE
+        }
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String[] getSkins() {
+        return skins;
+    }
+
+    public void setSkins(String[] skins) {
+        this.skins = skins;
+    }
+
+    public boolean isAvailableForSkin(String skin) {
+        for (String s : skins) {
+            if (skin.equals(s)) return true;
+        }
+        return false;
+    }
+
+    public DocumentArea[] getApplicableTo() {
+        return applicableTo;
+    }
+
+    public void setApplicableTo(DocumentArea[] applicableTo) {
+        this.applicableTo = applicableTo;
+    }
+
+    public boolean isApplicableTo(DocumentArea area) {
+        for (DocumentArea documentArea : getApplicableTo()) {
+            if (area.equals(documentArea)) return true;
+        }
+        return false;
+    }
+
+    public RenderOption[] getRenderOptions() {
+        return renderOptions;
+    }
+
+    public void setRenderOptions(RenderOption[] renderOptions) {
+        this.renderOptions = renderOptions;
+    }
+
+    public boolean isRenderOptionSet(RenderOption renderOption) {
+        if (getRenderOptions() == null) return false;
+        for (RenderOption option : getRenderOptions()) {
+            if (renderOption.equals(option)) return true;
+        }
+        return false;
+    }
+
+    public RenderDependency[] getRenderDependencies() {
+        return renderDependencies;
+    }
+
+    public void setRenderDependencies(RenderDependency[] renderDependencies) {
+        this.renderDependencies = renderDependencies;
+    }
+
+    public PreferenceEntity getPreferenceEntity() {
+        return preferenceEntity;
+    }
+
+    public void setPreferenceEntity(PreferenceEntity preferenceEntity) {
+        this.preferenceEntity = preferenceEntity;
+        for (PreferenceEntity.Property property : preferenceEntity.getPropertiesInstanceVisible()) {
+            parameters.add(property);
+        }
+    }
+
+    public SortedSet<PreferenceEntity.Property> getParameters() {
+        return parameters;
+    }
+
+    public List<PreferenceEntity.Property> getParametersAsList() {
+        return Collections.unmodifiableList(new ArrayList(parameters));
+    }
+
+    public String getRequestImagePath() {
+        return Plugin.GENERATE_RESOURCE_PATH_THEME
+                + "/" + getPlugin().getKey()
+                + "/" + getKey()
+                + "/" + Plugin.PACKAGE_THEMES_IMG;
+    }
+
+    public String getRequestCSSPath() {
+        return Plugin.GENERATE_RESOURCE_PATH_THEME
+                + "/" + getPlugin().getKey()
+                + "/" + getKey() 
+                + "/" + Plugin.PACKAGE_THEMES_CSS;
+    }
+
+    // TODO: This is only used in the Administration UI
+    public String getModuleTypeLabel() {
+        return "Macro";
+    }
+}

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/Plugin.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/Plugin.java	2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/Plugin.java	2008-06-02 11:58:44 UTC (rev 8319)
@@ -8,7 +8,7 @@
 
 import org.jboss.seam.Component;
 import org.jboss.seam.wiki.core.exception.InvalidWikiConfigurationException;
-import org.jboss.seam.wiki.core.plugin.metamodel.module.PluginModule;
+import org.jboss.seam.wiki.core.plugin.metamodel.PluginModule;
 
 import java.util.ArrayList;
 import java.util.List;

Copied: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/PluginModule.java (from rev 8261, trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/module/PluginModule.java)
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/PluginModule.java	                        (rev 0)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/plugin/metamodel/PluginModule.java	2008-06-02 11:58:44 UTC (rev 8319)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package org.jboss.seam.wiki.core.plugin.metamodel;
+
+import org.jboss.seam.wiki.core.plugin.metamodel.Plugin;
+import org.jboss.seam.wiki.core.exception.InvalidWikiConfigurationException;
+
+import java.util.*;
+
+/**
+ * @author Christian Bauer
+ */
+public abstract class PluginModule {
+
+    private Plugin plugin;
+    private String key;
+    private String label;
+    private String description;
+    private String className;
+    private SortedSet<String> fragmentCacheRegions = new TreeSet<String>();
+
+    protected PluginModule(Plugin plugin, String key) {
+        if (!key.matches(Plugin.KEY_PATTERN))
+            throw new InvalidWikiConfigurationException("Key doesn't match pattern '"+Plugin.KEY_PATTERN+"': " + key);
+
+        this.plugin = plugin;
+        this.key = key;
+    }
+
+    public Plugin getPlugin() {
+        return plugin;
+    }
+
+    public String getKey() {
+        return key;
+    }
+
+    public void setKey(String key) {
+        this.key = key;
+    }
+
+
+    public String getLabel() {
+        return label;
+    }
+
+    public void setLabel(String label) {
+        this.label = label;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public String getClassName() {
+        return className;
+    }
+
+    public void setClassName(String className) {
+        this.className = className;
+    }
+
+    public SortedSet<String> getFragmentCacheRegions() {
+        return fragmentCacheRegions;
+    }
+
+    public List<String> getFragmentCacheRegionsAsList() {
+        return Collections.unmodifiableList(new ArrayList<String>(getFragmentCacheRegions()));
+    }
+
+    public void setFragmentCacheRegions(SortedSet<String> fragmentCacheRegions) {
+        this.fragmentCacheRegions = fragmentCacheRegions;
+    }
+
+    public void addFragmentCacheRegion(String name) {
+        getFragmentCacheRegions().add(getQualifiedCacheRegionName(name));
+    }
+
+    public String getFullyQualifiedKey() {
+        return getPlugin().getKey() + "." + getKey();
+    }
+
+    public String getQualifiedCacheRegionName(String name) {
+        return getFullyQualifiedKey() + "." + name;
+    }
+
+
+}

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/UIWikiFormattedText.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/UIWikiFormattedText.java	2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/UIWikiFormattedText.java	2008-06-02 11:58:44 UTC (rev 8319)
@@ -14,7 +14,6 @@
 import org.jboss.seam.log.Log;
 import org.jboss.seam.log.Logging;
 import org.jboss.seam.ui.util.JSF;
-import org.jboss.seam.ui.validator.FormattedTextValidator;
 import org.jboss.seam.wiki.core.engine.*;
 import org.jboss.seam.wiki.core.model.WikiFile;
 import org.jboss.seam.wiki.core.model.WikiUploadImage;
@@ -272,7 +271,7 @@
 
         } catch (RecognitionException rex) {
             // Log a nice message for any lexer/parser errors, users can disable this if they want to
-            log.warn( FormattedTextValidator.getErrorMessage((String) getValue(), rex) );
+            log.warn( WikiFormattedTextValidator.getErrorMessage((String) getValue(), rex) );
         } catch (ANTLRException ex) {
             // All other errors are fatal;
             throw new RuntimeException(ex);

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiFormattedTextHandler.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiFormattedTextHandler.java	2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiFormattedTextHandler.java	2008-06-02 11:58:44 UTC (rev 8319)
@@ -25,7 +25,7 @@
 import org.jboss.seam.wiki.core.engine.WikiTextParser;
 import org.jboss.seam.wiki.core.plugin.WikiPluginMacro;
 import org.jboss.seam.wiki.core.plugin.PluginRegistry;
-import org.jboss.seam.wiki.core.plugin.metamodel.module.MacroPluginModule;
+import org.jboss.seam.wiki.core.plugin.metamodel.MacroPluginModule;
 import org.jboss.seam.wiki.core.renderer.NullWikiTextRenderer;
 import org.jboss.seam.wiki.core.model.WikiTextMacro;
 import org.ajax4jsf.component.html.HtmlLoadStyle;

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiPluginThemeResource.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiPluginThemeResource.java	2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiPluginThemeResource.java	2008-06-02 11:58:44 UTC (rev 8319)
@@ -18,7 +18,7 @@
 import org.jboss.seam.wiki.core.plugin.PluginRegistry;
 import org.jboss.seam.wiki.core.plugin.WikiPluginMacro;
 import org.jboss.seam.wiki.core.plugin.metamodel.Plugin;
-import org.jboss.seam.wiki.core.plugin.metamodel.module.MacroPluginModule;
+import org.jboss.seam.wiki.core.plugin.metamodel.MacroPluginModule;
 import org.jboss.seam.wiki.core.model.WikiTextMacro;
 import org.jboss.seam.core.Expressions;
 

Modified: trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiTextEditor.java
===================================================================
--- trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiTextEditor.java	2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiTextEditor.java	2008-06-02 11:58:44 UTC (rev 8319)
@@ -4,9 +4,9 @@
 import org.jboss.seam.annotations.Scope;
 import org.jboss.seam.annotations.Logger;
 import org.jboss.seam.ScopeType;
+import org.jboss.seam.wiki.core.engine.WikiFormattedTextValidator;
 import org.jboss.seam.international.StatusMessages;
 import org.jboss.seam.log.Log;
-import org.jboss.seam.ui.validator.FormattedTextValidator;
 
 import static org.jboss.seam.international.StatusMessage.Severity.WARN;
 
@@ -30,12 +30,11 @@
     public void validate(String textEditorId, String value) {
         if (value == null) return;
         log.debug("validating value of text editor: " + textEditorId);
-        FormattedTextValidator validator = new FormattedTextValidator();
+        WikiFormattedTextValidator validator = new WikiFormattedTextValidator();
         try {
             validator.validate(null, null, value);
         } catch (ValidatorException e) {
             log.debug("exception during validation: " + e.getFacesMessage().getSummary());
-            // TODO: Needs to use resource bundle, how?
             StatusMessages.instance().addToControl(
                 textEditorId + "TextArea",
                 WARN,

Modified: trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/TopicHome.java
===================================================================
--- trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/TopicHome.java	2008-06-02 11:54:08 UTC (rev 8318)
+++ trunk/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/TopicHome.java	2008-06-02 11:58:44 UTC (rev 8319)
@@ -7,13 +7,13 @@
 import org.jboss.seam.core.Events;
 import org.jboss.seam.faces.Renderer;
 import org.jboss.seam.international.StatusMessages;
-import org.jboss.seam.ui.validator.FormattedTextValidator;
 import org.jboss.seam.wiki.core.action.DocumentHome;
 import org.jboss.seam.wiki.core.model.WikiDirectory;
 import org.jboss.seam.wiki.core.model.WikiDocument;
 import org.jboss.seam.wiki.core.model.WikiTextMacro;
 import org.jboss.seam.wiki.core.ui.WikiRedirect;
 import org.jboss.seam.wiki.core.plugin.PluginRegistry;
+import org.jboss.seam.wiki.core.engine.WikiFormattedTextValidator;
 import org.jboss.seam.wiki.preferences.Preferences;
 
 import static org.jboss.seam.international.StatusMessage.Severity.WARN;
@@ -69,11 +69,11 @@
 
     @Override
     protected boolean preparePersist() {
-        FormattedTextValidator validator = new FormattedTextValidator();
+        // TODO: Why here again?
+        WikiFormattedTextValidator validator = new WikiFormattedTextValidator();
         try {
             validator.validate(null, null, getInstance().getContent());
         } catch (ValidatorException e) {
-            // TODO: Needs to use resource bundle, how?
             StatusMessages.instance().addToControl(
                 "topicTextArea",
                 WARN,




More information about the seam-commits mailing list