Use traditional getter name.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / WebInterface.java
index c518a87..08d04a8 100644 (file)
@@ -24,6 +24,7 @@ import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -35,6 +36,7 @@ import net.pterodactylus.sone.data.Sone;
 import net.pterodactylus.sone.freenet.L10nFilter;
 import net.pterodactylus.sone.freenet.wot.Identity;
 import net.pterodactylus.sone.main.SonePlugin;
+import net.pterodactylus.sone.template.CollectionAccessor;
 import net.pterodactylus.sone.template.GetPagePlugin;
 import net.pterodactylus.sone.template.IdentityAccessor;
 import net.pterodactylus.sone.template.PostAccessor;
@@ -55,7 +57,6 @@ import net.pterodactylus.sone.web.page.PageToadlet;
 import net.pterodactylus.sone.web.page.PageToadletFactory;
 import net.pterodactylus.sone.web.page.StaticPage;
 import net.pterodactylus.util.logging.Logging;
-import net.pterodactylus.util.service.AbstractService;
 import net.pterodactylus.util.template.DateFilter;
 import net.pterodactylus.util.template.DefaultTemplateFactory;
 import net.pterodactylus.util.template.MatchFilter;
@@ -76,7 +77,7 @@ import freenet.l10n.BaseL10n;
  *
  * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
  */
-public class WebInterface extends AbstractService {
+public class WebInterface {
 
        /** The logger. */
        private static final Logger logger = Logging.getLogger(WebInterface.class);
@@ -97,7 +98,6 @@ public class WebInterface extends AbstractService {
         *            The Sone plugin
         */
        public WebInterface(SonePlugin sonePlugin) {
-               super("Sone Web Interface", false);
                this.sonePlugin = sonePlugin;
                formPassword = sonePlugin.pluginRespirator().getToadletContainer().getFormPassword();
        }
@@ -143,27 +143,25 @@ public class WebInterface extends AbstractService {
         *
         * @return The form password
         */
-       public String formPassword() {
+       public String getFormPassword() {
                return formPassword;
        }
 
        //
-       // SERVICE METHODS
+       // ACTIONS
        //
 
        /**
-        * {@inheritDoc}
+        * Starts the web interface and registers all toadlets.
         */
-       @Override
-       protected void serviceStart() {
+       public void start() {
                registerToadlets();
        }
 
        /**
-        * {@inheritDoc}
+        * Stops the web interface and unregisters all toadlets.
         */
-       @Override
-       protected void serviceStop() {
+       public void stop() {
                unregisterToadlets();
        }
 
@@ -177,6 +175,7 @@ public class WebInterface extends AbstractService {
        private void registerToadlets() {
                DefaultTemplateFactory templateFactory = new DefaultTemplateFactory();
                templateFactory.addAccessor(Object.class, new ReflectionAccessor());
+               templateFactory.addAccessor(Collection.class, new CollectionAccessor());
                templateFactory.addAccessor(Sone.class, new SoneAccessor(core()));
                templateFactory.addAccessor(Post.class, new PostAccessor(core()));
                templateFactory.addAccessor(Reply.class, new ReplyAccessor(core()));