let us start using struts.\rand some fixes in the new persistence layer.
authoridfx <idfx>
Fri, 5 Sep 2003 20:23:59 +0000 (20:23 +0000)
committeridfx <idfx>
Fri, 5 Sep 2003 20:23:59 +0000 (20:23 +0000)
40 files changed:
source/mir/core/model/Audio.hbm.xml
source/mir/core/model/Comment.hbm.xml
source/mir/core/model/Comment.java
source/mir/core/model/Content.hbm.xml
source/mir/core/model/Content.java
source/mir/core/model/Feature.hbm.xml
source/mir/core/model/Feature.java
source/mir/core/model/IContent.java
source/mir/core/model/IMedia.java
source/mir/core/model/Image.hbm.xml
source/mir/core/model/Media.hbm.xml
source/mir/core/model/Media.java
source/mir/core/model/OtherMedia.hbm.xml
source/mir/core/model/Topic.java
source/mir/core/model/TopicStub.java [new file with mode: 0755]
source/mir/core/model/UploadedMedia.hbm.xml
source/mir/core/model/Video.hbm.xml
source/mir/core/service/storage/ArticleTypeService.java
source/mir/core/service/storage/AudioService.java
source/mir/core/service/storage/BreakingService.java
source/mir/core/service/storage/CommentService.java
source/mir/core/service/storage/CommentStatusService.java
source/mir/core/service/storage/ContentService.java
source/mir/core/service/storage/ImageService.java
source/mir/core/service/storage/LanguageService.java
source/mir/core/service/storage/MediaFolderService.java
source/mir/core/service/storage/MessageService.java
source/mir/core/service/storage/OtherMediaService.java
source/mir/core/service/storage/SessionHolder.java
source/mir/core/service/storage/StorageService.java
source/mir/core/service/storage/TopicService.java
source/mir/core/service/storage/UploadedMediaService.java
source/mir/core/service/storage/UserService.java
source/mir/core/service/storage/VideoService.java
source/mir/core/test/Test.java
source/mir/core/ui/action/AuthenticationAction.java [new file with mode: 0755]
source/mir/core/ui/filter/AuthenticationFilter.java [new file with mode: 0755]
source/mir/core/ui/plugin/HibernatePlugin.java [new file with mode: 0755]
source/mir/core/ui/servlet/ServletConstants.java [new file with mode: 0755]
source/mir/core/ui/servlet/TemplateServlet.java [new file with mode: 0755]

index 5f303d4..bb2a39e 100755 (executable)
         length="255"
     />
     <property
-        name="isPublished"
+        name="published"
         type="boolean"
         column="is_published"
         not-null="true"
         length="1"
     />
     <property
-        name="isProduced"
+        name="produced"
         type="boolean"
         column="is_produced"
         not-null="true"
index 1385c10..605b18c 100755 (executable)
-<?xml version="1.0"?>\r
-<!DOCTYPE hibernate-mapping PUBLIC\r
-    "-//Hibernate/Hibernate Mapping DTD//EN"\r
-    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >\r
-    \r
-<hibernate-mapping>\r
-\r
-<!-- \r
-    Created by Middlegen Hibernate plugin\r
-\r
-    http://boss.bekk.no/boss/middlegen/\r
-    http://hibernate.sourceforge.net/\r
--->\r
-\r
-<class \r
-    name="mir.core.model.Comment" \r
-    table="comment"\r
->\r
-    <id\r
-        name="id"\r
-        type="int"\r
-        column="id"\r
-    >\r
-        <generator class="assigned" />\r
-    </id>\r
-    <property\r
-        name="title"\r
-        type="java.lang.String"\r
-        column="title"\r
-        not-null="true"\r
-        length="80"\r
-    />\r
-    <property\r
-        name="creator"\r
-        type="java.lang.String"\r
-        column="creator"\r
-        not-null="true"\r
-        length="80"\r
-    />\r
-    <property\r
-        name="description"\r
-        type="java.lang.String"\r
-        column="description"\r
-        not-null="true"\r
-        length="-1"\r
-    />\r
-    <property\r
-        name="mainUrl"\r
-        type="java.lang.String"\r
-        column="main_url"\r
-        length="255"\r
-    />\r
-    <property\r
-        name="email"\r
-        type="java.lang.String"\r
-        column="email"\r
-        length="80"\r
-    />\r
-    <property\r
-        name="address"\r
-        type="java.lang.String"\r
-        column="address"\r
-        length="80"\r
-    />\r
-    <property\r
-        name="phone"\r
-        type="java.lang.String"\r
-        column="phone"\r
-        length="20"\r
-    />\r
-    <property\r
-        name="webdbCreate"\r
-        type="java.sql.Timestamp"\r
-        column="webdb_create"\r
-        not-null="true"\r
-        length="8"\r
-    />\r
-    <property\r
-        name="isPublished"\r
-        type="boolean"\r
-        column="is_published"\r
-        not-null="true"\r
-        length="1"\r
-    />\r
-    <property\r
-        name="toLanguage"\r
-        type="int"\r
-        column="to_language"\r
-        not-null="true"\r
-        length="4"\r
-    />\r
-    <property\r
-        name="toMedia"\r
-        type="int"\r
-        column="to_media"\r
-        not-null="true"\r
-        length="4"\r
-    />\r
-    <property\r
-        name="toCommentStatus"\r
-        type="short"\r
-        column="to_comment_status"\r
-        length="2"\r
-    />\r
-    <property\r
-        name="checksum"\r
-        type="int"\r
-        column="checksum"\r
-        length="4"\r
-    />\r
-    <property\r
-        name="isHtml"\r
-        type="boolean"\r
-        column="is_html"\r
-        not-null="true"\r
-        length="1"\r
-    />\r
-\r
-    <!-- associations -->\r
-\r
-</class>\r
-</hibernate-mapping>\r
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+    "-//Hibernate/Hibernate Mapping DTD//EN"
+    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
+    
+<hibernate-mapping>
+
+<!-- 
+    Created by Middlegen Hibernate plugin
+
+    http://boss.bekk.no/boss/middlegen/
+    http://hibernate.sourceforge.net/
+-->
+
+<class 
+    name="mir.core.model.Comment" 
+    table="comment"
+>
+    <id
+        name="id"
+        type="int"
+        column="id"
+    >
+        <generator class="assigned" />
+    </id>
+    <property
+        name="title"
+        type="java.lang.String"
+        column="title"
+        not-null="true"
+        length="80"
+    />
+    <property
+        name="creator"
+        type="java.lang.String"
+        column="creator"
+        not-null="true"
+        length="80"
+    />
+    <property
+        name="description"
+        type="java.lang.String"
+        column="description"
+        not-null="true"
+        length="-1"
+    />
+    <property
+        name="mainUrl"
+        type="java.lang.String"
+        column="main_url"
+        length="255"
+    />
+    <property
+        name="email"
+        type="java.lang.String"
+        column="email"
+        length="80"
+    />
+    <property
+        name="address"
+        type="java.lang.String"
+        column="address"
+        length="80"
+    />
+    <property
+        name="phone"
+        type="java.lang.String"
+        column="phone"
+        length="20"
+    />
+    <property
+        name="webdbCreate"
+        type="java.sql.Timestamp"
+        column="webdb_create"
+        not-null="true"
+        length="8"
+    />
+    <property
+        name="published"
+        type="boolean"
+        column="is_published"
+        not-null="true"
+        length="1"
+    />
+    <property
+        name="toLanguage"
+        type="int"
+        column="to_language"
+        not-null="true"
+        length="4"
+    />
+    <property
+        name="toMedia"
+        type="int"
+        column="to_media"
+        not-null="true"
+        length="4"
+    />
+    <property
+        name="toCommentStatus"
+        type="short"
+        column="to_comment_status"
+        length="2"
+    />
+    <property
+        name="checksum"
+        type="int"
+        column="checksum"
+        length="4"
+    />
+    <property
+        name="html"
+        type="boolean"
+        column="is_html"
+        not-null="true"
+        length="1"
+    />
+
+    <!-- associations -->
+
+</class>
+</hibernate-mapping>
index 19de47b..9b186e7 100755 (executable)
@@ -41,7 +41,7 @@ import org.apache.commons.lang.builder.ToStringBuilder;
  * 
  * Comment
  * @author idefix
- * @version $Id: Comment.java,v 1.2 2003/08/17 19:13:19 idfx Exp $
+ * @version $Id: Comment.java,v 1.3 2003/09/05 20:23:59 idfx Exp $
  */
 public class Comment implements Serializable {
 
@@ -198,11 +198,11 @@ public class Comment implements Serializable {
         this.webdbCreate = webdbCreate;
     }
 
-    public boolean isIsPublished() {
+    public boolean isPublished() {
         return this.isPublished;
     }
 
-    public void setIsPublished(boolean isPublished) {
+    public void setPublished(boolean isPublished) {
         this.isPublished = isPublished;
     }
 
@@ -238,11 +238,11 @@ public class Comment implements Serializable {
         this.checksum = checksum;
     }
 
-    public boolean isIsHtml() {
+    public boolean isHtml() {
         return this.isHtml;
     }
 
-    public void setIsHtml(boolean isHtml) {
+    public void setHtml(boolean isHtml) {
         this.isHtml = isHtml;
     }
 
index 5dbe211..9c0bc7c 100755 (executable)
         length="255"
     />
     <property
-        name="isPublished"
+        name="published"
         type="boolean"
         column="is_published"
         not-null="true"
         length="1"
     />
     <property
-        name="isProduced"
+        name="produced"
         type="boolean"
         column="is_produced"
         not-null="true"
         length="8"
     />
     <property
-       name="isHtml"
+       name="html"
        type="boolean"
        column="is_html"
        not-null="true"
index 2ddd69c..a9330df 100755 (executable)
@@ -40,7 +40,7 @@ import org.apache.commons.lang.builder.ToStringBuilder;
  * 
  * Content
  * @author idefix
- * @version $Id: Content.java,v 1.3 2003/08/19 00:41:54 idfx Exp $
+ * @version $Id: Content.java,v 1.4 2003/09/05 20:23:59 idfx Exp $
  */
 public class Content extends Media implements Serializable, IContent {
 
@@ -69,11 +69,11 @@ public class Content extends Media implements Serializable, IContent {
     public Content() {
     }
 
-    public boolean isIsHtml() {
+    public boolean isHtml() {
         return this.isHtml;
     }
 
-    public void setIsHtml(boolean isHtml) {
+    public void setHtml(boolean isHtml) {
         this.isHtml = isHtml;
     }
 
index d9d5892..12f1881 100755 (executable)
@@ -1,63 +1,63 @@
-<?xml version="1.0"?>\r
-<!DOCTYPE hibernate-mapping PUBLIC\r
-    "-//Hibernate/Hibernate Mapping DTD//EN"\r
-    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >\r
-    \r
-<hibernate-mapping>\r
-\r
-<!-- \r
-    Created by Middlegen Hibernate plugin\r
-\r
-    http://boss.bekk.no/boss/middlegen/\r
-    http://hibernate.sourceforge.net/\r
--->\r
-\r
-<class \r
-    name="mir.core.model.Feature" \r
-    table="feature"\r
->\r
-    <id\r
-        name="id"\r
-        type="int"\r
-        column="id"\r
-    >\r
-        <generator class="sequence" />\r
-    </id>\r
-    <property\r
-        name="title"\r
-        type="java.lang.String"\r
-        column="title"\r
-        not-null="true"\r
-        length="80"\r
-    />\r
-    <property\r
-        name="description"\r
-        type="java.lang.String"\r
-        column="description"\r
-        length="-1"\r
-    />\r
-    <property\r
-        name="filename"\r
-        type="java.lang.String"\r
-        column="filename"\r
-        not-null="true"\r
-        length="20"\r
-    />\r
-    <property\r
-        name="mainUrl"\r
-        type="java.lang.String"\r
-        column="main_url"\r
-        length="255"\r
-    />\r
-    <property\r
-        name="isPublished"\r
-        type="boolean"\r
-        column="is_published"\r
-        not-null="true"\r
-        length="1"\r
-    />\r
-\r
-    <!-- associations -->\r
-\r
-</class>\r
-</hibernate-mapping>\r
+<?xml version="1.0"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+    "-//Hibernate/Hibernate Mapping DTD//EN"
+    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
+    
+<hibernate-mapping>
+
+<!-- 
+    Created by Middlegen Hibernate plugin
+
+    http://boss.bekk.no/boss/middlegen/
+    http://hibernate.sourceforge.net/
+-->
+
+<class 
+    name="mir.core.model.Feature" 
+    table="feature"
+>
+    <id
+        name="id"
+        type="int"
+        column="id"
+    >
+        <generator class="sequence" />
+    </id>
+    <property
+        name="title"
+        type="java.lang.String"
+        column="title"
+        not-null="true"
+        length="80"
+    />
+    <property
+        name="description"
+        type="java.lang.String"
+        column="description"
+        length="-1"
+    />
+    <property
+        name="filename"
+        type="java.lang.String"
+        column="filename"
+        not-null="true"
+        length="20"
+    />
+    <property
+        name="mainUrl"
+        type="java.lang.String"
+        column="main_url"
+        length="255"
+    />
+    <property
+        name="published"
+        type="boolean"
+        column="is_published"
+        not-null="true"
+        length="1"
+    />
+
+    <!-- associations -->
+
+</class>
+</hibernate-mapping>
index c348a1e..76d2011 100755 (executable)
@@ -41,7 +41,7 @@ import org.apache.commons.lang.builder.ToStringBuilder;
  * 
  * Feature
  * @author idefix
- * @version $Id: Feature.java,v 1.2 2003/08/17 19:13:19 idfx Exp $
+ * @version $Id: Feature.java,v 1.3 2003/09/05 20:23:59 idfx Exp $
  */
 public class Feature implements Serializable {
 
@@ -123,11 +123,11 @@ public class Feature implements Serializable {
         this.mainUrl = mainUrl;
     }
 
-    public boolean isIsPublished() {
+    public boolean isPublished() {
         return this.isPublished;
     }
 
-    public void setIsPublished(boolean isPublished) {
+    public void setPublished(boolean isPublished) {
         this.isPublished = isPublished;
     }
 
index 76eef82..f56b38d 100755 (executable)
@@ -36,11 +36,11 @@ import java.util.Set;
 /**
  * IContent
  * @author idefix
- * @version $Id: IContent.java,v 1.1 2003/08/19 00:41:54 idfx Exp $
+ * @version $Id: IContent.java,v 1.2 2003/09/05 20:23:59 idfx Exp $
  */
 public interface IContent extends IMedia {
-       public abstract boolean isIsHtml();
-       public abstract void setIsHtml(boolean isHtml);
+       public abstract boolean isHtml();
+       public abstract void setHtml(boolean isHtml);
        public abstract java.lang.String getContentData();
        public abstract void setContentData(java.lang.String contentData);
        public abstract ArticleType getArticleType();
index e3bbb30..eeb6ff1 100755 (executable)
@@ -37,7 +37,7 @@ import java.util.Set;
 /**
  * IMedia
  * @author idefix
- * @version $Id: IMedia.java,v 1.1 2003/08/19 00:41:54 idfx Exp $
+ * @version $Id: IMedia.java,v 1.2 2003/09/05 20:23:59 idfx Exp $
  */
 public interface IMedia {
        public abstract java.lang.Integer getId();
@@ -74,10 +74,6 @@ public interface IMedia {
        public abstract void setPublishServer(java.lang.String publishServer);
        public abstract java.lang.String getPublishPath();
        public abstract void setPublishPath(java.lang.String publishPath);
-       public abstract boolean isIsPublished();
-       public abstract void setIsPublished(boolean isPublished);
-       public abstract boolean isIsProduced();
-       public abstract void setIsProduced(boolean isProduced);
        public abstract java.util.Date getWebdbCreate();
        public abstract void setWebdbCreate(java.util.Date webdbCreate);
        public abstract java.util.Date getWebdbLastchange();
index 50d1567..e7d8038 100755 (executable)
         length="255"
     />
     <property
-        name="isPublished"
+        name="published"
         type="boolean"
         column="is_published"
         not-null="true"
         length="1"
     />
     <property
-        name="isProduced"
+        name="produced"
         type="boolean"
         column="is_produced"
         not-null="true"
index 4795b17..1cf55ec 100755 (executable)
         length="255"
     />
     <property
-        name="isPublished"
+        name="published"
         type="boolean"
         column="is_published"
         not-null="true"
         length="1"
     />
     <property
-        name="isProduced"
+        name="produced"
         type="boolean"
         column="is_produced"
         not-null="true"
index 54d1a80..132fc46 100755 (executable)
@@ -44,7 +44,7 @@ import org.apache.commons.lang.builder.ToStringBuilder;
  * 
  * Media
  * @author idefix
- * @version $Id: Media.java,v 1.4 2003/08/19 00:41:54 idfx Exp $
+ * @version $Id: Media.java,v 1.5 2003/09/05 20:23:59 idfx Exp $
  */
 public class Media implements Serializable, IMedia {
 
@@ -266,22 +266,6 @@ public class Media implements Serializable, IMedia {
         this.publishPath = publishPath;
     }
 
-    public boolean isIsPublished() {
-        return this.isPublished;
-    }
-
-    public void setIsPublished(boolean isPublished) {
-        this.isPublished = isPublished;
-    }
-
-    public boolean isIsProduced() {
-        return this.isProduced;
-    }
-
-    public void setIsProduced(boolean isProduced) {
-        this.isProduced = isProduced;
-    }
-
     public java.util.Date getWebdbCreate() {
         return this.webdbCreate;
     }
index 0ce3d19..ea175f8 100755 (executable)
         length="255"
     />
     <property
-        name="isPublished"
+        name="published"
         type="boolean"
         column="is_published"
         not-null="true"
         length="1"
     />
     <property
-        name="isProduced"
+        name="produced"
         type="boolean"
         column="is_produced"
         not-null="true"
index 4922f9c..e6cbf74 100755 (executable)
@@ -42,93 +42,16 @@ import org.apache.commons.lang.builder.ToStringBuilder;
  * 
  * Topic
  * @author idefix
- * @version $Id: Topic.java,v 1.2 2003/08/17 19:13:19 idfx Exp $
+ * @version $Id: Topic.java,v 1.3 2003/09/05 20:23:59 idfx Exp $
  */
-public class Topic implements Serializable {
-
-    /** identifier field */
-    private Integer id;
-
-    /** persistent field */
-    private String title;
-
-    /** nullable persistent field */
-    private String description;
-
-    /** persistent field */
-    private String filename;
-
-    /** nullable persistent field */
-    private String mainUrl;
-
-    /** nullable persistent field */
-    private String archivUrl;
-
-    /** nullable persistent field */
-    private mir.core.model.Topic parentTopic;
+public class Topic extends TopicStub implements Serializable {
     
     private Set content;
 
     /** default constructor */
     public Topic() {
+                       super();
     }
-
-    public java.lang.Integer getId() {
-        return this.id;
-    }
-
-    public void setId(java.lang.Integer id) {
-        this.id = id;
-    }
-
-    public java.lang.String getTitle() {
-        return this.title;
-    }
-
-    public void setTitle(java.lang.String title) {
-        this.title = title;
-    }
-
-    public java.lang.String getDescription() {
-        return this.description;
-    }
-
-    public void setDescription(java.lang.String description) {
-        this.description = description;
-    }
-
-    public java.lang.String getFilename() {
-        return this.filename;
-    }
-
-    public void setFilename(java.lang.String filename) {
-        this.filename = filename;
-    }
-
-    public java.lang.String getMainUrl() {
-        return this.mainUrl;
-    }
-
-    public void setMainUrl(java.lang.String mainUrl) {
-        this.mainUrl = mainUrl;
-    }
-
-    public java.lang.String getArchivUrl() {
-        return this.archivUrl;
-    }
-
-    public void setArchivUrl(java.lang.String archivUrl) {
-        this.archivUrl = archivUrl;
-    }
-
-    public mir.core.model.Topic getParentTopic() {
-        return this.parentTopic;
-    }
-
-    public void setParentTopic(mir.core.model.Topic parentTopic) {
-        this.parentTopic = parentTopic;
-    }
-
                /**
                 * @return
                 */
diff --git a/source/mir/core/model/TopicStub.java b/source/mir/core/model/TopicStub.java
new file mode 100755 (executable)
index 0000000..cc9c1c8
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+ * TopicStub.java created on 30.08.2003
+ * 
+ * Copyright (C) 2001, 2002, 2003 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.core.model;
+
+import java.io.Serializable;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ * TopicStub
+ * @author idefix
+ * @version $Id: TopicStub.java,v 1.1 2003/09/05 20:23:59 idfx Exp $
+ */
+public class TopicStub implements Serializable {
+       
+       /** identifier field */
+       private Integer id;
+
+       /** persistent field */
+       private String title;
+
+       /** nullable persistent field */
+       private String description;
+
+       /** persistent field */
+       private String filename;
+
+       /** nullable persistent field */
+       private String mainUrl;
+
+       /** nullable persistent field */
+       private String archivUrl;
+
+       /** nullable persistent field */
+       private mir.core.model.Topic parentTopic;
+
+       /**
+        * 
+        */
+       public TopicStub() {
+               super();
+       }
+
+       public java.lang.Integer getId() {
+                       return this.id;
+       }
+
+       public void setId(java.lang.Integer id) {
+                       this.id = id;
+       }
+
+       public java.lang.String getTitle() {
+                       return this.title;
+       }
+
+       public void setTitle(java.lang.String title) {
+                       this.title = title;
+       }
+
+       public java.lang.String getDescription() {
+                       return this.description;
+       }
+
+       public void setDescription(java.lang.String description) {
+                       this.description = description;
+       }
+
+       public java.lang.String getFilename() {
+                       return this.filename;
+       }
+
+       public void setFilename(java.lang.String filename) {
+                       this.filename = filename;
+       }
+
+       public java.lang.String getMainUrl() {
+                       return this.mainUrl;
+       }
+
+       public void setMainUrl(java.lang.String mainUrl) {
+                       this.mainUrl = mainUrl;
+       }
+
+       public java.lang.String getArchivUrl() {
+                       return this.archivUrl;
+       }
+
+       public void setArchivUrl(java.lang.String archivUrl) {
+                       this.archivUrl = archivUrl;
+       }
+
+       public mir.core.model.Topic getParentTopic() {
+                       return this.parentTopic;
+       }
+
+       public void setParentTopic(mir.core.model.Topic parentTopic) {
+                       this.parentTopic = parentTopic;
+       }
+
+       public String toString() {
+                       return new ToStringBuilder(this)
+                                       .append("id", getId())
+                                       .toString();
+       }
+
+       public boolean equals(Object other) {
+                       if ( !(other instanceof Topic) ) return false;
+                       Topic castOther = (Topic) other;
+                       return new EqualsBuilder()
+                                       .append(this.getId(), castOther.getId())
+                                       .isEquals();
+       }
+
+       public int hashCode() {
+                       return new HashCodeBuilder()
+                                       .append(getId())
+                                       .toHashCode();
+       }
+
+
+}
index 02c493b..7f3768a 100755 (executable)
         length="255"
     />
     <property
-        name="isPublished"
+        name="published"
         type="boolean"
         column="is_published"
         not-null="true"
         length="1"
     />
     <property
-        name="isProduced"
+        name="produced"
         type="boolean"
         column="is_produced"
         not-null="true"
index 2044e9f..ab7ee4e 100755 (executable)
         length="255"
     />
     <property
-        name="isPublished"
+        name="published"
         type="boolean"
         column="is_published"
         not-null="true"
         length="1"
     />
     <property
-        name="isProduced"
+        name="produced"
         type="boolean"
         column="is_produced"
         not-null="true"
index 22fd9db..283eff8 100755 (executable)
@@ -37,7 +37,7 @@ import net.sf.hibernate.SessionFactory;
 /**
  * ArticleTypeService
  * @author idefix
- * @version $Id: ArticleTypeService.java,v 1.1 2003/08/17 19:11:49 idfx Exp $
+ * @version $Id: ArticleTypeService.java,v 1.2 2003/09/05 20:23:59 idfx Exp $
  */
 public class ArticleTypeService extends StorageService {
 
@@ -49,4 +49,11 @@ public class ArticleTypeService extends StorageService {
                super(ArticleType.class, factory);
        }
 
+       /**
+        * @see mir.core.service.storage.StorageService#initializeLazyCollections(java.lang.Object)
+        */
+       protected void initializeLazyCollections(Object returnObject) {
+               // doonothing;
+       }
+
 }
index 5561b80..9fdd991 100755 (executable)
 package mir.core.service.storage;
 
 import mir.core.model.Audio;
+import net.sf.hibernate.Hibernate;
+import net.sf.hibernate.HibernateException;
 import net.sf.hibernate.SessionFactory;
 
 /**
  * AudioService
  * @author idefix
- * @version $Id: AudioService.java,v 1.1 2003/08/17 19:11:49 idfx Exp $
+ * @version $Id: AudioService.java,v 1.2 2003/09/05 20:23:59 idfx Exp $
  */
 public class AudioService extends StorageService {
 
@@ -49,4 +51,16 @@ public class AudioService extends StorageService {
                super(Audio.class, factory);
        }
 
+       /**
+        * @see mir.core.service.storage.StorageService#initializeLazyCollections(java.lang.Object)
+        */
+       protected void initializeLazyCollections(Object returnObject)
+               throws HibernateException {
+               if(returnObject instanceof Audio){
+                       Audio audio = (Audio)returnObject;
+                       Hibernate.initialize(audio.getContent());
+                       
+               }
+       }
+
 }
index ee83234..fddf759 100755 (executable)
 package mir.core.service.storage;
 
 import mir.core.model.BreakingNewsItem;
+import net.sf.hibernate.HibernateException;
 import net.sf.hibernate.SessionFactory;
 
 /**
  * BreakingService
  * @author idefix
- * @version $Id: BreakingService.java,v 1.1 2003/08/17 19:11:49 idfx Exp $
+ * @version $Id: BreakingService.java,v 1.2 2003/09/05 20:23:59 idfx Exp $
  */
 public class BreakingService extends StorageService {
 
@@ -49,4 +50,11 @@ public class BreakingService extends StorageService {
                super(BreakingNewsItem.class, factory);
        }
 
+       /**
+        * @see mir.core.service.storage.StorageService#initializeLazyCollections(java.lang.Object)
+        */
+       protected void initializeLazyCollections(Object returnObject) throws HibernateException {
+               //do nothing
+       }
+
 }
index 22344ad..780bc06 100755 (executable)
 package mir.core.service.storage;
 
 import mir.core.model.Comment;
+import net.sf.hibernate.Hibernate;
+import net.sf.hibernate.HibernateException;
 import net.sf.hibernate.SessionFactory;
 
 /**
  * CommentService
  * @author idefix
- * @version $Id: CommentService.java,v 1.1 2003/08/17 19:11:49 idfx Exp $
+ * @version $Id: CommentService.java,v 1.2 2003/09/05 20:23:59 idfx Exp $
  */
 public class CommentService extends StorageService {
 
@@ -49,4 +51,13 @@ public class CommentService extends StorageService {
                super(Comment.class, factory);
        }
 
+       /**
+        * @see mir.core.service.storage.StorageService#initializeLazyCollections(java.lang.Object)
+        */
+       protected void initializeLazyCollections(Object returnObject) throws HibernateException {
+               if(returnObject instanceof Comment){
+                       Comment comment = (Comment)returnObject;
+               }
+       }
+
 }
index dbd5810..d31e4ab 100755 (executable)
 package mir.core.service.storage;
 
 import mir.core.model.CommentStatus;
+import net.sf.hibernate.HibernateException;
 import net.sf.hibernate.SessionFactory;
 
 /**
  * CommentStatusService
  * @author idefix
- * @version $Id: CommentStatusService.java,v 1.1 2003/08/17 19:11:49 idfx Exp $
+ * @version $Id: CommentStatusService.java,v 1.2 2003/09/05 20:23:59 idfx Exp $
  */
 public class CommentStatusService extends StorageService {
 
@@ -49,4 +50,11 @@ public class CommentStatusService extends StorageService {
                super(CommentStatus.class, factory);
        }
 
+       /**
+        * @see mir.core.service.storage.StorageService#initializeLazyCollections(java.lang.Object)
+        */
+       protected void initializeLazyCollections(Object returnObject) throws HibernateException {
+               //do nothing
+       }
+
 }
index f199fba..cff8e7a 100755 (executable)
 package mir.core.service.storage;
 
 import mir.core.model.Content;
+import mir.core.model.IContent;
+import net.sf.hibernate.Hibernate;
+import net.sf.hibernate.HibernateException;
 import net.sf.hibernate.SessionFactory;
 
 /**
  * ContentService
  * @author idefix
- * @version $Id: ContentService.java,v 1.1 2003/08/17 19:11:49 idfx Exp $
+ * @version $Id: ContentService.java,v 1.2 2003/09/05 20:23:59 idfx Exp $
  */
 public class ContentService extends StorageService {
 
@@ -50,4 +53,17 @@ public class ContentService extends StorageService {
                super(Content.class, factory);
        }
 
+       /**
+        * @see mir.core.service.storage.StorageService#initializeLazyCollections(java.lang.Object)
+        */
+       protected void initializeLazyCollections(Object returnObject) throws HibernateException {
+               if(returnObject instanceof IContent){
+                       IContent content = (IContent)returnObject;
+                       Hibernate.initialize(content.getAttachedMedias());
+                       Hibernate.initialize(content.getChildContent());
+                       Hibernate.initialize(content.getContent());
+                       Hibernate.initialize(content.getTopics());
+               }
+       }
+
 }
index c510508..25d89d6 100755 (executable)
  */
 package mir.core.service.storage;
 
+import mir.core.model.IImage;
 import mir.core.model.Image;
+import net.sf.hibernate.Hibernate;
+import net.sf.hibernate.HibernateException;
 import net.sf.hibernate.SessionFactory;
 
 /**
  * ImageService
  * @author idefix
- * @version $Id: ImageService.java,v 1.1 2003/08/17 19:11:49 idfx Exp $
+ * @version $Id: ImageService.java,v 1.2 2003/09/05 20:23:59 idfx Exp $
  */
 public class ImageService extends StorageService {
 
@@ -49,4 +52,14 @@ public class ImageService extends StorageService {
                super(Image.class, factory);
        }
 
+       /**
+        * @see mir.core.service.storage.StorageService#initializeLazyCollections(java.lang.Object)
+        */
+       protected void initializeLazyCollections(Object returnObject) throws HibernateException {
+               if(returnObject instanceof IImage){
+                       IImage image = (IImage)returnObject;
+                       Hibernate.initialize(image.getContent());
+               }
+       }
+
 }
index febf0fd..a43067b 100755 (executable)
 package mir.core.service.storage;
 
 import mir.core.model.Language;
+import net.sf.hibernate.HibernateException;
 import net.sf.hibernate.SessionFactory;
 
 /**
  * LanguageService
  * @author idefix
- * @version $Id: LanguageService.java,v 1.1 2003/08/17 19:11:49 idfx Exp $
+ * @version $Id: LanguageService.java,v 1.2 2003/09/05 20:23:59 idfx Exp $
  */
 public class LanguageService extends StorageService {
 
@@ -49,4 +50,11 @@ public class LanguageService extends StorageService {
                super(Language.class, factory);
        }
 
+       /**
+        * @see mir.core.service.storage.StorageService#initializeLazyCollections(java.lang.Object)
+        */
+       protected void initializeLazyCollections(Object returnObject) throws HibernateException {
+               // do nothing
+       }
+
 }
index 2a650c0..a83b1d0 100755 (executable)
 package mir.core.service.storage;
 
 import mir.core.model.MediaFolder;
+import net.sf.hibernate.HibernateException;
 import net.sf.hibernate.SessionFactory;
 
 /**
  * MediaFolderService
  * @author idefix
- * @version $Id: MediaFolderService.java,v 1.1 2003/08/17 19:11:49 idfx Exp $
+ * @version $Id: MediaFolderService.java,v 1.2 2003/09/05 20:23:59 idfx Exp $
  */
 public class MediaFolderService extends StorageService {
 
@@ -49,4 +50,11 @@ public class MediaFolderService extends StorageService {
                super(MediaFolder.class, factory);
        }
 
+       /**
+        * @see mir.core.service.storage.StorageService#initializeLazyCollections(java.lang.Object)
+        */
+       protected void initializeLazyCollections(Object returnObject) throws HibernateException {
+               // do nothing
+       }
+
 }
index 471fba8..d84e767 100755 (executable)
 package mir.core.service.storage;
 
 import mir.core.model.Message;
+import net.sf.hibernate.HibernateException;
 import net.sf.hibernate.SessionFactory;
 
 /**
  * MessageService
  * @author idefix
- * @version $Id: MessageService.java,v 1.1 2003/08/17 19:11:49 idfx Exp $
+ * @version $Id: MessageService.java,v 1.2 2003/09/05 20:23:59 idfx Exp $
  */
 public class MessageService extends StorageService {
 
@@ -49,4 +50,11 @@ public class MessageService extends StorageService {
                super(Message.class, factory);
        }
 
+       /**
+        * @see mir.core.service.storage.StorageService#initializeLazyCollections(java.lang.Object)
+        */
+       protected void initializeLazyCollections(Object returnObject) throws HibernateException {
+               // do nothing           
+       }
+
 }
index 3660939..5379238 100755 (executable)
  */
 package mir.core.service.storage;
 
+import mir.core.model.IUploadedMedia;
 import mir.core.model.OtherMedia;
+import net.sf.hibernate.Hibernate;
+import net.sf.hibernate.HibernateException;
 import net.sf.hibernate.SessionFactory;
 
 /**
  * OtherMediaService
  * @author idefix
- * @version $Id: OtherMediaService.java,v 1.1 2003/08/17 19:11:49 idfx Exp $
+ * @version $Id: OtherMediaService.java,v 1.2 2003/09/05 20:23:59 idfx Exp $
  */
 public class OtherMediaService extends StorageService {
 
@@ -48,5 +51,15 @@ public class OtherMediaService extends StorageService {
        public OtherMediaService(SessionFactory factory) {
                super(OtherMedia.class, factory);
        }
+       
+       /**
+        * @see mir.core.service.storage.StorageService#initializeLazyCollections(java.lang.Object)
+        */
+       protected void initializeLazyCollections(Object returnObject) throws HibernateException {
+               if(returnObject instanceof IUploadedMedia){
+                       IUploadedMedia media = (IUploadedMedia)returnObject;
+                       Hibernate.initialize(media.getContent());
+               }
+       }
 
 }
index cab2696..675c911 100755 (executable)
@@ -38,7 +38,7 @@ import net.sf.hibernate.SessionFactory;
 /**
  * SessionHolder
  * @author idefix
- * @version $Id: SessionHolder.java,v 1.1 2003/08/19 00:42:38 idfx Exp $
+ * @version $Id: SessionHolder.java,v 1.2 2003/09/05 20:23:59 idfx Exp $
  */
 public class SessionHolder {
        private ThreadLocal threadLocalSession;
@@ -65,9 +65,10 @@ public class SessionHolder {
        
        public void closeSession() throws HibernateException {
                Session session = (Session) threadLocalSession.get();
-               threadLocalSession.set(null);
                if (session != null) {
+                       session.flush();
                        session.close();
                }
+               threadLocalSession.set(null);
        } 
 }
index fb81d7f..6a21d94 100755 (executable)
@@ -34,7 +34,9 @@ package mir.core.service.storage;
 
 import java.util.List;
 
+import mir.core.model.IImage;
 import net.sf.hibernate.Criteria;
+import net.sf.hibernate.Hibernate;
 import net.sf.hibernate.HibernateException;
 import net.sf.hibernate.Session;
 import net.sf.hibernate.SessionFactory;
@@ -45,7 +47,7 @@ import net.sf.hibernate.expression.Expression;
  * 
  * StorageService
  * @author idefix
- * @version $Id: StorageService.java,v 1.2 2003/08/19 00:42:38 idfx Exp $
+ * @version $Id: StorageService.java,v 1.3 2003/09/05 20:23:59 idfx Exp $
  */
 public abstract class StorageService {
        private Class objectClass;
@@ -73,6 +75,7 @@ public abstract class StorageService {
                                .setMaxResults(limit);
                        List returnList = criteria.list();
                        transaction.commit();
+                       sessionHolder.closeSession();
                        return returnList;
                } catch (HibernateException e) {
                        throw new StorageServiceFailure(e);
@@ -84,13 +87,21 @@ public abstract class StorageService {
                        Session session = sessionHolder.currentSession();
                        Transaction transaction = session.beginTransaction();
                        Object returnObject = session.load(objectClass, id);
+                       initializeLazyCollections(returnObject);
                        transaction.commit();
+                       sessionHolder.closeSession();
                        return returnObject;
                } catch (HibernateException e) {
                        throw new StorageServiceFailure(e);
                }       
        }
        
+       /**
+        * @param returnObject
+        */
+       protected abstract void initializeLazyCollections(Object returnObject) 
+               throws HibernateException;
+       
        public Integer add(Object newObject){
                try {
                        Session session = sessionHolder.currentSession();
index 86df935..caa4fe2 100755 (executable)
 package mir.core.service.storage;
 
 import mir.core.model.Topic;
+import net.sf.hibernate.Hibernate;
+import net.sf.hibernate.HibernateException;
 import net.sf.hibernate.SessionFactory;
 
 /**
  * TopicService
  * @author idefix
- * @version $Id: TopicService.java,v 1.1 2003/08/17 19:11:49 idfx Exp $
+ * @version $Id: TopicService.java,v 1.2 2003/09/05 20:23:59 idfx Exp $
  */
 public class TopicService extends StorageService {
 
@@ -49,4 +51,14 @@ public class TopicService extends StorageService {
                super(Topic.class, factory);
        }
 
+       /**
+        * @see mir.core.service.storage.StorageService#initializeLazyCollections(java.lang.Object)
+        */
+       protected void initializeLazyCollections(Object returnObject) throws HibernateException {
+               if(returnObject instanceof Topic){
+                       Topic topic = (Topic)returnObject;
+                       Hibernate.initialize(topic.getContent());
+               }
+       }
+
 }
index 18735f9..7193967 100755 (executable)
  */
 package mir.core.service.storage;
 
+import mir.core.model.IUploadedMedia;
 import mir.core.model.UploadedMedia;
+import net.sf.hibernate.Hibernate;
+import net.sf.hibernate.HibernateException;
 import net.sf.hibernate.SessionFactory;
 
 /**
  * UploadedMediaService
  * @author idefix
- * @version $Id: UploadedMediaService.java,v 1.1 2003/08/17 19:11:49 idfx Exp $
+ * @version $Id: UploadedMediaService.java,v 1.2 2003/09/05 20:23:59 idfx Exp $
  */
 public class UploadedMediaService extends StorageService {
 
@@ -49,4 +52,14 @@ public class UploadedMediaService extends StorageService {
                super(UploadedMedia.class, factory);
        }
 
+       /**
+        * @see mir.core.service.storage.StorageService#initializeLazyCollections(java.lang.Object)
+        */
+       protected void initializeLazyCollections(Object returnObject) throws HibernateException {
+               if(returnObject instanceof IUploadedMedia){
+                       IUploadedMedia media = (IUploadedMedia)returnObject;
+                       Hibernate.initialize(media.getContent());
+               }
+       }
+
 }
index 08bcf53..51f4386 100755 (executable)
@@ -35,13 +35,14 @@ package mir.core.service.storage;
 import java.util.List;
 
 import mir.core.model.MirUser;
+import net.sf.hibernate.HibernateException;
 import net.sf.hibernate.SessionFactory;
 import net.sf.hibernate.expression.Expression;
 
 /**
  * UserService
  * @author idefix
- * @version $Id: UserService.java,v 1.1 2003/08/17 19:11:49 idfx Exp $
+ * @version $Id: UserService.java,v 1.2 2003/09/05 20:23:59 idfx Exp $
  */
 public class UserService extends StorageService {
 
@@ -66,4 +67,11 @@ public class UserService extends StorageService {
                return (MirUser)list.get(0);
        }
 
+       /**
+        * @see mir.core.service.storage.StorageService#initializeLazyCollections(java.lang.Object)
+        */
+       protected void initializeLazyCollections(Object returnObject) throws HibernateException {               
+               //do nothing
+       }
+
 }
index 5feaa25..822586e 100755 (executable)
 package mir.core.service.storage;
 
 import mir.core.model.Video;
+import net.sf.hibernate.Hibernate;
+import net.sf.hibernate.HibernateException;
 import net.sf.hibernate.SessionFactory;
 
 /**
  * VideoService
  * @author idefix
- * @version $Id: VideoService.java,v 1.1 2003/08/17 19:11:49 idfx Exp $
+ * @version $Id: VideoService.java,v 1.2 2003/09/05 20:23:59 idfx Exp $
  */
 public class VideoService extends StorageService {
 
@@ -49,4 +51,14 @@ public class VideoService extends StorageService {
                super(Video.class, factory);
        }
 
+       /**
+        * @see mir.core.service.storage.StorageService#initializeLazyCollections(java.lang.Object)
+        */
+       protected void initializeLazyCollections(Object returnObject) throws HibernateException {
+               if(returnObject instanceof Video){
+                       Video video = (Video)returnObject;
+                       Hibernate.initialize(video.getContent());
+               }       
+       }
+
 }
index 59b247b..f94670d 100755 (executable)
@@ -56,7 +56,7 @@ import net.sf.hibernate.cfg.Configuration;
 
 /**
  * Test
- * @version $Id: Test.java,v 1.5 2003/08/19 00:43:02 idfx Exp $
+ * @version $Id: Test.java,v 1.6 2003/09/05 20:23:59 idfx Exp $
  * @author idefix
  */
 public class Test {
@@ -107,12 +107,12 @@ public class Test {
                        transaction.commit();
                        session.close();
                        ImageService imageService = new ImageService(factory);
-                       list = imageService.list(0,10);
+                       //list = imageService.list(0,10);
                        System.out.println("****** image media");
-                       for(Iterator iterator = list.iterator(); iterator.hasNext();){
-                               Image media = (Image)iterator.next();
-                               System.out.println(media.toString() + media.getIconPath());
-                       }
+                       //for(Iterator iterator = list.iterator(); iterator.hasNext();){
+                       //      Image media = (Image)iterator.next();
+                       //      System.out.println(media.toString() + media.getIconPath());
+                       //}
                        IImage image = (IImage)imageService.load(new Integer(18));
                        System.out.println(image);
                        session = factory.openSession();
diff --git a/source/mir/core/ui/action/AuthenticationAction.java b/source/mir/core/ui/action/AuthenticationAction.java
new file mode 100755 (executable)
index 0000000..7a1bb2f
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * AuthenticationAction.java created on 05.09.2003
+ * 
+ * Copyright (C) 2001, 2002, 2003 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.core.ui.action;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts.action.Action;
+import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
+import org.apache.struts.action.ActionMapping;
+
+/**
+ * AuthenticationAction
+ * @author idefix
+ * @version $Id: AuthenticationAction.java,v 1.1 2003/09/05 20:23:59 idfx Exp $
+ */
+public class AuthenticationAction extends Action {
+
+       
+       /**
+        * @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+        */
+       public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, 
+               HttpServletRequest request, HttpServletResponse response)
+               throws Exception {
+               // TODO Auto-generated method stub
+               return actionMapping.findForward("success");
+       }
+
+}
diff --git a/source/mir/core/ui/filter/AuthenticationFilter.java b/source/mir/core/ui/filter/AuthenticationFilter.java
new file mode 100755 (executable)
index 0000000..f83eea5
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * AuthenticationFilter.java created on 04.09.2003
+ * 
+ * Copyright (C) 2001, 2002, 2003 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.core.ui.filter;
+
+import java.io.IOException;
+
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import mir.core.model.MirUser;
+import mir.core.ui.servlet.*;
+
+/**
+ * AuthenticationFilter
+ * @author idefix
+ * @version $Id: AuthenticationFilter.java,v 1.1 2003/09/05 20:23:59 idfx Exp $
+ */
+public class AuthenticationFilter implements Filter {
+       private FilterConfig _filterConfig;
+       /**
+        * 
+        */
+       public AuthenticationFilter() {
+               super();
+       }
+
+       /**
+        * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
+        */
+       public void init(final FilterConfig filterConfig) throws ServletException {
+               _filterConfig = filterConfig;
+       }
+
+       /**
+        * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain)
+        */
+       public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
+               throws IOException, ServletException {
+               HttpServletRequest request = (HttpServletRequest)servletRequest;        
+               String requestUri = request.getRequestURI();
+               System.out.println(requestUri);
+               System.out.println(request.getContextPath());
+               if(requestUri != null && requestUri.startsWith(request.getContextPath() + "/admin")){
+                       //check if authenticated, only if in admin-module
+                       HttpSession httpSession = request.getSession();
+                       MirUser mirUser = (MirUser)httpSession.getAttribute(ServletConstants.USER);
+                       if(mirUser == null){
+                               servletRequest.getRequestDispatcher("/admin/login.shtml").forward(servletRequest, servletResponse);
+                       }
+               }
+               filterChain.doFilter(servletRequest, servletResponse);
+       }
+
+       /**
+        * @see javax.servlet.Filter#destroy()
+        */
+       public void destroy() {
+       }
+
+}
diff --git a/source/mir/core/ui/plugin/HibernatePlugin.java b/source/mir/core/ui/plugin/HibernatePlugin.java
new file mode 100755 (executable)
index 0000000..8007d28
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * HibernatePlugin.java
+ * 
+ * Copyright (C) 2001, 2002, 2003 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.core.ui.plugin;
+
+import javax.servlet.ServletException;
+
+import mir.core.ui.servlet.ServletConstants;
+import net.sf.hibernate.HibernateException;
+import net.sf.hibernate.SessionFactory;
+import net.sf.hibernate.cfg.Configuration;
+
+import org.apache.struts.action.ActionServlet;
+import org.apache.struts.action.PlugIn;
+import org.apache.struts.config.ModuleConfig;
+
+/**
+ * HibernatePlugin
+ * @version $Id: HibernatePlugin.java,v 1.1 2003/09/05 20:23:59 idfx Exp $
+ * @author idefix
+ */
+public class HibernatePlugin implements PlugIn {
+
+       /**
+        * @see org.apache.struts.action.PlugIn#destroy()
+        */
+       public void destroy() {
+       }
+
+       /**
+        * @see org.apache.struts.action.PlugIn#init(org.apache.struts.action.ActionServlet, org.apache.struts.config.ModuleConfig)
+        */
+       public void init(ActionServlet actionServlet, ModuleConfig config)
+               throws ServletException {
+                       try {
+                               SessionFactory factory = 
+                                       new Configuration().configure().buildSessionFactory();
+                               actionServlet.getServletContext()
+                                       .setAttribute(ServletConstants.SESSION_FACTORY, factory);
+                       } catch (HibernateException e) {
+                               throw new ServletException(e);
+                       }
+       }
+
+}
diff --git a/source/mir/core/ui/servlet/ServletConstants.java b/source/mir/core/ui/servlet/ServletConstants.java
new file mode 100755 (executable)
index 0000000..215f5c3
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * ServletConstants.java created on 05.09.2003
+ * 
+ * Copyright (C) 2001, 2002, 2003 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.core.ui.servlet;
+
+/**
+ * ServletConstants<br>
+ * Some constant string values needed as keys to store values in the servlet context.
+ * @author idefix
+ * @version $Id: ServletConstants.java,v 1.1 2003/09/05 20:23:59 idfx Exp $
+ */
+public interface ServletConstants {
+       public static final String SESSION_FACTORY = "session factory";
+
+       public static final String USER = "user";
+
+}
diff --git a/source/mir/core/ui/servlet/TemplateServlet.java b/source/mir/core/ui/servlet/TemplateServlet.java
new file mode 100755 (executable)
index 0000000..06711cc
--- /dev/null
@@ -0,0 +1,181 @@
+/*
+ * TemplateServlet.java created on 01.09.2003
+ * 
+ * Copyright (C) 2001, 2002, 2003 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.core.ui.servlet;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import mir.config.MirPropertiesConfiguration;
+import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;
+import mir.servlet.ServletModuleExc;
+import mir.util.ResourceBundleGeneratorFunction;
+import mircoders.servlet.ServletHelper;
+
+import org.apache.struts.util.MessageResources;
+
+/**
+ * TemplateServlet
+ * @author idefix
+ * @version $Id: TemplateServlet.java,v 1.1 2003/09/05 20:23:59 idfx Exp $
+ */
+public class TemplateServlet extends HttpServlet {
+
+       /**
+        * 
+        */
+       public TemplateServlet() {
+               super();
+       }
+       
+       /**
+        * @see javax.servlet.http.HttpServlet#doGet(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+        */
+       protected final void doGet(HttpServletRequest request, HttpServletResponse response) 
+       throws ServletException, IOException {
+               process(request, response);
+       }
+
+       /**
+        * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
+        */
+       protected final void doPost(HttpServletRequest request, HttpServletResponse response) 
+               throws ServletException, IOException {
+               process(request, response);
+       }
+       
+       /**
+        * Processes the request and invokes the presentation
+        * @param request
+        * @param response
+        */
+       protected void process(HttpServletRequest request, HttpServletResponse response) 
+               throws IOException, ServletException {
+               PrintWriter printWriter = response.getWriter();
+               Map requestData = new HashMap();
+               Enumeration keys = request.getAttributeNames();
+               while(keys.hasMoreElements()){
+                       final String key = (String)keys.nextElement();
+                       requestData.put(key, request.getAttribute(key));
+               }
+               Map sessionData = new HashMap();
+               HttpSession httpSession = request.getSession();
+               keys = httpSession.getAttributeNames();
+               while(keys.hasMoreElements()){
+                       final String key = (String)keys.nextElement();
+                       sessionData.put(key, httpSession.getAttribute(key));
+               }
+               Map applicationData = new HashMap();
+               ServletContext servletContext = getServletContext();
+               keys = servletContext.getAttributeNames();
+               while(keys.hasMoreElements()){
+                       final String key = (String)keys.nextElement();
+                       applicationData.put(key, servletContext.getAttribute(key));
+               }               
+               Map templateData = new HashMap();
+               templateData.put("request", requestData);
+               templateData.put("session", sessionData);
+               templateData.put("application", applicationData);
+               try {
+                       templateData.put("config", MirPropertiesConfiguration.instance().allSettings());
+               } catch (PropertiesConfigExc e) {
+                       throw new ServletException(e);
+               }
+               
+               String templateName = generateTemplateString(request);
+               
+               Locale[] locales = new Locale[2];
+               locales[0] = request.getLocale();
+               locales[1] = request.getLocale();
+               
+               try {
+                       //write the servlet
+                       generateResponse(printWriter, templateData, templateName, locales);
+               } catch (ServletModuleExc e) {
+                       throw new ServletException(e);
+               }
+       }
+       
+       private String generateTemplateString(HttpServletRequest request){
+               String returnString = request.getServletPath();
+               returnString = returnString.substring(0, returnString.indexOf("."));
+               return returnString + ".template";
+       }
+       
+       private void generateResponse(PrintWriter printWriter, Map map, 
+               String templateString, Locale[] locales) 
+               throws ServletModuleExc{
+               if(templateString.startsWith("/admin")){
+                       map.put( "lang",
+                                       new ResourceBundleGeneratorFunction( locales,
+                                                new MessageResources[] { MessageResources.getMessageResources("bundles.admin"),
+                                                               MessageResources.getMessageResources("bundles.adminlocal")}));
+                                                               
+                       templateString = templateString.substring(6);
+                       ServletHelper.generateResponse(printWriter, map, templateString);       
+               }
+               if(templateString.startsWith("/open")){
+                       map.put( "lang",
+                                       new ResourceBundleGeneratorFunction( locales,
+                                                new MessageResources[] { MessageResources.getMessageResources("bundles.open"),
+                                                               MessageResources.getMessageResources("bundles.open")}));
+                                                               
+                       templateString = templateString.substring(5);
+                       ServletHelper.generateOpenPostingResponse(printWriter, map, templateString);    
+               }               
+       }
+
+       /**
+        * @see javax.servlet.Servlet#destroy()
+        */
+       public void destroy() {
+               super.destroy();
+       }
+
+       /**
+        * @see javax.servlet.Servlet#init(javax.servlet.ServletConfig)
+        */
+       public void init(ServletConfig servletConfig) throws ServletException {
+               super.init(servletConfig);
+       }
+}