-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two. You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries. If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so. If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+
import java.io.IOException;
import java.io.PrintWriter;
import java.lang.reflect.Method;
import java.util.Locale;
import java.util.Map;
import java.util.Vector;
+
import javax.servlet.ServletException;
import javax.servlet.UnavailableException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import org.apache.struts.util.MessageResources;
-import freemarker.template.SimpleHash;
-import freemarker.template.SimpleList;
-import freemarker.template.SimpleScalar;
-import freemarker.template.TemplateModel;
-
import mir.config.MirPropertiesConfiguration;
import mir.entity.adapter.EntityIteratorAdapter;
import mir.generator.FreemarkerGenerator;
import mircoders.module.ModuleMessage;
import mircoders.module.ModuleUsers;
import mircoders.servlet.ServletHelper;
-import mircoders.storage.DatabaseUsers;\r
-\r
-\r
-\r
-\r
-/**\r
- * Mir.java - main servlet, that dispatches to servletmodules\r
- *\r
- * @author $Author: zapata $\r
- * @version $Id: Mir.java,v 1.44 2003/04/21 02:58:29 zapata Exp $\r
- *\r
- */\r
-public class Mir extends AbstractServlet {\r
- private static ModuleUsers usersModule = null;\r
- private static ModuleMessage messageModule = null;\r
- private final static Map servletModuleInstanceHash = new HashMap();\r
- private static Locale fallbackLocale = null;\r
-\r
- //I don't know about making this static cause it removes the\r
- //possibility to change the config on the fly.. -mh\r
- private static List loginLanguages = null;\r
-\r
- protected TemplateModel getLoginLanguages() throws ServletException {\r
- synchronized (Mir.class) {\r
- try {\r
- if (loginLanguages == null) {\r
- MessageResources messageResources =\r
- MessageResources.getMessageResources("bundles.adminlocal");\r
- MessageResources messageResources2 =\r
- MessageResources.getMessageResources("bundles.admin");\r
-\r
- List languages =\r
- StringRoutines.splitString(MirGlobal.config().getString("Mir.Login.Languages", "en"), ";");\r
-\r
- loginLanguages = new Vector();\r
-\r
- Iterator i = languages.iterator();\r
-\r
- while (i.hasNext()) {\r
- String code = (String) i.next();\r
- Locale locale = new Locale(code, "");\r
- String name = messageResources.getMessage(locale, "languagename");\r
-\r
- if (name == null) {\r
- name = messageResources2.getMessage(locale, "languagename");\r
- }\r
-\r
- if (name == null) {\r
- name = code;\r
- }\r
-\r
- Map record = new HashMap();\r
- record.put("name", name);\r
- record.put("code", code);\r
- loginLanguages.add(record);\r
- }\r
- }\r
-\r
- return FreemarkerGenerator.makeAdapter(loginLanguages);\r
- }\r
- catch (Throwable t) {\r
- throw new ServletException(t.getMessage());\r
- }\r
- }\r
- }\r
-\r
- // FIXME: this should probalby go into AbstractServlet so it can be used in\r
- // OpenMir as well -mh\r
- protected String getDefaultLanguage(HttpServletRequest aRequest) {\r
- String defaultlanguage =\r
- MirGlobal.config().getString("Mir.Login.DefaultLanguage", "");\r
-\r
- if (defaultlanguage.length() == 0) {\r
- Locale locale = aRequest.getLocale();\r
- defaultlanguage = locale.getLanguage();\r
- }\r
-\r
- return defaultlanguage;\r
- }\r
-\r
- protected synchronized Locale getFallbackLocale() throws ServletException {\r
- try {\r
- if (fallbackLocale == null) {\r
- fallbackLocale = new Locale(MirPropertiesConfiguration.instance().getString("Mir.Admin.FallbackLanguage", "en"), "");\r
- }\r
- }\r
- catch (Throwable t) {\r
- throw new ServletException(t.getMessage());\r
- }\r
-\r
- return fallbackLocale;\r
- }\r
-\r
- public void process(HttpServletRequest aRequest, HttpServletResponse aResponse)\r
- throws ServletException, IOException, UnavailableException {\r
- long startTime = System.currentTimeMillis();\r
- long sessionConnectTime = 0;\r
- EntityUsers userEntity;\r
- HttpSession session;\r
- String http = "";\r
-\r
- configuration.addProperty("ServletName", getServletName());\r
-\r
- session = aRequest.getSession(true);\r
- userEntity = (EntityUsers) session.getAttribute("login.uid");\r
-\r
- if (aRequest.getServerPort() == 443) {\r
- http = "https";\r
- } else {\r
- http = "http";\r
- }\r
-\r
- //make sure client browsers don't cache anything\r
- setNoCaching(aResponse);\r
-\r
- //FIXME: this seems kind of hackish and only here because we can have\r
- // default other than the one that the browser is set to.\r
- Locale locale = new Locale(getDefaultLanguage(aRequest), "");\r
- String htmlcharset = "UTF-8";\r
- try {\r
- htmlcharset = MirPropertiesConfiguration.instance().getString("Mir.DefaultHTMLCharset");\r
- }\r
- catch (Throwable t) {\r
- }\r
-\r
- aResponse.setContentType("text/html; charset=" + htmlcharset);\r
-\r
- String moduleName = aRequest.getParameter("module");\r
- checkLanguage(session, aRequest);\r
-\r
-\r
-\r
- // Authentication\r
- if (((moduleName != null) && moduleName.equals("login")) ||\r
- (userEntity == null)) {\r
- String user = aRequest.getParameter("login");\r
- String passwd = aRequest.getParameter("password");\r
- logger.debug("--login: evaluating for user: " + user);\r
- userEntity = allowedUser(user, passwd);\r
-\r
- if (userEntity == null) {\r
- // login failed: redirecting to login\r
- logger.warn("--login: failed!");\r
- _sendLoginPage(aResponse, aRequest, aResponse.getWriter());\r
-\r
- return;\r
- }\r
- else if ((moduleName != null) && moduleName.equals("login")) {\r
- // login successful\r
- logger.info("--login: successful! setting uid: " + userEntity.getId());\r
- session.setAttribute("login.uid", userEntity);\r
- logger.debug("--login: trying to retrieve login.target");\r
-\r
- String target = (String) session.getAttribute("login.target");\r
-\r
- if (target != null) {\r
- logger.debug("Redirect: " + target);\r
-\r
- int serverPort = aRequest.getServerPort();\r
- String redirect = "";\r
- String redirectString = "";\r
-\r
- if (serverPort == 80) {\r
- redirect =\r
- aResponse.encodeURL(http + "://" + aRequest.getServerName() + target);\r
- redirectString =\r
- "<html><head><meta http-equiv=refresh content=\"1;URL=" +\r
- redirect + "\"></head><body>going <a href=\"" + redirect +\r
- "\">Mir</a></body></html>";\r
- } else {\r
- redirect =\r
- aResponse.encodeURL(http + "://" + aRequest.getServerName() + ":" +\r
- aRequest.getServerPort() + target);\r
- redirectString =\r
- "<html><head><meta http-equiv=refresh content=\"1;URL=" +\r
- redirect + "\"></head><body>going <a href=\"" + redirect +\r
- "\">Mir</a></body></html>";\r
- }\r
-\r
- aResponse.getWriter().println(redirectString);\r
-\r
- //aResponse.sendRedirect(redirect);\r
- } else {\r
- // redirecting to default target\r
- logger.debug("--login: no target - redirecting to default");\r
- _sendStartPage(aResponse, aRequest, aResponse.getWriter(), userEntity);\r
- }\r
-\r
- return;\r
- }\r
- // if login succesful\r
- }\r
- // if login\r
-\r
- if ((moduleName != null) && moduleName.equals("logout")) {\r
- logger.info("--logout");\r
- session.invalidate();\r
-\r
- //session = aRequest.getSession(true);\r
- //checkLanguage(session, aRequest);\r
- _sendLoginPage(aResponse, aRequest, aResponse.getWriter());\r
-\r
- return;\r
- }\r
-\r
- // Check if authed!\r
- if (userEntity == null) {\r
- // redirect to loginpage\r
- String redirectString = aRequest.getRequestURI();\r
- String queryString = aRequest.getQueryString();\r
-\r
- if ((queryString != null) && !queryString.equals("")) {\r
- redirectString += ("?" + aRequest.getQueryString());\r
- logger.debug("STORING: " + redirectString);\r
- session.setAttribute("login.target", redirectString);\r
- }\r
-\r
- _sendLoginPage(aResponse, aRequest, aResponse.getWriter());\r
-\r
- return;\r
- }\r
-\r
- // If no module is specified goto standard startpage\r
- if ((moduleName == null) || moduleName.equals("")) {\r
- logger.debug("no module: redirect to standardpage");\r
- _sendStartPage(aResponse, aRequest, aResponse.getWriter(), userEntity);\r
-\r
- return;\r
- }\r
-\r
- // end of auth\r
- // From now on regular dispatching...\r
- try {\r
- // get servletmodule by parameter and continue with dispacher\r
- ServletModule smod = getServletModuleForName(moduleName);\r
- ServletModuleDispatch.dispatch(smod, aRequest, aResponse);\r
- }\r
- catch (Throwable e) {\r
- Throwable cause = ExceptionFunctions.traceCauseException(e);\r
-\r
- if (cause instanceof ServletModuleUserExc)\r
- handleUserError(aRequest, aResponse, aResponse.getWriter(), (ServletModuleUserExc) cause);\r
- else\r
- handleError(aRequest, aResponse, aResponse.getWriter(), cause);\r
-\r
- }\r
-\r
- // timing...\r
- sessionConnectTime = System.currentTimeMillis() - startTime;\r
- logger.info("EXECTIME (" + moduleName + "): " + sessionConnectTime + " ms");\r
- }\r
-\r
- /**\r
- * Private method getServletModuleForName returns ServletModule\r
- * from Cache\r
- *\r
- * @param moduleName\r
- * @return ServletModule\r
- *\r
- */\r
- private static ServletModule getServletModuleForName(String moduleName) throws ServletModuleExc {\r
- // Instance in Map ?\r
- if (!servletModuleInstanceHash.containsKey(moduleName)) {\r
- // was not found in hash...\r
- try {\r
- Class theServletModuleClass = null;\r
-\r
- try {\r
- // first we try to get ServletModule from stern.che3.servlet\r
- theServletModuleClass =\r
- Class.forName("mircoders.servlet.ServletModule" + moduleName);\r
- } catch (ClassNotFoundException e) {\r
- // on failure, we try to get it from lib-layer\r
- theServletModuleClass =\r
- Class.forName("mir.servlet.ServletModule" + moduleName);\r
- }\r
-\r
- Method m = theServletModuleClass.getMethod("getInstance", null);\r
- ServletModule smod = (ServletModule) m.invoke(null, null);\r
-\r
- // we put it into map for further reference\r
- servletModuleInstanceHash.put(moduleName, smod);\r
-\r
- return smod;\r
- }\r
- catch (Exception e) {\r
- throw new ServletModuleExc("*** error resolving classname for " + moduleName + " -- " + e.getMessage());\r
- }\r
- }\r
- else {\r
- return (ServletModule) servletModuleInstanceHash.get(moduleName);\r
- }\r
- }\r
-\r
- private void handleUserError(HttpServletRequest aRequest, HttpServletResponse aResponse,\r
- PrintWriter out, ServletModuleUserExc anException) {\r
- try {\r
- logger.info("user error: " + anException.getMessage());\r
- SimpleHash modelRoot = new SimpleHash();\r
- MessageResources messages = MessageResources.getMessageResources("bundles.admin");\r
- modelRoot.put("errorstring",\r
- new SimpleScalar(\r
- messages.getMessage(getLocale(aRequest), anException.getMessage(), anException.getParameters())\r
- ));\r
- modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime(new GregorianCalendar())));\r
- HTMLTemplateProcessor.process(\r
- aResponse,\r
- MirPropertiesConfiguration.instance().getString("Mir.UserErrorTemplate"),\r
- modelRoot,\r
- null,\r
- out,\r
- getLocale(aRequest),\r
- fallbackLocale);\r
- out.close();\r
- }\r
- catch (Exception e) {\r
- logger.error("Error in UserErrorTemplate");\r
- }\r
-\r
- }\r
-\r
- private void handleError(HttpServletRequest aRequest, HttpServletResponse aResponse,PrintWriter out, Throwable anException) {\r
-\r
- try {\r
- logger.error("error: " + anException);\r
- SimpleHash modelRoot = new SimpleHash();\r
- modelRoot.put("errorstring", new SimpleScalar(anException.getMessage()));\r
- modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime(\r
- new GregorianCalendar())));\r
- HTMLTemplateProcessor.process(\r
- aResponse,MirPropertiesConfiguration.instance().getString("Mir.ErrorTemplate"),\r
- modelRoot,null,out, getLocale(aRequest), getFallbackLocale());\r
- out.close();\r
- }\r
- catch (Exception e) {\r
- logger.error("Error in ErrorTemplate");\r
- }\r
- }\r
-\r
- /**\r
- * evaluate login for user / password\r
- */\r
- protected EntityUsers allowedUser(String user, String password) {\r
- try {\r
- if (usersModule == null) {\r
- usersModule = new ModuleUsers(DatabaseUsers.getInstance());\r
- }\r
-\r
- return usersModule.getUserForLogin(user, password);\r
- }\r
- catch (Exception e) {\r
- logger.debug(e.getMessage());\r
- e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));\r
-\r
- return null;\r
- }\r
- }\r
-\r
- // Redirect-methods\r
- private void _sendLoginPage(HttpServletResponse aResponse, HttpServletRequest aRequest,\r
- PrintWriter out) {\r
- String loginTemplate = configuration.getString("Mir.LoginTemplate");\r
- String sessionUrl = aResponse.encodeURL("");\r
-\r
- try {\r
- SimpleHash mergeData = new SimpleHash();\r
- SimpleList languages = new SimpleList();\r
-\r
- mergeData.put("session", sessionUrl);\r
-\r
- mergeData.put("defaultlanguage", getDefaultLanguage(aRequest));\r
- mergeData.put("languages", getLoginLanguages());\r
-\r
- HTMLTemplateProcessor.process(aResponse, loginTemplate, mergeData, null, out, getLocale(aRequest), getFallbackLocale());\r
- }\r
- catch (Throwable e) {\r
- handleError(aRequest, aResponse, out, e);\r
- }\r
- }\r
-\r
- private void _sendStartPage(HttpServletResponse aResponse, HttpServletRequest aRequest,\r
- PrintWriter out, EntityUsers userEntity) {\r
- String startTemplate = configuration.getString("Mir.StartTemplate");\r
- String sessionUrl = aResponse.encodeURL("");\r
-\r
- try {\r
- Map mergeData = ServletHelper.makeGenerationData(new Locale[] {getLocale(aRequest), getFallbackLocale()}, "bundles.admin", "bundles.adminlocal");\r
- mergeData.put("messages",\r
- new CachingRewindableIterator(\r
- new EntityIteratorAdapter( "", "webdb_create desc", 10,\r
- MirGlobal.localizer().dataModel().adapterModel(), "internalMessage", 10, 0)));\r
- mergeData.put("searchvalue", null);\r
- mergeData.put("searchfield", null);\r
- mergeData.put("searchispublished", null);\r
- mergeData.put("searcharticletype", null);\r
- mergeData.put("searchorder", null);\r
- mergeData.put("selectarticleurl", null);\r
-\r
- ServletHelper.generateResponse(aResponse.getWriter(), mergeData, startTemplate);\r
- }\r
- catch (Exception e) {\r
- e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));\r
- handleError(aRequest, aResponse, out, e);\r
- }\r
- }\r
-\r
- public String getServletInfo() {\r
- return "Mir " + configuration.getString("Mir.Version");\r
- }\r
-\r
- private void checkLanguage(HttpSession session, HttpServletRequest aRequest) {\r
- // a lang parameter always sets the language\r
- String lang = aRequest.getParameter("language");\r
-\r
- if (lang != null) {\r
- logger.info("selected language " + lang + " overrides accept-language");\r
- setLanguage(session, lang);\r
- }\r
- // otherwise store language from accept header in session\r
- else if (session.getAttribute("language") == null) {\r
- logger.info("accept-language is " + aRequest.getLocale().getLanguage());\r
- setLanguage(session, aRequest.getLocale().getLanguage());\r
- }\r
- }\r
-}\r
+import mircoders.storage.DatabaseUsers;
+
+import org.apache.struts.util.MessageResources;
+
+import freemarker.template.SimpleHash;
+import freemarker.template.SimpleList;
+import freemarker.template.SimpleScalar;
+import freemarker.template.TemplateModel;
+
+
+
+
+/**
+ * Mir.java - main servlet, that dispatches to servletmodules
+ *
+ * @author $Author: idfx $
+ * @version $Id: Mir.java,v 1.45 2003/04/21 12:42:46 idfx Exp $
+ *
+ */
+public class Mir extends AbstractServlet {
+ private static ModuleUsers usersModule = null;
+ private static ModuleMessage messageModule = null;
+ private final static Map servletModuleInstanceHash = new HashMap();
+ private static Locale fallbackLocale = null;
+
+ //I don't know about making this static cause it removes the
+ //possibility to change the config on the fly.. -mh
+ private static List loginLanguages = null;
+
+ protected TemplateModel getLoginLanguages() throws ServletException {
+ synchronized (Mir.class) {
+ try {
+ if (loginLanguages == null) {
+ MessageResources messageResources =
+ MessageResources.getMessageResources("bundles.adminlocal");
+ MessageResources messageResources2 =
+ MessageResources.getMessageResources("bundles.admin");
+
+ List languages =
+ StringRoutines.splitString(MirGlobal.config().getString("Mir.Login.Languages", "en"), ";");
+
+ loginLanguages = new Vector();
+
+ Iterator i = languages.iterator();
+
+ while (i.hasNext()) {
+ String code = (String) i.next();
+ Locale locale = new Locale(code, "");
+ String name = messageResources.getMessage(locale, "languagename");
+
+ if (name == null) {
+ name = messageResources2.getMessage(locale, "languagename");
+ }
+
+ if (name == null) {
+ name = code;
+ }
+
+ Map record = new HashMap();
+ record.put("name", name);
+ record.put("code", code);
+ loginLanguages.add(record);
+ }
+ }
+
+ return FreemarkerGenerator.makeAdapter(loginLanguages);
+ }
+ catch (Throwable t) {
+ throw new ServletException(t.getMessage());
+ }
+ }
+ }
+
+ // FIXME: this should probalby go into AbstractServlet so it can be used in
+ // OpenMir as well -mh
+ protected String getDefaultLanguage(HttpServletRequest aRequest) {
+ String defaultlanguage =
+ MirGlobal.config().getString("Mir.Login.DefaultLanguage", "");
+
+ if (defaultlanguage.length() == 0) {
+ Locale locale = aRequest.getLocale();
+ defaultlanguage = locale.getLanguage();
+ }
+
+ return defaultlanguage;
+ }
+
+ protected synchronized Locale getFallbackLocale() throws ServletException {
+ try {
+ if (fallbackLocale == null) {
+ fallbackLocale = new Locale(MirPropertiesConfiguration.instance().getString("Mir.Admin.FallbackLanguage", "en"), "");
+ }
+ }
+ catch (Throwable t) {
+ throw new ServletException(t.getMessage());
+ }
+
+ return fallbackLocale;
+ }
+
+ public void process(HttpServletRequest aRequest, HttpServletResponse aResponse)
+ throws ServletException, IOException, UnavailableException {
+ long startTime = System.currentTimeMillis();
+ long sessionConnectTime = 0;
+ EntityUsers userEntity;
+ HttpSession session;
+ String http = "";
+
+ configuration.addProperty("ServletName", getServletName());
+
+ session = aRequest.getSession(true);
+ userEntity = (EntityUsers) session.getAttribute("login.uid");
+
+ if (aRequest.getServerPort() == 443) {
+ http = "https";
+ } else {
+ http = "http";
+ }
+
+ //make sure client browsers don't cache anything
+ setNoCaching(aResponse);
+
+ //FIXME: this seems kind of hackish and only here because we can have
+ // default other than the one that the browser is set to.
+ Locale locale = new Locale(getDefaultLanguage(aRequest), "");
+ String htmlcharset = "UTF-8";
+ try {
+ htmlcharset = MirPropertiesConfiguration.instance().getString("Mir.DefaultHTMLCharset");
+ }
+ catch (Throwable t) {
+ }
+
+ aResponse.setContentType("text/html; charset=" + htmlcharset);
+
+ String moduleName = aRequest.getParameter("module");
+ checkLanguage(session, aRequest);
+
+
+
+ // Authentication
+ if (((moduleName != null) && moduleName.equals("login")) ||
+ (userEntity == null)) {
+ String user = aRequest.getParameter("login");
+ String passwd = aRequest.getParameter("password");
+ logger.debug("--login: evaluating for user: " + user);
+ userEntity = allowedUser(user, passwd);
+
+ if (userEntity == null) {
+ // login failed: redirecting to login
+ logger.warn("--login: failed!");
+ _sendLoginPage(aResponse, aRequest, aResponse.getWriter());
+
+ return;
+ }
+ else if ((moduleName != null) && moduleName.equals("login")) {
+ // login successful
+ logger.info("--login: successful! setting uid: " + userEntity.getId());
+ session.setAttribute("login.uid", userEntity);
+ logger.debug("--login: trying to retrieve login.target");
+
+ String target = (String) session.getAttribute("login.target");
+
+ if (target != null) {
+ logger.debug("Redirect: " + target);
+
+ int serverPort = aRequest.getServerPort();
+ String redirect = "";
+ String redirectString = "";
+
+ if (serverPort == 80) {
+ redirect =
+ aResponse.encodeURL(http + "://" + aRequest.getServerName() + target);
+ redirectString =
+ "<html><head><meta http-equiv=refresh content=\"1;URL=" +
+ redirect + "\"></head><body>going <a href=\"" + redirect +
+ "\">Mir</a></body></html>";
+ } else {
+ redirect =
+ aResponse.encodeURL(http + "://" + aRequest.getServerName() + ":" +
+ aRequest.getServerPort() + target);
+ redirectString =
+ "<html><head><meta http-equiv=refresh content=\"1;URL=" +
+ redirect + "\"></head><body>going <a href=\"" + redirect +
+ "\">Mir</a></body></html>";
+ }
+
+ aResponse.getWriter().println(redirectString);
+
+ //aResponse.sendRedirect(redirect);
+ } else {
+ // redirecting to default target
+ logger.debug("--login: no target - redirecting to default");
+ _sendStartPage(aResponse, aRequest, aResponse.getWriter(), userEntity);
+ }
+
+ return;
+ }
+ // if login succesful
+ }
+ // if login
+
+ if ((moduleName != null) && moduleName.equals("logout")) {
+ logger.info("--logout");
+ session.invalidate();
+
+ //session = aRequest.getSession(true);
+ //checkLanguage(session, aRequest);
+ _sendLoginPage(aResponse, aRequest, aResponse.getWriter());
+
+ return;
+ }
+
+ // Check if authed!
+ if (userEntity == null) {
+ // redirect to loginpage
+ String redirectString = aRequest.getRequestURI();
+ String queryString = aRequest.getQueryString();
+
+ if ((queryString != null) && !queryString.equals("")) {
+ redirectString += ("?" + aRequest.getQueryString());
+ logger.debug("STORING: " + redirectString);
+ session.setAttribute("login.target", redirectString);
+ }
+
+ _sendLoginPage(aResponse, aRequest, aResponse.getWriter());
+
+ return;
+ }
+
+ // If no module is specified goto standard startpage
+ if ((moduleName == null) || moduleName.equals("")) {
+ logger.debug("no module: redirect to standardpage");
+ _sendStartPage(aResponse, aRequest, aResponse.getWriter(), userEntity);
+
+ return;
+ }
+
+ // end of auth
+ // From now on regular dispatching...
+ try {
+ // get servletmodule by parameter and continue with dispacher
+ ServletModule smod = getServletModuleForName(moduleName);
+ ServletModuleDispatch.dispatch(smod, aRequest, aResponse);
+ }
+ catch (Throwable e) {
+ Throwable cause = ExceptionFunctions.traceCauseException(e);
+
+ if (cause instanceof ServletModuleUserExc)
+ handleUserError(aRequest, aResponse, aResponse.getWriter(), (ServletModuleUserExc) cause);
+ else
+ handleError(aRequest, aResponse, aResponse.getWriter(), cause);
+
+ }
+
+ // timing...
+ sessionConnectTime = System.currentTimeMillis() - startTime;
+ logger.info("EXECTIME (" + moduleName + "): " + sessionConnectTime + " ms");
+ }
+
+ /**
+ * Private method getServletModuleForName returns ServletModule
+ * from Cache
+ *
+ * @param moduleName
+ * @return ServletModule
+ *
+ */
+ private static ServletModule getServletModuleForName(String moduleName) throws ServletModuleExc {
+ // Instance in Map ?
+ if (!servletModuleInstanceHash.containsKey(moduleName)) {
+ // was not found in hash...
+ try {
+ Class theServletModuleClass = null;
+
+ try {
+ // first we try to get ServletModule from stern.che3.servlet
+ theServletModuleClass =
+ Class.forName("mircoders.servlet.ServletModule" + moduleName);
+ } catch (ClassNotFoundException e) {
+ // on failure, we try to get it from lib-layer
+ theServletModuleClass =
+ Class.forName("mir.servlet.ServletModule" + moduleName);
+ }
+
+ Method m = theServletModuleClass.getMethod("getInstance", null);
+ ServletModule smod = (ServletModule) m.invoke(null, null);
+
+ // we put it into map for further reference
+ servletModuleInstanceHash.put(moduleName, smod);
+
+ return smod;
+ }
+ catch (Exception e) {
+ throw new ServletModuleExc("*** error resolving classname for " + moduleName + " -- " + e.getMessage());
+ }
+ }
+ else {
+ return (ServletModule) servletModuleInstanceHash.get(moduleName);
+ }
+ }
+
+ private void handleUserError(HttpServletRequest aRequest, HttpServletResponse aResponse,
+ PrintWriter out, ServletModuleUserExc anException) {
+ try {
+ logger.info("user error: " + anException.getMessage());
+ SimpleHash modelRoot = new SimpleHash();
+ MessageResources messages = MessageResources.getMessageResources("bundles.admin");
+ modelRoot.put("errorstring",
+ new SimpleScalar(
+ messages.getMessage(getLocale(aRequest), anException.getMessage(), anException.getParameters())
+ ));
+ modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime(new GregorianCalendar())));
+ HTMLTemplateProcessor.process(
+ aResponse,
+ MirPropertiesConfiguration.instance().getString("Mir.UserErrorTemplate"),
+ modelRoot,
+ null,
+ out,
+ getLocale(aRequest),
+ fallbackLocale);
+ out.close();
+ }
+ catch (Exception e) {
+ logger.error("Error in UserErrorTemplate");
+ }
+
+ }
+
+ private void handleError(HttpServletRequest aRequest, HttpServletResponse aResponse,PrintWriter out, Throwable anException) {
+
+ try {
+ logger.error("error: " + anException);
+ SimpleHash modelRoot = new SimpleHash();
+ modelRoot.put("errorstring", new SimpleScalar(anException.getMessage()));
+ modelRoot.put("date", new SimpleScalar(StringUtil.date2readableDateTime(
+ new GregorianCalendar())));
+ HTMLTemplateProcessor.process(
+ aResponse,MirPropertiesConfiguration.instance().getString("Mir.ErrorTemplate"),
+ modelRoot,null,out, getLocale(aRequest), getFallbackLocale());
+ out.close();
+ }
+ catch (Exception e) {
+ logger.error("Error in ErrorTemplate");
+ }
+ }
+
+ /**
+ * evaluate login for user / password
+ */
+ protected EntityUsers allowedUser(String user, String password) {
+ try {
+ if (usersModule == null) {
+ usersModule = new ModuleUsers(DatabaseUsers.getInstance());
+ }
+
+ return usersModule.getUserForLogin(user, password);
+ }
+ catch (Exception e) {
+ logger.debug(e.getMessage());
+ e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
+
+ return null;
+ }
+ }
+
+ // Redirect-methods
+ private void _sendLoginPage(HttpServletResponse aResponse, HttpServletRequest aRequest,
+ PrintWriter out) {
+ String loginTemplate = configuration.getString("Mir.LoginTemplate");
+ String sessionUrl = aResponse.encodeURL("");
+
+ try {
+ SimpleHash mergeData = new SimpleHash();
+ SimpleList languages = new SimpleList();
+
+ mergeData.put("session", sessionUrl);
+
+ mergeData.put("defaultlanguage", getDefaultLanguage(aRequest));
+ mergeData.put("languages", getLoginLanguages());
+
+ HTMLTemplateProcessor.process(aResponse, loginTemplate, mergeData, null, out, getLocale(aRequest), getFallbackLocale());
+ }
+ catch (Throwable e) {
+ handleError(aRequest, aResponse, out, e);
+ }
+ }
+
+ private void _sendStartPage(HttpServletResponse aResponse, HttpServletRequest aRequest,
+ PrintWriter out, EntityUsers userEntity) {
+ String startTemplate = configuration.getString("Mir.StartTemplate");
+ String sessionUrl = aResponse.encodeURL("");
+
+ try {
+ Map mergeData = ServletHelper.makeGenerationData(new Locale[] {getLocale(aRequest), getFallbackLocale()}, "bundles.admin", "bundles.adminlocal");
+ mergeData.put("messages",
+ new CachingRewindableIterator(
+ new EntityIteratorAdapter( "", "webdb_create desc", 10,
+ MirGlobal.localizer().dataModel().adapterModel(), "internalMessage", 10, 0)));
+ mergeData.put("searchvalue", null);
+ mergeData.put("searchfield", null);
+ mergeData.put("searchispublished", null);
+ mergeData.put("searcharticletype", null);
+ mergeData.put("searchorder", null);
+ mergeData.put("selectarticleurl", null);
+
+ ServletHelper.generateResponse(aResponse.getWriter(), mergeData, startTemplate);
+ }
+ catch (Exception e) {
+ e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
+ handleError(aRequest, aResponse, out, e);
+ }
+ }
+
+ public String getServletInfo() {
+ return "Mir " + configuration.getString("Mir.Version");
+ }
+
+ private void checkLanguage(HttpSession session, HttpServletRequest aRequest) {
+ // a lang parameter always sets the language
+ String lang = aRequest.getParameter("language");
+
+ if (lang != null) {
+ logger.info("selected language " + lang + " overrides accept-language");
+ setLanguage(session, lang);
+ }
+ // otherwise store language from accept header in session
+ else if (session.getAttribute("language") == null) {
+ logger.info("accept-language is " + aRequest.getLocale().getLanguage());
+ setLanguage(session, aRequest.getLocale().getLanguage());
+ }
+ }
+}
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-import java.io.IOException;\r
-import java.io.PrintWriter;\r
-import javax.servlet.ServletException;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-import javax.servlet.http.HttpSession;\r
-\r
-import mir.servlet.AbstractServlet;\r
-import mir.servlet.ServletModuleDispatch;\r
-import mir.servlet.ServletModuleUserExc;\r
-import mir.util.ExceptionFunctions;\r
-import mircoders.global.MirGlobal;\r
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import mir.servlet.AbstractServlet;
+import mir.servlet.ServletModuleDispatch;
+import mir.servlet.ServletModuleUserExc;
+import mir.util.ExceptionFunctions;
+import mircoders.global.MirGlobal;
import mircoders.servlet.ServletModuleOpenIndy;
/**
* OpenMir.java - main servlet for open posting and comment feature to articles
*
* @author RK 1999-2001, the mir-coders group
- * @version $Id: OpenMir.java,v 1.33 2003/04/21 00:24:05 zapata Exp $
+ * @version $Id: OpenMir.java,v 1.34 2003/04/21 12:42:46 idfx Exp $
*
*/
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.config;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+
import javax.servlet.ServletContext;
import multex.Exc;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
-/**
- * Base class the entities are derived from. Provides base functionality of
- * an entity. Entities are used to represent rows of a database table.<p>
- */
-
package mir.entity;
import java.util.HashMap;
import freemarker.template.TemplateModelRoot;
/**
- * Base Class of Entities
+ * Base class the entities are derived from. Provides base functionality of
+ * an entity. Entities are used to represent rows of a database table.<p>
* Interfacing TemplateHashModel and TemplateModelRoot to be freemarker compliant
*
- * @version $Id: Entity.java,v 1.19 2003/04/09 02:06:06 zapata Exp $
+ * @version $Id: Entity.java,v 1.20 2003/04/21 12:42:46 idfx Exp $
* @author rk
*
*/
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.entity;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.entity;
import java.util.ArrayList;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.entity;
import mir.storage.StorageObject;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-/*
- * GenericEntity
- */
-
package mir.entity;
/**
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.entity;
/**
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.entity.adapter;
import java.util.Collection;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.entity.adapter;
import java.util.Calendar;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.entity.adapter;
import multex.Exc;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.entity.adapter;
import java.util.HashMap;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.entity.adapter;
import mir.entity.Entity;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.entity.adapter;
import java.util.AbstractList;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.generator;
-import java.util.HashMap;\r
+import java.util.HashMap;
import java.util.Map;
public class CompositeGeneratorLibrary implements Generator.GeneratorLibrary {
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.generator;
-import java.io.PrintWriter;\r
-import java.util.HashMap;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Vector;\r
-\r
-import org.apache.commons.beanutils.PropertyUtils;\r
-import freemarker.template.FileTemplateCache;\r
-import freemarker.template.SimpleScalar;\r
-import freemarker.template.Template;\r
-import freemarker.template.TemplateHashModel;\r
-import freemarker.template.TemplateListModel;\r
-import freemarker.template.TemplateMethodModel;\r
-import freemarker.template.TemplateModel;\r
-import freemarker.template.TemplateModelException;\r
-import freemarker.template.TemplateModelRoot;\r
-import freemarker.template.TemplateScalarModel;\r
-import mir.log.LoggerWrapper;\r
+import java.io.PrintWriter;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import mir.log.LoggerWrapper;
import mir.util.RewindableIterator;
+import org.apache.commons.beanutils.PropertyUtils;
+
+import freemarker.template.FileTemplateCache;
+import freemarker.template.SimpleScalar;
+import freemarker.template.Template;
+import freemarker.template.TemplateHashModel;
+import freemarker.template.TemplateListModel;
+import freemarker.template.TemplateMethodModel;
+import freemarker.template.TemplateModel;
+import freemarker.template.TemplateModelException;
+import freemarker.template.TemplateModelRoot;
+import freemarker.template.TemplateScalarModel;
+
public class FreemarkerGenerator implements Generator {
private Template template;
catch (Throwable t) {
t.printStackTrace();
aLogger.error("Exception occurred: "+t.getMessage());
- t.printStackTrace(aLogger.asPrintWriter(aLogger.DEBUG_MESSAGE));
+ t.printStackTrace(aLogger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
throw new GeneratorFailure( t );
}
}
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.generator;
-import java.util.List;\r
-import java.util.Map;\r
-\r
+import java.util.List;
+import java.util.Map;
+
import mir.log.LoggerWrapper;
public interface Generator {
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.generator;
import multex.Exc;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.generator;
import multex.Failure;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.generator;
import java.util.HashMap;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.generator;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.log;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.log;
import java.io.PrintWriter;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.log;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.log.log4j;
import java.util.HashMap;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.media;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.media;
import multex.Failure;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.media;
import java.lang.reflect.Method;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.media;
import java.io.InputStream;
* ) and just override the things that need to be specific. see MediaHandlerAudio
*
* @author <mh@nadir.org>, the Mir-coders group
- * @version $Id: MirMedia.java,v 1.16 2003/03/09 03:53:10 zapata Exp $
+ * @version $Id: MirMedia.java,v 1.17 2003/04/21 12:42:46 idfx Exp $
*/
public interface MirMedia{
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.misc;
* Based and inspired by a source from the Ant distribution
* (Copyright (c) 1999-2001 The Apache Software Foundation.)
*
- * @version $Id: ConfigException.java,v 1.3 2003/01/25 17:45:17 idfx Exp $
+ * @version $Id: ConfigException.java,v 1.4 2003/04/21 12:42:52 idfx Exp $
*
* @author The Mir-coders group
*/
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.misc;
import java.io.File;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.misc;
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two. You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries. If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so. If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mir.misc;\r
-\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+package mir.misc;
+
import java.io.PrintWriter;
import java.net.URLEncoder;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.Map;
import java.util.Set;
-import javax.servlet.http.HttpServletResponse;
-import org.apache.struts.util.MessageResources;
-import freemarker.template.FileTemplateCache;
-import freemarker.template.SimpleHash;
-import freemarker.template.SimpleList;
-import freemarker.template.SimpleScalar;
-import freemarker.template.Template;
-import freemarker.template.TemplateModelRoot;
+import javax.servlet.http.HttpServletResponse;
import mir.config.MirPropertiesConfiguration;
-import mir.config.MirPropertiesConfiguration$PropertiesConfigExc;
+import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;
import mir.entity.Entity;
import mir.entity.EntityList;
import mir.generator.FreemarkerGenerator;
import mir.storage.StorageObjectFailure;
import mir.util.GeneratorHTMLFunctions;
import mir.util.GeneratorIntegerFunctions;
-import mir.util.ResourceBundleGeneratorFunction;\r
-\r
-/**\r
- * Hilfsklasse zum Mergen von Template und Daten\r
- */\r
-public final class HTMLTemplateProcessor {\r
-\r
- public static String templateDir;\r
- private static final String[] bundles = { "bundles.adminlocal", "bundles.admin" };\r
- private static MirPropertiesConfiguration configuration;\r
- private static FileTemplateCache templateCache;\r
- private static String docRoot;\r
- private static String actionRoot;\r
- private static LoggerWrapper logger;\r
-\r
- static {\r
- // ML: configuration is not thread safe: it's risky to use it like this\r
- // actually I don't see why HTMLTemplateProcessor needs to be a\r
- // class with static methods. This causes more problems than it solves.\r
- try {\r
- configuration = MirPropertiesConfiguration.instance();\r
- }\r
- catch (PropertiesConfigExc e) {\r
- e.printStackTrace();\r
- }\r
-\r
- logger = new LoggerWrapper("TemplateEngine");\r
-\r
- templateDir =\r
- configuration.getStringWithHome("Mir.TemplateDir");\r
- templateCache = new FileTemplateCache(templateDir);\r
- templateCache.setLoadingPolicy(FileTemplateCache.LOAD_ON_DEMAND);\r
- // gone in freemarker 1.7.1: templateCache.startAutoUpdate();\r
-\r
-\r
- docRoot = configuration.getString("RootUri");\r
- try {\r
- actionRoot = docRoot +configuration.getString("Producer.ActionServlet");\r
- }\r
- catch (ConfigException ce) {\r
- // if Producer.ActionServlet is not set in the conf file\r
- actionRoot = docRoot + "/Mir";\r
- }\r
- }\r
-\r
- /**\r
- * empty private constructor, to avoid instantiation\r
- */\r
- private HTMLTemplateProcessor() {\r
- }\r
-\r
- /**\r
- * Wandelt Liste mit Entities <code>entList</code> in freemarker-Struktur um, mischt die Daten mit\r
- * Template <code>templateFilename</code> und gibt das Ergebnis an den PrintWriter\r
- * <code>out</code>\r
- *\r
- * @param templateFilename\r
- * @param entList\r
- * @param out\r
- * @exception HTMLParseException\r
- */\r
-\r
- public static void process(HttpServletResponse res, String templateFilename, EntityList entList, PrintWriter out, Locale locale, Locale aFallbackLocale) throws HTMLParseException {\r
- process(res, templateFilename, entList, (String)null, (TemplateModelRoot) null, out, locale, aFallbackLocale);\r
- }\r
-\r
- /**\r
- * Wandelt Entitylist in freemarker-Struktur um, f?gt <code>additionalModel</code>\r
- * unter dem Namen <code>additionalModelName</code> ein und mischt die Daten mit\r
- * Template <code>templateFilename</code> und gibt das Ergebnis an den PrintWriter\r
- * <code>out</code>\r
- *\r
- * @param templateFilename\r
- * @param entList\r
- * @param additionalModelName\r
- * @param additionalModel\r
- * @param out\r
- * @exception HTMLParseException\r
- */\r
-\r
- public static void process(HttpServletResponse res, String templateFilename,\r
- EntityList entList, String additionalModelName,\r
- TemplateModelRoot additionalModel, PrintWriter out,\r
- Locale locale, Locale aFallbackLocale) throws HTMLParseException {\r
-\r
- SimpleHash modelRoot = new SimpleHash();\r
-\r
- if (entList == null) {\r
- process(null, templateFilename, modelRoot, null, out, locale, aFallbackLocale);\r
- }\r
- else {\r
- try {\r
- modelRoot = makeSimpleHashWithEntitylistInfos(entList);\r
-\r
- // Quickhack um mal ein Popup mit reinzunhemen ..\r
- if (additionalModelName != null && additionalModel != null)\r
- modelRoot.put(additionalModelName, additionalModel);\r
-\r
- process(res, templateFilename, modelRoot, null, out, locale, aFallbackLocale);\r
- }\r
- catch (StorageObjectFailure e) {\r
- throw new HTMLParseException(e.toString());\r
- }\r
- }\r
- }\r
-\r
-\r
- /**\r
- * Mischt die freemarker-Struktur <code>tmr</code> mit\r
- * Template <code>templateFilename</code> und gibt das Ergebnis an den PrintWriter\r
- * <code>out</code>\r
- *\r
- * @param templateFilename\r
- * @param mergeData\r
- * @param out\r
- * @exception HTMLParseException\r
- */\r
- public static void process(HttpServletResponse res, String templateFilename,\r
- TemplateModelRoot tmr, PrintWriter out,\r
- Locale locale, Locale aFallbackLocale) throws HTMLParseException {\r
- process(res, templateFilename, tmr, null, out, locale, aFallbackLocale);\r
- }\r
-\r
- /**\r
- * Mischt die freemarker-Struktur <code>tmr</code> mit\r
- * Template <code>templateFilename</code> und gibt das Ergebnis an den PrintWriter\r
- * <code>out</code>\r
- *\r
- * @param templateFilename\r
- * @param mergeData\r
- * @param out\r
- * @exception HTMLParseException\r
- */\r
- public static void process(HttpServletResponse res, String templateFilename,\r
- TemplateModelRoot tmr, TemplateModelRoot extra,\r
- PrintWriter out, Locale locale, Locale aFallbackLocale) throws HTMLParseException {\r
-\r
- if (out == null)\r
- throw new HTMLParseException("no outputstream");\r
- Template tmpl = getTemplateFor(templateFilename);\r
- if (tmpl == null)\r
- throw new HTMLParseException("no template: " + templateFilename);\r
- if (tmr == null)\r
- tmr = new SimpleHash();\r
-\r
- /** @todo what is this for? (rk) */\r
- String session = "";\r
- if (res != null) {\r
- session = res.encodeURL("");\r
- }\r
-\r
- SimpleHash configHash = new SimpleHash();\r
-\r
- // pass the whole config hash to the templates\r
- Iterator it = configuration.getKeys();\r
- String key;\r
- while (it.hasNext()) {\r
- key = (String) it.next();\r
- configHash.put(key, new SimpleScalar(\r
- configuration.getString(key))\r
- );\r
- }\r
-\r
- // this does not come directly from the config file\r
- configHash.put("docRoot", new SimpleScalar(docRoot));\r
- configHash.put("actionRoot", new SimpleScalar(actionRoot + session));\r
- configHash.put("now",\r
- new SimpleScalar(StringUtil.date2readableDateTime(new GregorianCalendar())));\r
-\r
- // this conform to updated freemarker syntax\r
- configHash.put("compressWhitespace",\r
- new freemarker.template.utility.CompressWhitespace());\r
-\r
- SimpleHash utilityHash = new SimpleHash();\r
- try {\r
- utilityHash.put("compressWhitespace",\r
- new freemarker.template.utility.CompressWhitespace());\r
- utilityHash.put("encodeURI",\r
- FreemarkerGenerator.makeAdapter(new GeneratorHTMLFunctions.\r
- encodeURIGeneratorFunction()));\r
- utilityHash.put("encodeHTML",\r
- FreemarkerGenerator.makeAdapter(new GeneratorHTMLFunctions.\r
- encodeHTMLGeneratorFunction()));\r
- utilityHash.put("isOdd",\r
- FreemarkerGenerator.makeAdapter(new GeneratorIntegerFunctions.\r
- isOddFunction()));\r
- utilityHash.put("increment",\r
- FreemarkerGenerator.makeAdapter(new GeneratorIntegerFunctions.\r
- incrementFunction()));\r
- }\r
- catch (Throwable t) {\r
- throw new HTMLParseException(t.getMessage());\r
- }\r
-\r
- SimpleHash outPutHash = new SimpleHash();\r
-\r
- if (extra != null) {\r
- outPutHash.put("extra", extra);\r
- }\r
- outPutHash.put("data", tmr);\r
- outPutHash.put("config", configHash);\r
- outPutHash.put("utility", utilityHash);\r
-\r
- MessageResources messages[] = new MessageResources[bundles.length];\r
-\r
- for (int i=0; i<bundles.length; i++) {\r
- messages[i] = MessageResources.getMessageResources(bundles[i]);\r
- }\r
-\r
- try {\r
- outPutHash.put("lang", FreemarkerGenerator.makeAdapter(new ResourceBundleGeneratorFunction(new Locale[] {locale, aFallbackLocale}, messages)));\r
- }\r
- catch (Throwable t) {\r
- throw new HTMLParseException(t.toString());\r
- }\r
-\r
- tmpl.process(outPutHash, out);\r
- }\r
-\r
- /**\r
- * Converts Entity-List to SimpleList of SimpleHashes.\r
- * @param aList ist eine Liste von Entity\r
- * @return eine freemarker.template.SimpleList von SimpleHashes.\r
- *\r
- * @deprecated EntityLists comply with TemplateListModel now.\r
- */\r
- public static SimpleList makeSimpleList(EntityList aList) throws StorageObjectFailure {\r
- logger.warn("using deprecated makeSimpleList(entityList) - a waste of resources");\r
- SimpleList simpleList = new SimpleList();\r
- if (aList != null) {\r
- for (int i = 0; i < aList.size(); i++) {\r
- simpleList.add(aList.elementAt(i));\r
- }\r
- }\r
- return simpleList;\r
- }\r
-\r
- /**\r
- * Konvertiert ein EntityList in ein freemarker.template.SimpleHash-Modell. Im Hash\r
- * sind die einzelnen Entities ueber ihre id zu erreichen.\r
- * @param aList ist die EntityList\r
- * @return SimpleHash mit den entsprechenden freemarker Daten\r
- *\r
- */\r
- public static SimpleHash makeSimpleHash(EntityList aList) throws\r
- StorageObjectFailure {\r
- SimpleHash simpleHash = new SimpleHash();\r
- Entity currentEntity;\r
-\r
- if (aList != null) {\r
- for (int i = 0; i < aList.size(); i++) {\r
- currentEntity = (Entity) aList.elementAt(i);\r
- simpleHash.put(currentEntity.getId(), currentEntity);\r
- }\r
- }\r
- return simpleHash;\r
- }\r
-\r
- /**\r
- * Konvertiert ein Hashtable mit den keys und values als String\r
- * in ein freemarker.template.SimpleHash-Modell\r
- * @param mergeData der Map mit den String / String Daten\r
- * @return SimpleHash mit den entsprechenden freemarker Daten\r
- *\r
- */\r
- public static SimpleHash makeSimpleHash(Map mergeData) {\r
- SimpleHash modelRoot = new SimpleHash();\r
- String aField;\r
- if (mergeData != null) {\r
- Set set = mergeData.keySet();\r
- Iterator it = set.iterator();\r
- for (int i = 0; i < set.size(); i++) {\r
- aField = (String) it.next();\r
- modelRoot.put(aField, (String) mergeData.get(aField));\r
- }\r
- }\r
- return modelRoot;\r
- }\r
-\r
- /**\r
- * Converts EntityList in SimpleHash and adds additional information\r
- * to the returned SimpleHash\r
- *\r
- * @param entList\r
- * @return SimpleHash returns SimpleHash with the converted EntityList plus\r
- * additional Data about the list.\r
- * @exception StorageObjectException\r
- */\r
-\r
- public static SimpleHash makeSimpleHashWithEntitylistInfos(EntityList entList) throws\r
- StorageObjectFailure {\r
- SimpleHash modelRoot = new SimpleHash();\r
- if (entList != null) {\r
- modelRoot.put("contentlist", entList);\r
- modelRoot.put("count",\r
- new SimpleScalar( (new Integer(entList.getCount())).toString()));\r
- if (entList.getWhere() != null) {\r
- modelRoot.put("where", new SimpleScalar(entList.getWhere()));\r
- modelRoot.put("where_encoded",\r
- new SimpleScalar(URLEncoder.encode(entList.getWhere())));\r
- }\r
- if (entList.getOrder() != null) {\r
- modelRoot.put("order", new SimpleScalar(entList.getOrder()));\r
- modelRoot.put("order_encoded",\r
- new SimpleScalar(URLEncoder.encode(entList.getOrder())));\r
- }\r
- modelRoot.put("from",\r
- new SimpleScalar( (new Integer(entList.getFrom())).toString()));\r
- modelRoot.put("to",\r
- new SimpleScalar( (new Integer(entList.getTo())).toString()));\r
-\r
- if (entList.hasNextBatch())\r
- modelRoot.put("next",\r
- new SimpleScalar( (new Integer(entList.getNextBatch())).\r
- toString()));\r
- if (entList.hasPrevBatch())\r
- modelRoot.put("prev",\r
- new SimpleScalar( (new Integer(entList.getPrevBatch())).\r
- toString()));\r
- }\r
- return modelRoot;\r
- }\r
-\r
- /**\r
- * Private methods to get template from a templateFilename\r
- * @param templateFilename\r
- * @return Template\r
- * @exception HTMLParseException\r
- */\r
- private static Template getTemplateFor(String templateFilename) throws\r
- HTMLParseException {\r
- Template returnTemplate = null;\r
- if (templateFilename != null)\r
- returnTemplate = (Template) templateCache.getItem(templateFilename,\r
- "template");\r
-\r
- if (returnTemplate == null) {\r
- logger.error("CACHE (ERR): Unknown template: " + templateFilename);\r
- throw new HTMLParseException("Templatefile: " + templateFilename + " not found.");\r
- }\r
-\r
- return returnTemplate;\r
- }\r
+import mir.util.ResourceBundleGeneratorFunction;
+
+import org.apache.struts.util.MessageResources;
+
+import freemarker.template.FileTemplateCache;
+import freemarker.template.SimpleHash;
+import freemarker.template.SimpleList;
+import freemarker.template.SimpleScalar;
+import freemarker.template.Template;
+import freemarker.template.TemplateModelRoot;
+
+/**
+ * Hilfsklasse zum Mergen von Template und Daten
+ */
+public final class HTMLTemplateProcessor {
+
+ public static String templateDir;
+ private static final String[] bundles = { "bundles.adminlocal", "bundles.admin" };
+ private static MirPropertiesConfiguration configuration;
+ private static FileTemplateCache templateCache;
+ private static String docRoot;
+ private static String actionRoot;
+ private static LoggerWrapper logger;
+
+ static {
+ // ML: configuration is not thread safe: it's risky to use it like this
+ // actually I don't see why HTMLTemplateProcessor needs to be a
+ // class with static methods. This causes more problems than it solves.
+ try {
+ configuration = MirPropertiesConfiguration.instance();
+ }
+ catch (PropertiesConfigExc e) {
+ e.printStackTrace();
+ }
+
+ logger = new LoggerWrapper("TemplateEngine");
+
+ templateDir =
+ configuration.getStringWithHome("Mir.TemplateDir");
+ templateCache = new FileTemplateCache(templateDir);
+ templateCache.setLoadingPolicy(FileTemplateCache.LOAD_ON_DEMAND);
+ // gone in freemarker 1.7.1: templateCache.startAutoUpdate();
+
+
+ docRoot = configuration.getString("RootUri");
+ try {
+ actionRoot = docRoot +configuration.getString("Producer.ActionServlet");
+ }
+ catch (ConfigException ce) {
+ // if Producer.ActionServlet is not set in the conf file
+ actionRoot = docRoot + "/Mir";
+ }
+ }
+
+ /**
+ * empty private constructor, to avoid instantiation
+ */
+ private HTMLTemplateProcessor() {
+ }
+
+ /**
+ * Wandelt Liste mit Entities <code>entList</code> in freemarker-Struktur um, mischt die Daten mit
+ * Template <code>templateFilename</code> und gibt das Ergebnis an den PrintWriter
+ * <code>out</code>
+ *
+ * @param templateFilename
+ * @param entList
+ * @param out
+ * @exception HTMLParseException
+ */
+
+ public static void process(HttpServletResponse res, String templateFilename, EntityList entList, PrintWriter out, Locale locale, Locale aFallbackLocale) throws HTMLParseException {
+ process(res, templateFilename, entList, (String)null, (TemplateModelRoot) null, out, locale, aFallbackLocale);
+ }
+
+ /**
+ * Wandelt Entitylist in freemarker-Struktur um, f?gt <code>additionalModel</code>
+ * unter dem Namen <code>additionalModelName</code> ein und mischt die Daten mit
+ * Template <code>templateFilename</code> und gibt das Ergebnis an den PrintWriter
+ * <code>out</code>
+ *
+ * @param templateFilename
+ * @param entList
+ * @param additionalModelName
+ * @param additionalModel
+ * @param out
+ * @exception HTMLParseException
+ */
+
+ public static void process(HttpServletResponse res, String templateFilename,
+ EntityList entList, String additionalModelName,
+ TemplateModelRoot additionalModel, PrintWriter out,
+ Locale locale, Locale aFallbackLocale) throws HTMLParseException {
+
+ SimpleHash modelRoot = new SimpleHash();
+
+ if (entList == null) {
+ process(null, templateFilename, modelRoot, null, out, locale, aFallbackLocale);
+ }
+ else {
+ try {
+ modelRoot = makeSimpleHashWithEntitylistInfos(entList);
+
+ // Quickhack um mal ein Popup mit reinzunhemen ..
+ if (additionalModelName != null && additionalModel != null)
+ modelRoot.put(additionalModelName, additionalModel);
+
+ process(res, templateFilename, modelRoot, null, out, locale, aFallbackLocale);
+ }
+ catch (StorageObjectFailure e) {
+ throw new HTMLParseException(e.toString());
+ }
+ }
+ }
+
+
+ /**
+ * Mischt die freemarker-Struktur <code>tmr</code> mit
+ * Template <code>templateFilename</code> und gibt das Ergebnis an den PrintWriter
+ * <code>out</code>
+ *
+ * @param templateFilename
+ * @param mergeData
+ * @param out
+ * @exception HTMLParseException
+ */
+ public static void process(HttpServletResponse res, String templateFilename,
+ TemplateModelRoot tmr, PrintWriter out,
+ Locale locale, Locale aFallbackLocale) throws HTMLParseException {
+ process(res, templateFilename, tmr, null, out, locale, aFallbackLocale);
+ }
+
+ /**
+ * Mischt die freemarker-Struktur <code>tmr</code> mit
+ * Template <code>templateFilename</code> und gibt das Ergebnis an den PrintWriter
+ * <code>out</code>
+ *
+ * @param templateFilename
+ * @param mergeData
+ * @param out
+ * @exception HTMLParseException
+ */
+ public static void process(HttpServletResponse res, String templateFilename,
+ TemplateModelRoot tmr, TemplateModelRoot extra,
+ PrintWriter out, Locale locale, Locale aFallbackLocale) throws HTMLParseException {
+
+ if (out == null)
+ throw new HTMLParseException("no outputstream");
+ Template tmpl = getTemplateFor(templateFilename);
+ if (tmpl == null)
+ throw new HTMLParseException("no template: " + templateFilename);
+ if (tmr == null)
+ tmr = new SimpleHash();
+
+ /** @todo what is this for? (rk) */
+ String session = "";
+ if (res != null) {
+ session = res.encodeURL("");
+ }
+
+ SimpleHash configHash = new SimpleHash();
+
+ // pass the whole config hash to the templates
+ Iterator it = configuration.getKeys();
+ String key;
+ while (it.hasNext()) {
+ key = (String) it.next();
+ configHash.put(key, new SimpleScalar(
+ configuration.getString(key))
+ );
+ }
+
+ // this does not come directly from the config file
+ configHash.put("docRoot", new SimpleScalar(docRoot));
+ configHash.put("actionRoot", new SimpleScalar(actionRoot + session));
+ configHash.put("now",
+ new SimpleScalar(StringUtil.date2readableDateTime(new GregorianCalendar())));
+
+ // this conform to updated freemarker syntax
+ configHash.put("compressWhitespace",
+ new freemarker.template.utility.CompressWhitespace());
+
+ SimpleHash utilityHash = new SimpleHash();
+ try {
+ utilityHash.put("compressWhitespace",
+ new freemarker.template.utility.CompressWhitespace());
+ utilityHash.put("encodeURI",
+ FreemarkerGenerator.makeAdapter(new GeneratorHTMLFunctions.
+ encodeURIGeneratorFunction()));
+ utilityHash.put("encodeHTML",
+ FreemarkerGenerator.makeAdapter(new GeneratorHTMLFunctions.
+ encodeHTMLGeneratorFunction()));
+ utilityHash.put("isOdd",
+ FreemarkerGenerator.makeAdapter(new GeneratorIntegerFunctions.
+ isOddFunction()));
+ utilityHash.put("increment",
+ FreemarkerGenerator.makeAdapter(new GeneratorIntegerFunctions.
+ incrementFunction()));
+ }
+ catch (Throwable t) {
+ throw new HTMLParseException(t.getMessage());
+ }
+
+ SimpleHash outPutHash = new SimpleHash();
+
+ if (extra != null) {
+ outPutHash.put("extra", extra);
+ }
+ outPutHash.put("data", tmr);
+ outPutHash.put("config", configHash);
+ outPutHash.put("utility", utilityHash);
+
+ MessageResources messages[] = new MessageResources[bundles.length];
+
+ for (int i=0; i<bundles.length; i++) {
+ messages[i] = MessageResources.getMessageResources(bundles[i]);
+ }
+
+ try {
+ outPutHash.put("lang", FreemarkerGenerator.makeAdapter(new ResourceBundleGeneratorFunction(new Locale[] {locale, aFallbackLocale}, messages)));
+ }
+ catch (Throwable t) {
+ throw new HTMLParseException(t.toString());
+ }
+
+ tmpl.process(outPutHash, out);
+ }
+
+ /**
+ * Converts Entity-List to SimpleList of SimpleHashes.
+ * @param aList ist eine Liste von Entity
+ * @return eine freemarker.template.SimpleList von SimpleHashes.
+ *
+ * @deprecated EntityLists comply with TemplateListModel now.
+ */
+ public static SimpleList makeSimpleList(EntityList aList) throws StorageObjectFailure {
+ logger.warn("using deprecated makeSimpleList(entityList) - a waste of resources");
+ SimpleList simpleList = new SimpleList();
+ if (aList != null) {
+ for (int i = 0; i < aList.size(); i++) {
+ simpleList.add(aList.elementAt(i));
+ }
+ }
+ return simpleList;
+ }
+
+ /**
+ * Konvertiert ein EntityList in ein freemarker.template.SimpleHash-Modell. Im Hash
+ * sind die einzelnen Entities ueber ihre id zu erreichen.
+ * @param aList ist die EntityList
+ * @return SimpleHash mit den entsprechenden freemarker Daten
+ *
+ */
+ public static SimpleHash makeSimpleHash(EntityList aList) throws
+ StorageObjectFailure {
+ SimpleHash simpleHash = new SimpleHash();
+ Entity currentEntity;
+
+ if (aList != null) {
+ for (int i = 0; i < aList.size(); i++) {
+ currentEntity = (Entity) aList.elementAt(i);
+ simpleHash.put(currentEntity.getId(), currentEntity);
+ }
+ }
+ return simpleHash;
+ }
+
+ /**
+ * Konvertiert ein Hashtable mit den keys und values als String
+ * in ein freemarker.template.SimpleHash-Modell
+ * @param mergeData der Map mit den String / String Daten
+ * @return SimpleHash mit den entsprechenden freemarker Daten
+ *
+ */
+ public static SimpleHash makeSimpleHash(Map mergeData) {
+ SimpleHash modelRoot = new SimpleHash();
+ String aField;
+ if (mergeData != null) {
+ Set set = mergeData.keySet();
+ Iterator it = set.iterator();
+ for (int i = 0; i < set.size(); i++) {
+ aField = (String) it.next();
+ modelRoot.put(aField, (String) mergeData.get(aField));
+ }
+ }
+ return modelRoot;
+ }
+
+ /**
+ * Converts EntityList in SimpleHash and adds additional information
+ * to the returned SimpleHash
+ *
+ * @param entList
+ * @return SimpleHash returns SimpleHash with the converted EntityList plus
+ * additional Data about the list.
+ * @exception StorageObjectException
+ */
+
+ public static SimpleHash makeSimpleHashWithEntitylistInfos(EntityList entList) throws
+ StorageObjectFailure {
+ SimpleHash modelRoot = new SimpleHash();
+ if (entList != null) {
+ modelRoot.put("contentlist", entList);
+ modelRoot.put("count",
+ new SimpleScalar( (new Integer(entList.getCount())).toString()));
+ if (entList.getWhere() != null) {
+ modelRoot.put("where", new SimpleScalar(entList.getWhere()));
+ modelRoot.put("where_encoded",
+ new SimpleScalar(URLEncoder.encode(entList.getWhere())));
+ }
+ if (entList.getOrder() != null) {
+ modelRoot.put("order", new SimpleScalar(entList.getOrder()));
+ modelRoot.put("order_encoded",
+ new SimpleScalar(URLEncoder.encode(entList.getOrder())));
+ }
+ modelRoot.put("from",
+ new SimpleScalar( (new Integer(entList.getFrom())).toString()));
+ modelRoot.put("to",
+ new SimpleScalar( (new Integer(entList.getTo())).toString()));
+
+ if (entList.hasNextBatch())
+ modelRoot.put("next",
+ new SimpleScalar( (new Integer(entList.getNextBatch())).
+ toString()));
+ if (entList.hasPrevBatch())
+ modelRoot.put("prev",
+ new SimpleScalar( (new Integer(entList.getPrevBatch())).
+ toString()));
+ }
+ return modelRoot;
+ }
+
+ /**
+ * Private methods to get template from a templateFilename
+ * @param templateFilename
+ * @return Template
+ * @exception HTMLParseException
+ */
+ private static Template getTemplateFor(String templateFilename) throws
+ HTMLParseException {
+ Template returnTemplate = null;
+ if (templateFilename != null)
+ returnTemplate = (Template) templateCache.getItem(templateFilename,
+ "template");
+
+ if (returnTemplate == null) {
+ logger.error("CACHE (ERR): Unknown template: " + templateFilename);
+ throw new HTMLParseException("Templatefile: " + templateFilename + " not found.");
+ }
+
+ return returnTemplate;
+ }
}
\ No newline at end of file
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.misc;
import java.io.IOException;
import java.io.PrintWriter;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.misc;
/**
* Stores the file name and line number in a file.
*
- * @version $Id: Location.java,v 1.2 2002/09/01 22:05:50 mh Exp $
+ * @version $Id: Location.java,v 1.3 2003/04/21 12:42:52 idfx Exp $
*
*/
public class Location {
+++ /dev/null
-/*
- * Copyright (C) 2001, 2002 The Mir-coders group
- *
- * This file is part of Mir.
- *
- * Mir is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Mir is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Mir; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
- */
-
-package mir.misc;
-
-/**
- * Datamodel of a MulitpartRequest
- * (inner class)
- */
-public class MpRequest{
- byte[] uploadData=null;
- String fileName=null;
- String fileContentType=null;
-
- public MpRequest(byte[] i_uploadData, String i_fileName,
- String i_contentType){
- setFilename(i_fileName);
- setContentType(i_contentType);
- setMedia(i_uploadData);
- }
-
- public byte[] getMedia() {
- return uploadData;
- }
-
- public String getFilename() {
- return fileName;
- }
-
- public String getContentType() {
- return fileContentType;
- }
-
- public void setMedia(byte[] i_uploadData) {
- uploadData=i_uploadData;
- }
-
- public void setFilename(String i_fileName) {
- fileName=i_fileName;
- }
-
- public void setContentType(String i_contentType) {
- fileContentType=i_contentType;
- }
-}
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.misc;
import java.text.NumberFormat;
/**
* Help methods for number handling.
*
- * @version $Id: NumberUtils.java,v 1.4 2003/01/25 17:45:18 idfx Exp $
+ * @version $Id: NumberUtils.java,v 1.5 2003/04/21 12:42:52 idfx Exp $
* @author mh, Mir-coders group
*
*/
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.misc;
import java.io.ByteArrayOutputStream;
import javax.servlet.http.HttpServletResponse;
-import mircoders.global.MirGlobal;
-
import org.apache.fop.apps.Driver;
import org.apache.fop.apps.InputHandler;
import org.apache.fop.apps.XSLTInputHandler;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.misc;
import gnu.regexp.RE;
/**
* Statische Hilfsmethoden zur Stringbehandlung
*
- * @version $Id: StringUtil.java,v 1.32 2003/01/25 17:45:18 idfx Exp $
+ * @version $Id: StringUtil.java,v 1.33 2003/04/21 12:42:52 idfx Exp $
* @author mir-coders group
*
*/
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.misc;
/**
* Title:
* Description:
* Copyright: Copyright (c) 2002 Mir-coders
- * @author $Author: zapata $
- * @version $Id: WebdbImage.java,v 1.13 2003/04/09 02:06:07 zapata Exp $
+ * @author $Author: idfx $
+ * @version $Id: WebdbImage.java,v 1.14 2003/04/21 12:42:52 idfx Exp $
*/
import java.io.File;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.module;
import java.util.Map;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.module;
import multex.Exc;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.module;
import multex.Failure;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.util.Map;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.util.Iterator;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.util.Map;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.io.File;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.util.HashMap;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.util.Iterator;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.util.Map;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.io.PrintWriter;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.util.Map;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.util.Map;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.io.File;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.io.File;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.io.File;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
-import java.io.PrintWriter;
import java.util.Map;
import mir.generator.Generator;
import mir.generator.WriterEngine;
-import mir.log.LoggerToWriterAdapter;
import mir.log.LoggerWrapper;
import mir.util.ParameterExpander;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.util.Map;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.util.Map;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.util.HashMap;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.util.HashMap;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import mir.log.LoggerWrapper;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import multex.Exc;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.util.Iterator;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import multex.Failure;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.util.Map;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.util.Map;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.util.Map;
import mir.rss.RSSData;
import mir.rss.RSSReader;
import mir.rss.RSSToMapConverter;
-import mir.util.ParameterExpander;
import mir.util.ExceptionFunctions;
+import mir.util.ParameterExpander;
public class RSSProducerNode implements ProducerNode {
private String key;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.util.Locale;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.util.Map;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
public class SimpleProducerVerb implements ProducerFactory.ProducerVerb {
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer;
import java.util.Map;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer.reader;
import java.util.Arrays;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer.reader;
import multex.Exc;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
-
package mir.producer.reader;
import multex.Failure;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer.reader;
import java.io.File;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer.reader;
import java.util.Map;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer.reader;
import java.util.HashMap;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer.reader;
import java.util.Iterator;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer.reader;
import java.util.HashMap;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer.reader;
import java.util.HashMap;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.producer.reader;
import java.util.HashMap;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.rss;
-import java.util.*;
+import java.util.List;
+import java.util.Vector;
public class RSSChannel {
private String title;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.rss;
import java.util.HashMap;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.rss;
import multex.Exc;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.rss;
import multex.Failure;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.rss;
-import java.util.*;
public class RSSItem {
private String title;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.rss;
import java.io.InputStream;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.rss;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
public class RSSToMapConverter {
private RSSToMapConverter() {
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.servlet;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Locale;
+
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import com.codestudio.util.JDBCPool;
-import com.codestudio.util.JDBCPoolMetaData;
-import com.codestudio.util.SQLManager;
import mir.config.MirPropertiesConfiguration;
import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;
import mir.log.LoggerWrapper;
import mir.storage.DatabaseAdaptor;
+import com.codestudio.util.JDBCPool;
+import com.codestudio.util.JDBCPoolMetaData;
+import com.codestudio.util.SQLManager;
+
/**
* Title: Mir
* Description: Abstract servlet-class
* Copyright: Copyright (c) 2001, 2002
* Company: Mir-coders group
* @author idfx, the Mir-coders group
- * @version $Id: AbstractServlet.java,v 1.28 2003/04/20 14:42:09 idfx Exp $
+ * @version $Id: AbstractServlet.java,v 1.29 2003/04/21 12:42:50 idfx Exp $
*/
public abstract class AbstractServlet extends HttpServlet {
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.servlet;
import java.io.PrintWriter;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import freemarker.template.SimpleHash;
-import freemarker.template.TemplateModelRoot;
import mir.config.MirPropertiesConfiguration;
import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;
import mir.entity.EntityList;
import mir.module.AbstractModule;
import mir.storage.StorageObject;
import mir.util.HTTPRequestParser;
+import freemarker.template.SimpleHash;
+import freemarker.template.TemplateModelRoot;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.servlet;
import java.lang.reflect.InvocationTargetException;
* Dispatcher, calls the method passed to ServletModule Class, through the "do"
* Parameter (via POST or GET)
*
- * @version $Id: ServletModuleDispatch.java,v 1.14 2003/04/21 00:24:05 zapata Exp $
+ * @version $Id: ServletModuleDispatch.java,v 1.15 2003/04/21 12:42:50 idfx Exp $
*
* @Author rk
*
}
catch ( InvocationTargetException e) {
logger.error( "invocation target exception: " + e.getMessage());
- e.getTargetException().printStackTrace(logger.asPrintWriter(logger.DEBUG_MESSAGE));
+ e.getTargetException().printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
throw new ServletModuleFailure(e.getTargetException().getMessage(), e.getTargetException());
}
catch (Throwable t) {
logger.error( "ServletModuleDispatch: " + t.getMessage());
- t.printStackTrace(logger.asPrintWriter(logger.DEBUG_MESSAGE));
+ t.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
throw new ServletModuleFailure(t);
}
}
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.servlet;
import multex.Exc;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.servlet;
import multex.Failure;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.servlet;
import javax.servlet.http.HttpServletRequest;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.servlet;
import multex.Exc;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.session;
import java.io.InputStream;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.session;
import java.util.Arrays;
import java.util.List;
import java.util.Vector;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
-import org.apache.commons.fileupload.FileItem;
import mir.util.HTTPParsedRequest;
+import org.apache.commons.fileupload.FileItem;
+
public class HTTPAdapters {
public static class HTTPRequestAdapter implements Request {
private HttpServletRequest request;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.session;
import java.util.List;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.session;
-import java.util.Map;
public interface Response {
public void setResponseValue(String aName, Object aValue);
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.session;
public interface Session {
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.session;
import multex.Exc;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.session;
import multex.Failure;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.session;
public interface SessionHandler {
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.session;
import java.util.HashMap;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.session;
import java.io.InputStream;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.storage;
* Treiber, Host, User und Passwort, ueber den der Zugriff auf die
* Datenbank erfolgt.
*
- * @version $Id: Database.java,v 1.38 2003/04/16 03:26:45 zapata Exp $
+ * @version $Id: Database.java,v 1.39 2003/04/21 12:42:47 idfx Exp $
* @author rk
*
*/
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.storage;
*
* @author <RK>
*
- * @version $Id: DatabaseAdaptor.java,v 1.6 2003/03/05 19:23:15 idfx Exp $
+ * @version $Id: DatabaseAdaptor.java,v 1.7 2003/04/21 12:42:47 idfx Exp $
*/
public interface DatabaseAdaptor {
/* Liefert den Namen der Adaptorklasse
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
- */
-/*
- * put your module comment here
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
- */
-/*
- * Implementiert DatabaseAdaptor Interface f?r Sybase.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.storage;
+++ /dev/null
-/*
- * Copyright (C) 2001, 2002 The Mir-coders group
- *
- * This file is part of Mir.
- *
- * Mir is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Mir is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Mir; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
- */
-package mir.storage;
-
-import java.util.ArrayList;
-
-
-public class DatabaseCache {
- private final ArrayList _cache;
- private int _counter;
- private final int _max;
-
- public DatabaseCache(int i_max) {
- _counter = 0;
- _max = i_max;
- _cache = new ArrayList(_max);
- }
-
- public DatabaseCache() {
- _counter = -1;
- _max = 100;
- _cache = new ArrayList(_max);
- }
-
- public synchronized void put(String key, Object value) {
- if (_counter >= _max) {
- _cache.remove(0);
- _cache.trimToSize();
- _counter--;
- System.out.println("put: remove " + _counter);
- }
-
- _cache.add(new Entry(key, value));
- _counter++;
- System.out.println("put: put " + _counter);
- }
-
- public synchronized void clear() {
- _cache.clear();
- }
-
- public int containsKey(String key) {
- for (int i = 0; i < _cache.size(); i++) {
- if ((_cache.get(i) != null) &&
- ((Entry) _cache.get(i)).getKey().equals(key)) {
- return i;
- }
- }
-
- return -1;
- }
-
- public int containsValue(Object o) {
- for (int i = 0; i < _cache.size(); i++) {
- if ((_cache.get(i) != null) &&
- ((Entry) _cache.get(i)).getValue().equals(o)) {
- return i;
- }
- }
-
- return -1;
- }
-
- public Object get(String key) {
- for (int i = 0; i < _cache.size(); i++) {
- if ((_cache.get(i) != null) &&
- (((Entry) _cache.get(i)).getKey(key) != null) &&
- ((Entry) _cache.get(i)).getKey(key).equals(key)) {
- System.out.println("test2: " + ((Entry) _cache.get(i)).getKey(key));
-
- return ((Entry) _cache.get(i)).getValue();
- }
- }
-
- return null;
- }
-
- public synchronized boolean remove(String key) {
- int i = containsKey(key);
-
- if (i == -1) {
- return false;
- }
-
- _cache.remove(i);
- _cache.trimToSize();
- _counter--;
-
- return true;
- }
-
- public int size() {
- return _counter;
- }
-
- private class Entry {
- private String _key;
- private Object _value;
-
- public Entry(String i_key, Object i_value) {
- _key = i_key;
- _value = i_value;
- }
-
- public void put(String i_key, Object i_value) {
- _key = i_key;
- _value = i_value;
- }
-
- public Object getValue(String i_key) {
- if (i_key.equals(_key)) {
- return _value;
- } else {
- return null;
- }
- }
-
- public Object getValue() {
- return _value;
- }
-
- public String getKey(Object i_o) {
- if (i_o.equals(_value)) {
- return _key;
- } else {
- return null;
- }
- }
-
- public String getKey() {
- return _key;
- }
- }
- //Entry
-}
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
- */
-/*
- * Implementiert Interface f?r die Speicherschicht.
- * Bislang gibt es in der Bibliothek nur die M?glichkeit
- * in einer Datenbank zu speichern.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.storage.store;
/**
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.storage.store;
/**
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.storage.store;
/**
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.storage.store;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.storage.store;
/**
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.storage.store;
/**
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.storage.store;
/**
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.storage.store.test;
/**
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.storage.store.test;
/**
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.storage.store.test;
/**
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.storage.store.test;
/**
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.util;
import java.util.Iterator;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.util;
import java.text.SimpleDateFormat;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.util;
import java.lang.reflect.InvocationTargetException;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.util;
+import gnu.regexp.RE;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.IOException;
import java.io.FilenameFilter;
-
-import gnu.regexp.RE;
+import java.io.IOException;
public class FileFunctions {
protected static final int FILE_COPY_BUFFER_SIZE = 65536;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.util;
import java.io.File;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.util;
-import java.util.List;\r
-import java.util.Map;\r
-\r
-import mir.generator.Generator;\r
-import mir.generator.GeneratorExc;\r
+import java.util.List;
+import java.util.Map;
+
+import mir.generator.Generator;
+import mir.generator.GeneratorExc;
import mir.generator.GeneratorFailure;
public class GeneratorExpressionFunctions {
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.util;
import java.util.List;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.util;
import java.util.List;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.util;
import java.util.List;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.util;
import java.util.List;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.util;
import java.util.List;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.util;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.util;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Vector;
+
import javax.servlet.http.HttpServletRequest;
+import mir.log.LoggerWrapper;
+
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileUpload;
-import mir.log.LoggerWrapper;
public class HTTPParsedRequest {
static final String MULTIPART_FORMDATA_CONTENTTYPE = "multipart/form-data";
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two. You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries. If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so. If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mir.util;\r
-\r
-import javax.servlet.http.HttpServletRequest;\r
-\r
-public class HTTPRequestParser {\r
- private HttpServletRequest request;\r
- private String encoding;\r
-\r
- public HTTPRequestParser(HttpServletRequest aRequest) {\r
- this(aRequest, aRequest.getCharacterEncoding());\r
- }\r
-\r
- public HTTPRequestParser(HttpServletRequest aRequest, String anEncoding) {\r
- request = aRequest;\r
- encoding = anEncoding;\r
- }\r
-\r
- public boolean hasParameter(String aName) {\r
- return request.getParameter(aName)!=null;\r
- }\r
-\r
- public String getParameterWithDefault(String aName, String aDefault) {\r
- if (hasParameter(aName))\r
- return getParameter(aName);\r
- else\r
- return aDefault;\r
- }\r
-\r
- public String getParameter(String aName) {\r
- try {\r
- String result = request.getParameter(aName);\r
-// String requestEncoding = request.getCharacterEncoding();\r
-// if (requestEncoding==null)\r
-// requestEncoding = "ISO-8859-1";\r
-\r
-// if (result != null && encoding!=null && !encoding.equals(requestEncoding)) {\r
-// result = new String(result.getBytes(requestEncoding), encoding);\r
-// }\r
-\r
- return result;\r
- }\r
- catch (Throwable t) {\r
- throw new RuntimeException("HTTPRequestParser.getParameter: " + t.getMessage());\r
- }\r
- }\r
-\r
- public int getIntegerWithDefault(String aName, int aDefault) {\r
- int result = aDefault;\r
- String value = getParameter(aName);\r
-\r
- try {\r
- result = Integer.parseInt(value);\r
- }\r
- catch (Throwable t) {\r
- }\r
- return result;\r
- }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+
+package mir.util;
+
+import javax.servlet.http.HttpServletRequest;
+
+public class HTTPRequestParser {
+ private HttpServletRequest request;
+ private String encoding;
+
+ public HTTPRequestParser(HttpServletRequest aRequest) {
+ this(aRequest, aRequest.getCharacterEncoding());
+ }
+
+ public HTTPRequestParser(HttpServletRequest aRequest, String anEncoding) {
+ request = aRequest;
+ encoding = anEncoding;
+ }
+
+ public boolean hasParameter(String aName) {
+ return request.getParameter(aName)!=null;
+ }
+
+ public String getParameterWithDefault(String aName, String aDefault) {
+ if (hasParameter(aName))
+ return getParameter(aName);
+ else
+ return aDefault;
+ }
+
+ public String getParameter(String aName) {
+ try {
+ String result = request.getParameter(aName);
+// String requestEncoding = request.getCharacterEncoding();
+// if (requestEncoding==null)
+// requestEncoding = "ISO-8859-1";
+
+// if (result != null && encoding!=null && !encoding.equals(requestEncoding)) {
+// result = new String(result.getBytes(requestEncoding), encoding);
+// }
+
+ return result;
+ }
+ catch (Throwable t) {
+ throw new RuntimeException("HTTPRequestParser.getParameter: " + t.getMessage());
+ }
+ }
+
+ public int getIntegerWithDefault(String aName, int aDefault) {
+ int result = aDefault;
+ String value = getParameter(aName);
+
+ try {
+ result = Integer.parseInt(value);
+ }
+ catch (Throwable t) {
+ }
+ return result;
+ }
+}
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.util;
/**
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.util;
import java.io.Writer;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.util;
import java.util.HashMap;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.util;
import java.io.InputStream;
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two. You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries. If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so. If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mir.util;\r
-\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import java.util.Locale;\r
-import java.util.Vector;\r
-\r
-import org.apache.struts.util.MessageResources;\r
-import mir.generator.Generator;\r
-import mir.generator.GeneratorExc;\r
-\r
-public class ResourceBundleGeneratorFunction implements Generator.GeneratorFunction {\r
- private List messages;\r
- private List locales;\r
-\r
- public ResourceBundleGeneratorFunction(Locale aLocale, MessageResources aMessages) {\r
- this(new Locale[] { aLocale}, new MessageResources[] {aMessages} );\r
- }\r
-\r
- public ResourceBundleGeneratorFunction(Locale[] aLocales, MessageResources[] aMessages) {\r
- locales = new Vector();\r
- messages = new Vector();\r
-\r
- for(int i=0; i<aMessages.length; i++) {\r
- messages.add(aMessages[i]);\r
- }\r
-\r
- for(int i=0; i<aLocales.length; i++) {\r
- locales.add(aLocales[i]);\r
- }\r
- }\r
-\r
- public Object perform(List aParameters) throws GeneratorExc {\r
- List extraParameters = new Vector(aParameters);\r
-\r
- if (aParameters.size()<1)\r
- throw new GeneratorExc("ResourceBundleGeneratorFunction: at least 1 parameter expected");\r
-\r
- if (!(aParameters.get(0) instanceof String))\r
- throw new GeneratorExc("encodeHTMLGeneratorFunction: parameters must be strings");\r
-\r
- String key = (String) aParameters.get(0);\r
- extraParameters.remove(0);\r
-\r
- String message=null;\r
- Iterator j = locales.iterator();\r
- while (j.hasNext() && (message == null || message.trim().length()==0)) {\r
- Locale locale = (Locale) j.next();\r
-\r
- Iterator i = messages.iterator();\r
- while (i.hasNext() && (message == null || message.trim().length()==0)) {\r
- message = ( (MessageResources) i.next()).getMessage(locale, key, extraParameters.toArray());\r
- }\r
- }\r
-\r
- if (message == null) {\r
- return new String("??" + key + "??");\r
- }\r
- else {\r
- return message;\r
- }\r
- };\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+package mir.util;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Vector;
+
+import mir.generator.Generator;
+import mir.generator.GeneratorExc;
+
+import org.apache.struts.util.MessageResources;
+
+public class ResourceBundleGeneratorFunction implements Generator.GeneratorFunction {
+ private List messages;
+ private List locales;
+
+ public ResourceBundleGeneratorFunction(Locale aLocale, MessageResources aMessages) {
+ this(new Locale[] { aLocale}, new MessageResources[] {aMessages} );
+ }
+
+ public ResourceBundleGeneratorFunction(Locale[] aLocales, MessageResources[] aMessages) {
+ locales = new Vector();
+ messages = new Vector();
+
+ for(int i=0; i<aMessages.length; i++) {
+ messages.add(aMessages[i]);
+ }
+
+ for(int i=0; i<aLocales.length; i++) {
+ locales.add(aLocales[i]);
+ }
+ }
+
+ public Object perform(List aParameters) throws GeneratorExc {
+ List extraParameters = new Vector(aParameters);
+
+ if (aParameters.size()<1)
+ throw new GeneratorExc("ResourceBundleGeneratorFunction: at least 1 parameter expected");
+
+ if (!(aParameters.get(0) instanceof String))
+ throw new GeneratorExc("encodeHTMLGeneratorFunction: parameters must be strings");
+
+ String key = (String) aParameters.get(0);
+ extraParameters.remove(0);
+
+ String message=null;
+ Iterator j = locales.iterator();
+ while (j.hasNext() && (message == null || message.trim().length()==0)) {
+ Locale locale = (Locale) j.next();
+
+ Iterator i = messages.iterator();
+ while (i.hasNext() && (message == null || message.trim().length()==0)) {
+ message = ( (MessageResources) i.next()).getMessage(locale, key, extraParameters.toArray());
+ }
+ }
+
+ if (message == null) {
+ return new String("??" + key + "??");
+ }
+ else {
+ return message;
+ }
+ };
}
\ No newline at end of file
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.util;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.util;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.util;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.util;
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two. You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries. If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so. If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mir.util;\r
-\r
-import gnu.regexp.RE;\r
-import gnu.regexp.REException;\r
-\r
-import java.util.List;\r
-import java.util.Vector;\r
-\r
-public class StringRoutines {\r
-\r
- private StringRoutines() {\r
- }\r
-\r
- static int indexOfCharacters(String aString, char[] aCharacters, int aFrom) {\r
- int i;\r
- int result=-1;\r
- int position;\r
-\r
- for (i=0; i<aCharacters.length ; i++) {\r
- position = aString.indexOf(aCharacters[i], aFrom);\r
-\r
- if (position != -1 && ( result == -1 || position < result )) {\r
- result = position;\r
- }\r
- }\r
-\r
- return result;\r
- }\r
-\r
- static String replaceStringCharacters(String aText, char[] aCharactersToReplace, String[] aStringsToSubstitute) {\r
- if (aText==null)\r
- return null;\r
-\r
- int position, nextPosition;\r
- int i;\r
- StringBuffer result = new StringBuffer();\r
-\r
- position=0;\r
- do {\r
- nextPosition = StringRoutines.indexOfCharacters(aText, aCharactersToReplace, position);\r
-\r
- if (nextPosition<0)\r
- nextPosition = aText.length();\r
-\r
- result.append(aText.substring(position, nextPosition));\r
-\r
- if (nextPosition<aText.length())\r
- for (i=0; i<aCharactersToReplace.length; i++) {\r
- if (aCharactersToReplace[i] == aText.charAt(nextPosition)) {\r
- result.append(aStringsToSubstitute[i]);\r
- break;\r
- }\r
- }\r
- position=nextPosition+1;\r
- }\r
- while (nextPosition<aText.length()) ;\r
-\r
- return result.toString();\r
- }\r
-\r
-\r
- public static String interpretAsString(Object aValue) throws Exception {\r
- if (aValue instanceof String)\r
- return (String) aValue;\r
-\r
- if (aValue instanceof Integer)\r
- return ((Integer) aValue).toString();\r
-\r
- if (aValue == null)\r
- return "";\r
-\r
- throw new Exception("String expected, "+aValue+" found");\r
- }\r
-\r
- public static int interpretAsInteger(Object aValue) throws Exception {\r
- if (aValue instanceof Integer)\r
- return ((Integer) aValue).intValue();\r
-\r
- if (aValue instanceof String)\r
- try {\r
- return Integer.parseInt((String) aValue);\r
- }\r
- catch (Throwable t) {\r
- throw new Exception("Integer expected, "+aValue+" found");\r
- }\r
-\r
- throw new Exception("Integer expected, "+aValue+" found");\r
- }\r
-\r
- /**\r
- *\r
- * @param aSource\r
- * @param aSearchExpression\r
- * @param aReplacement\r
- * @return\r
- * @throws Exception\r
- */\r
- public static String performRegularExpressionReplacement(String aSource,\r
- String aSearchExpression, String aReplacement) throws Exception {\r
-\r
- RE regularExpression;\r
-\r
- regularExpression = new RE(aSearchExpression);\r
-\r
- return regularExpression.substituteAll(aSource, aReplacement);\r
- }\r
-\r
- /**\r
- *\r
- * @param aSource\r
- * @param aSearchExpression\r
- * @return\r
- * @throws REException\r
- */\r
- public static boolean performRegularExpressionSearch(String aSource,\r
- String aSearchExpression) throws REException {\r
- RE regularExpression;\r
-\r
- regularExpression = new RE(aSearchExpression);\r
-\r
- return regularExpression.isMatch(aSource);\r
- }\r
-\r
- /**\r
- * Separates a string based on a separator:\r
- * <code>seperateString("a:b:c", ":");</code> will lead to\r
- * a List with 3 Strings: <code>"a"</code>, <code>"b"</code> and <code>"c"</code>\r
- *\r
- * @param aString The string to split\r
- * @param aSeparator\r
- * @return\r
- */\r
-\r
- public static List splitString(String aString, String aSeparator) {\r
- List result= new Vector();\r
- int previousPosition = 0;\r
- int position;\r
- int endOfNamePosition;\r
-\r
- if (aString!=null) {\r
- while ( (position = aString.indexOf(aSeparator, previousPosition)) >= 0) {\r
- result.add(aString.substring(previousPosition, position));\r
- previousPosition = position + aSeparator.length();\r
- }\r
- result.add(aString.substring(previousPosition, aString.length()));\r
- }\r
-\r
- return result;\r
- }\r
-\r
- /**\r
- * Separates a String into at most 2 parts based on a separator:\r
- * <ul>\r
- * <li>\r
- * <code>seperateString("a:b:c", ":");</code> will lead to\r
- * a List with 2 Strings: <code>"a"</code> and <code>"b:c"</code>\r
- * <li>\r
- * <code>seperateString("abc", ":");</code> will lead to\r
- * a List with a single String: <code>"abc"</code>\r
- * </ul>\r
- *\r
- *\r
- * @param aString\r
- * @param aSeparator\r
- * @return\r
- */\r
- public static List separateString(String aString, String aSeparator) {\r
- List result= new Vector();\r
- int previousPosition = 0;\r
- int position;\r
- int endOfNamePosition;\r
-\r
- if((position = aString.indexOf(aSeparator, previousPosition))>=0) {\r
- result.add(aString.substring(previousPosition, position));\r
- previousPosition = position + aSeparator.length();\r
- }\r
-\r
- result.add(aString.substring(previousPosition, aString.length()));\r
-\r
- return result;\r
- }\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+package mir.util;
+
+import gnu.regexp.RE;
+import gnu.regexp.REException;
+
+import java.util.List;
+import java.util.Vector;
+
+public class StringRoutines {
+
+ private StringRoutines() {
+ }
+
+ static int indexOfCharacters(String aString, char[] aCharacters, int aFrom) {
+ int i;
+ int result=-1;
+ int position;
+
+ for (i=0; i<aCharacters.length ; i++) {
+ position = aString.indexOf(aCharacters[i], aFrom);
+
+ if (position != -1 && ( result == -1 || position < result )) {
+ result = position;
+ }
+ }
+
+ return result;
+ }
+
+ static String replaceStringCharacters(String aText, char[] aCharactersToReplace, String[] aStringsToSubstitute) {
+ if (aText==null)
+ return null;
+
+ int position, nextPosition;
+ int i;
+ StringBuffer result = new StringBuffer();
+
+ position=0;
+ do {
+ nextPosition = StringRoutines.indexOfCharacters(aText, aCharactersToReplace, position);
+
+ if (nextPosition<0)
+ nextPosition = aText.length();
+
+ result.append(aText.substring(position, nextPosition));
+
+ if (nextPosition<aText.length())
+ for (i=0; i<aCharactersToReplace.length; i++) {
+ if (aCharactersToReplace[i] == aText.charAt(nextPosition)) {
+ result.append(aStringsToSubstitute[i]);
+ break;
+ }
+ }
+ position=nextPosition+1;
+ }
+ while (nextPosition<aText.length()) ;
+
+ return result.toString();
+ }
+
+
+ public static String interpretAsString(Object aValue) throws Exception {
+ if (aValue instanceof String)
+ return (String) aValue;
+
+ if (aValue instanceof Integer)
+ return ((Integer) aValue).toString();
+
+ if (aValue == null)
+ return "";
+
+ throw new Exception("String expected, "+aValue+" found");
+ }
+
+ public static int interpretAsInteger(Object aValue) throws Exception {
+ if (aValue instanceof Integer)
+ return ((Integer) aValue).intValue();
+
+ if (aValue instanceof String)
+ try {
+ return Integer.parseInt((String) aValue);
+ }
+ catch (Throwable t) {
+ throw new Exception("Integer expected, "+aValue+" found");
+ }
+
+ throw new Exception("Integer expected, "+aValue+" found");
+ }
+
+ /**
+ *
+ * @param aSource
+ * @param aSearchExpression
+ * @param aReplacement
+ * @return
+ * @throws Exception
+ */
+ public static String performRegularExpressionReplacement(String aSource,
+ String aSearchExpression, String aReplacement) throws Exception {
+
+ RE regularExpression;
+
+ regularExpression = new RE(aSearchExpression);
+
+ return regularExpression.substituteAll(aSource, aReplacement);
+ }
+
+ /**
+ *
+ * @param aSource
+ * @param aSearchExpression
+ * @return
+ * @throws REException
+ */
+ public static boolean performRegularExpressionSearch(String aSource,
+ String aSearchExpression) throws REException {
+ RE regularExpression;
+
+ regularExpression = new RE(aSearchExpression);
+
+ return regularExpression.isMatch(aSource);
+ }
+
+ /**
+ * Separates a string based on a separator:
+ * <code>seperateString("a:b:c", ":");</code> will lead to
+ * a List with 3 Strings: <code>"a"</code>, <code>"b"</code> and <code>"c"</code>
+ *
+ * @param aString The string to split
+ * @param aSeparator
+ * @return
+ */
+
+ public static List splitString(String aString, String aSeparator) {
+ List result= new Vector();
+ int previousPosition = 0;
+ int position;
+ int endOfNamePosition;
+
+ if (aString!=null) {
+ while ( (position = aString.indexOf(aSeparator, previousPosition)) >= 0) {
+ result.add(aString.substring(previousPosition, position));
+ previousPosition = position + aSeparator.length();
+ }
+ result.add(aString.substring(previousPosition, aString.length()));
+ }
+
+ return result;
+ }
+
+ /**
+ * Separates a String into at most 2 parts based on a separator:
+ * <ul>
+ * <li>
+ * <code>seperateString("a:b:c", ":");</code> will lead to
+ * a List with 2 Strings: <code>"a"</code> and <code>"b:c"</code>
+ * <li>
+ * <code>seperateString("abc", ":");</code> will lead to
+ * a List with a single String: <code>"abc"</code>
+ * </ul>
+ *
+ *
+ * @param aString
+ * @param aSeparator
+ * @return
+ */
+ public static List separateString(String aString, String aSeparator) {
+ List result= new Vector();
+ int previousPosition = 0;
+ int position;
+ int endOfNamePosition;
+
+ if((position = aString.indexOf(aSeparator, previousPosition))>=0) {
+ result.add(aString.substring(previousPosition, position));
+ previousPosition = position + aSeparator.length();
+ }
+
+ result.add(aString.substring(previousPosition, aString.length()));
+
+ return result;
+ }
}
\ No newline at end of file
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.util;
import java.util.List;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.util;
import java.util.HashMap;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.util;
import multex.Exc;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.util;
import multex.Failure;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.util;
-import java.io.File;
import java.io.FileInputStream;
-import java.io.StringReader;
-import java.io.FileNotFoundException;
-import java.io.IOException;
import java.io.InputStream;
-
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import java.util.Stack;
-package mir.util;
-
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
+package mir.util;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.List;
public class XMLReaderTool {
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.xml;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mir.xml;
import java.io.File;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mir.xml;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.entity;
-import java.sql.SQLException;
import java.util.Map;
import mir.storage.StorageObject;
-import mir.storage.StorageObjectFailure;
/**
* This class handles storage of audio data and meta data
*
* @author mh
- * @version $Id: EntityAudio.java,v 1.10 2003/04/09 02:06:08 zapata Exp $
+ * @version $Id: EntityAudio.java,v 1.11 2003/04/21 12:42:53 idfx Exp $
*/
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two. You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries. If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so. If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.entity;\r
-\r
-import java.util.Map;\r
-\r
-import mir.entity.Entity;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
-import mircoders.storage.DatabaseCommentToMedia;\r
-import mircoders.storage.DatabaseContent;\r
-\r
-/**\r
- * This class maps one line of the comment-table to a java-object.\r
- *\r
- * @author $Author: zapata $\r
- * @version $Revision: 1.15 $ $Date: 2003/04/10 03:31:46 $\r
- */\r
-\r
-\r
-public class EntityComment extends Entity\r
-{\r
-\r
- public EntityComment()\r
- {\r
- super();\r
- }\r
-\r
- public EntityComment(StorageObject theStorage) {\r
- this();\r
- setStorage(theStorage);\r
- }\r
-\r
-\r
- /**\r
- * overridden method setValues to patch creator_main_url\r
- */\r
- public void setValues(Map theStringValues)\r
- {\r
- if (theStringValues != null) {\r
- if (!theStringValues.containsKey("is_published")) {\r
- theStringValues.put("is_published","0");\r
- }\r
-\r
- if (theStringValues.containsKey("main_url")){\r
- if (((String)theStringValues.get("main_url")).equalsIgnoreCase("http://")) {\r
- theStringValues.remove("main_url");\r
- }\r
- else if ((!((String)theStringValues.get("main_url")).startsWith("http://"))\r
- && ((String)theStringValues.get("main_url")).length()>0) {\r
- theStringValues.put("main_url","http://"+((String)theStringValues.get("main_url")));\r
- }\r
- }\r
-\r
- }\r
- super.setValues(theStringValues);\r
- }\r
-\r
- /**\r
- * Deattaches media from a comment\r
- *\r
- * @param aCommentId\r
- * @param aMediaId\r
- * @throws StorageObjectFailure\r
- */\r
- public void dettach(String aCommentId,String aMediaId) throws StorageObjectFailure\r
- {\r
- if (aMediaId!=null){\r
- try{\r
- DatabaseCommentToMedia.getInstance().delete(aCommentId, aMediaId);\r
- }\r
- catch (Exception e){\r
- throwStorageObjectFailure(e, "dettach: failed to get instance");\r
- }\r
-\r
- DatabaseContent.getInstance().setUnproduced("id="+getValue("to_media"));\r
- }\r
- }\r
-\r
- /**\r
- *\r
- * @param aMediaId\r
- * @throws StorageObjectFailure\r
- */\r
-\r
- public void attach(String aMediaId) throws StorageObjectFailure\r
- {\r
- if (aMediaId!=null) {\r
- try{\r
- DatabaseCommentToMedia.getInstance().addMedia(getId(), aMediaId);\r
- }\r
- catch(StorageObjectFailure e){\r
- throwStorageObjectFailure(e, "attach: could not get the instance");\r
- }\r
-\r
- DatabaseContent.getInstance().setUnproduced("id="+getValue("to_media"));\r
- }\r
- else {\r
- logger.error("EntityContent: attach without mid");\r
- }\r
- }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.entity;
+
+import java.util.Map;
+
+import mir.entity.Entity;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
+import mircoders.storage.DatabaseCommentToMedia;
+import mircoders.storage.DatabaseContent;
+
+/**
+ * This class maps one line of the comment-table to a java-object.
+ *
+ * @author $Author: idfx $
+ * @version $Revision: 1.16 $ $Date: 2003/04/21 12:42:53 $
+ */
+
+
+public class EntityComment extends Entity
+{
+
+ public EntityComment()
+ {
+ super();
+ }
+
+ public EntityComment(StorageObject theStorage) {
+ this();
+ setStorage(theStorage);
+ }
+
+
+ /**
+ * overridden method setValues to patch creator_main_url
+ */
+ public void setValues(Map theStringValues)
+ {
+ if (theStringValues != null) {
+ if (!theStringValues.containsKey("is_published")) {
+ theStringValues.put("is_published","0");
+ }
+
+ if (theStringValues.containsKey("main_url")){
+ if (((String)theStringValues.get("main_url")).equalsIgnoreCase("http://")) {
+ theStringValues.remove("main_url");
+ }
+ else if ((!((String)theStringValues.get("main_url")).startsWith("http://"))
+ && ((String)theStringValues.get("main_url")).length()>0) {
+ theStringValues.put("main_url","http://"+((String)theStringValues.get("main_url")));
+ }
+ }
+
+ }
+ super.setValues(theStringValues);
+ }
+
+ /**
+ * Deattaches media from a comment
+ *
+ * @param aCommentId
+ * @param aMediaId
+ * @throws StorageObjectFailure
+ */
+ public void dettach(String aCommentId,String aMediaId) throws StorageObjectFailure
+ {
+ if (aMediaId!=null){
+ try{
+ DatabaseCommentToMedia.getInstance().delete(aCommentId, aMediaId);
+ }
+ catch (Exception e){
+ throwStorageObjectFailure(e, "dettach: failed to get instance");
+ }
+
+ DatabaseContent.getInstance().setUnproduced("id="+getValue("to_media"));
+ }
+ }
+
+ /**
+ *
+ * @param aMediaId
+ * @throws StorageObjectFailure
+ */
+
+ public void attach(String aMediaId) throws StorageObjectFailure
+ {
+ if (aMediaId!=null) {
+ try{
+ DatabaseCommentToMedia.getInstance().addMedia(getId(), aMediaId);
+ }
+ catch(StorageObjectFailure e){
+ throwStorageObjectFailure(e, "attach: could not get the instance");
+ }
+
+ DatabaseContent.getInstance().setUnproduced("id="+getValue("to_media"));
+ }
+ else {
+ logger.error("EntityContent: attach without mid");
+ }
+ }
+}
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.entity;
* this class implements mapping of one line of the database table content
* to a java object
*
- * @version $Id: EntityContent.java,v 1.18 2003/04/10 03:31:47 zapata Exp $
+ * @version $Id: EntityContent.java,v 1.19 2003/04/21 12:42:54 idfx Exp $
* @author mir-coders group
*
*/
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.entity;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.entity;
* Diese Klasse enth?lt die Daten eines MetaObjekts
*
* @author RK, mh, mir-coders
- * @version $Id: EntityImages.java,v 1.19 2003/03/08 17:18:19 idfx Exp $
+ * @version $Id: EntityImages.java,v 1.20 2003/04/21 12:42:53 idfx Exp $
*/
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.entity;
import java.util.Set;
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two. You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries. If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so. If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.entity;\r
-\r
-import mir.entity.Entity;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectExc;\r
-import mir.storage.StorageObjectFailure;\r
-import mircoders.storage.DatabaseMedia;\r
-/**\r
- * Diese Klasse enth?lt die Daten eines MetaObjekts\r
- *\r
- * @author RK\r
- * @version 29.6.1999\r
- */\r
-\r
-\r
-public class EntityMedia extends Entity\r
-{\r
-\r
- public EntityMedia(){\r
- super();\r
- }\r
-\r
- public EntityMedia(StorageObject theStorage)\r
- {\r
- this();\r
- setStorage(theStorage);\r
- }\r
-\r
- /**\r
- * fetches the MediaType entry assiciated w/ this media\r
- *\r
- * @return mir.entity.Entity\r
- */\r
- public Entity getMediaType() throws StorageObjectFailure {\r
- try {\r
- return ( (DatabaseMedia) theStorageObject).getMediaType(this);\r
- }\r
- catch (StorageObjectFailure e) {\r
- throw new StorageObjectFailure("getMediaType(): ", e);\r
- }\r
- catch (StorageObjectExc e) {\r
- throw new StorageObjectFailure("getMediaType(): ", e);\r
- }\r
-\r
- }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+package mircoders.entity;
+
+import mir.entity.Entity;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectExc;
+import mir.storage.StorageObjectFailure;
+import mircoders.storage.DatabaseMedia;
+/**
+ * Diese Klasse enth?lt die Daten eines MetaObjekts
+ *
+ * @author RK
+ * @version 29.6.1999
+ */
+
+
+public class EntityMedia extends Entity
+{
+
+ public EntityMedia(){
+ super();
+ }
+
+ public EntityMedia(StorageObject theStorage)
+ {
+ this();
+ setStorage(theStorage);
+ }
+
+ /**
+ * fetches the MediaType entry assiciated w/ this media
+ *
+ * @return mir.entity.Entity
+ */
+ public Entity getMediaType() throws StorageObjectFailure {
+ try {
+ return ( (DatabaseMedia) theStorageObject).getMediaType(this);
+ }
+ catch (StorageObjectFailure e) {
+ throw new StorageObjectFailure("getMediaType(): ", e);
+ }
+ catch (StorageObjectExc e) {
+ throw new StorageObjectFailure("getMediaType(): ", e);
+ }
+
+ }
+}
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.entity;
-import java.sql.SQLException;
import java.util.Map;
import mir.storage.StorageObject;
-import mir.storage.StorageObjectFailure;
/**
* This class handles storage of other data and meta data
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.entity;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.entity;
-import java.sql.SQLException;\r
-import java.util.Map;\r
-\r
-import freemarker.template.SimpleList;\r
-import freemarker.template.SimpleScalar;\r
-import freemarker.template.TemplateModel;\r
-import freemarker.template.TemplateModelException;\r
-import mir.entity.Entity;\r
-import mir.log.LoggerWrapper;\r
-import mir.media.MediaHelper;\r
-import mir.media.MirMedia;\r
-import mir.misc.NumberUtils;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
+import java.sql.SQLException;
+import java.util.Map;
+
+import mir.entity.Entity;
+import mir.log.LoggerWrapper;
+import mir.media.MediaHelper;
+import mir.media.MirMedia;
+import mir.misc.NumberUtils;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
import mircoders.storage.DatabaseUploadedMedia;
+import freemarker.template.SimpleList;
+import freemarker.template.SimpleScalar;
+import freemarker.template.TemplateModel;
+import freemarker.template.TemplateModelException;
/**
*
* @author mh, mir-coders group
- * @version $Id: EntityUploadedMedia.java,v 1.25 2003/04/10 03:31:47 zapata Exp $
+ * @version $Id: EntityUploadedMedia.java,v 1.26 2003/04/21 12:42:53 idfx Exp $
*/
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.entity;
import mir.entity.Entity;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.entity;
-import java.sql.SQLException;
import java.util.Map;
import mir.log.LoggerWrapper;
import mir.storage.StorageObject;
-import mir.storage.StorageObjectFailure;
/**
* Diese Klasse enth?lt die Daten eines MetaObjekts
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two. You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries. If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so. If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.global;\r
-\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.global;
+
+import gnu.regexp.RE;
+
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.Map;
import java.util.Random;
import java.util.Vector;
+
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.collections.ExtendedProperties;
-import gnu.regexp.RE;
-
import mir.entity.Entity;
import mir.log.LoggerWrapper;
import mir.session.HTTPAdapters;
import mir.util.StringRoutines;
import mircoders.entity.EntityComment;
import mircoders.entity.EntityContent;
-import mircoders.localizer.MirAdminInterfaceLocalizer;\r
-\r
-\r
-public class Abuse {\r
- private List filters;\r
- private int maxIdentifier;\r
- private LoggerWrapper logger;\r
- private int logSize;\r
- private boolean logEnabled;\r
- private boolean openPostingDisabled;\r
- private boolean openPostingPassword;\r
- private boolean cookieOnBlock;\r
- private String articleBlockAction;\r
- private String commentBlockAction;\r
- private List log;\r
- private String configFile = MirGlobal.config().getStringWithHome("Abuse.Config");\r
-\r
-\r
- private static final String IP_FILTER_TYPE="ip";\r
- private static final String REGEXP_FILTER_TYPE="regexp";\r
- private static String cookieName=MirGlobal.config().getString("Abuse.CookieName");\r
- private static int cookieMaxAge = 60*60*MirGlobal.config().getInt("Abuse.CookieMaxAge");\r
-\r
- public Abuse() {\r
- logger = new LoggerWrapper("Global.Abuse");\r
- filters = new Vector();\r
- maxIdentifier = 0;\r
- log = new Vector();\r
-\r
- logSize = 100;\r
- logEnabled = false;\r
- articleBlockAction = "";\r
- commentBlockAction = "";\r
- openPostingPassword = false;\r
- openPostingDisabled = false;\r
- cookieOnBlock = false;\r
-\r
- load();\r
- }\r
-\r
- public boolean checkIpFilter(String anIpAddress) {\r
- synchronized (filters) {\r
- Iterator i = filters.iterator();\r
-\r
- while (i.hasNext()) {\r
- Filter filter = (Filter) i.next();\r
-\r
- try {\r
- if ( (filter.getType().equals(IP_FILTER_TYPE)) &&\r
- InternetFunctions.isIpAddressInNetwork(anIpAddress, filter.getExpression())) {\r
- logger.debug("ip match on " + filter.getExpression());\r
- return true;\r
- }\r
- }\r
- catch (Throwable t) {\r
- logger.warn("error while checking ip address " + anIpAddress + " over network " + filter.expression + ": " + t.getMessage());\r
- }\r
- }\r
-\r
- return false;\r
- }\r
- }\r
-\r
- private boolean checkRegExpFilter(Entity anEntity) {\r
- synchronized (filters) {\r
- Iterator i = filters.iterator();\r
-\r
- while (i.hasNext()) {\r
- Filter filter = (Filter) i.next();\r
-\r
- if (filter.getType().equals(REGEXP_FILTER_TYPE)) {\r
- try {\r
- RE regularExpression = new RE(filter.getExpression());\r
-\r
- Iterator j = anEntity.getFields().iterator();\r
- while (j.hasNext()) {\r
- String field = anEntity.getValue( (String) j.next());\r
-\r
- if (field != null && regularExpression.isMatch(field.toLowerCase())) {\r
- logger.debug("regexp match on " + filter.getExpression());\r
- return true;\r
- }\r
- }\r
- }\r
- catch (Throwable t) {\r
- logger.warn("error while checking entity with regexp " + filter.getExpression() + ": " + t.getMessage());\r
- }\r
- }\r
- }\r
-\r
- return false;\r
- }\r
- }\r
-\r
- private void setCookie(HttpServletResponse aResponse) {\r
- Random random = new Random();\r
-\r
- Cookie cookie = new Cookie(cookieName, Integer.toString(random.nextInt(1000000000)));\r
- cookie.setMaxAge(cookieMaxAge);\r
- cookie.setPath("/");\r
-\r
- if (aResponse!=null)\r
- aResponse.addCookie(cookie);\r
- }\r
-\r
- private boolean checkCookie(List aCookies) {\r
- if (getCookieOnBlock()) {\r
- Iterator i = aCookies.iterator();\r
-\r
- while (i.hasNext()) {\r
- Cookie cookie = (Cookie) i.next();\r
-\r
- if (cookie.getName().equals(cookieName)) {\r
- logger.debug("cookie match");\r
- return true;\r
- }\r
- }\r
- }\r
-\r
- return false;\r
- }\r
-\r
- public void checkComment(EntityComment aComment, Request aRequest, HttpServletResponse aResponse) {\r
- try {\r
- long time = System.currentTimeMillis();\r
- String address = "0.0.0.0";\r
- String browser = "unknown";\r
- Cookie[] cookies = {};\r
-\r
- HttpServletRequest request = null;\r
-\r
- if (aRequest instanceof HTTPAdapters.HTTPParsedRequestAdapter) {\r
- request = ((HTTPAdapters.HTTPParsedRequestAdapter) aRequest).getRequest();\r
- }\r
- else if (aRequest instanceof HTTPAdapters.HTTPRequestAdapter) {\r
- request = ((HTTPAdapters.HTTPRequestAdapter) aRequest).getRequest();\r
- }\r
- if (request!=null) {\r
- browser = (String) request.getHeader("User-Agent");\r
- address = request.getRemoteAddr();\r
- cookies = request.getCookies();\r
- }\r
-\r
- logComment(address, aComment.getId(), new Date(), browser);\r
-\r
- MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = MirGlobal.localizer().adminInterface().simpleCommentOperationForName(commentBlockAction);\r
-\r
- if (checkCookie(Arrays.asList(cookies)) || checkIpFilter(address) || checkRegExpFilter(aComment)) {\r
- operation.perform(null, MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter("comment", aComment));\r
- setCookie(aResponse);\r
- }\r
-\r
- logger.info("checkComment: " + (System.currentTimeMillis()-time) + "ms");\r
- }\r
- catch (Throwable t) {\r
- logger.error("Abuse.checkComment: " + t.toString());\r
- }\r
- }\r
-\r
- public void checkArticle(EntityContent anArticle, HttpServletRequest aRequest, HttpServletResponse aResponse) {\r
- try {\r
- long time = System.currentTimeMillis();\r
-\r
- logArticle(aRequest.getRemoteAddr(), anArticle.getId(), new Date(), (String) aRequest.getHeader("User-Agent"));\r
-\r
- MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = MirGlobal.localizer().adminInterface().simpleCommentOperationForName(commentBlockAction);\r
-\r
- if (checkCookie(Arrays.asList(aRequest.getCookies())) || checkIpFilter(aRequest.getRemoteAddr()) || checkRegExpFilter(anArticle)) {\r
- operation.perform(null, MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter("content", anArticle));\r
- setCookie(aResponse);\r
- }\r
-\r
- logger.info("checkArticle: " + (System.currentTimeMillis()-time) + "ms");\r
- }\r
- catch (Throwable t) {\r
- logger.error("Abuse.checkArticle: " + t.toString());\r
- }\r
- }\r
-\r
- public boolean getLogEnabled() {\r
- return logEnabled;\r
- }\r
-\r
- public void setLogEnabled(boolean anEnabled) {\r
- logEnabled = anEnabled;\r
- truncateLog();\r
- }\r
-\r
- public int getLogSize() {\r
- return logSize;\r
- }\r
-\r
- public void setLogSize(int aSize) {\r
- logSize = aSize;\r
- truncateLog();\r
- }\r
-\r
- public boolean getOpenPostingDisabled() {\r
- return openPostingDisabled;\r
- }\r
-\r
- public void setOpenPostingDisabled(boolean anOpenPostingDisabled) {\r
- openPostingDisabled = anOpenPostingDisabled;\r
- }\r
-\r
- public boolean getOpenPostingPassword() {\r
- return openPostingPassword;\r
- }\r
-\r
- public void setOpenPostingPassword(boolean anOpenPostingPassword) {\r
- openPostingPassword = anOpenPostingPassword;\r
- }\r
-\r
- public boolean getCookieOnBlock() {\r
- return cookieOnBlock;\r
- }\r
-\r
- public void setCookieOnBlock(boolean aCookieOnBlock) {\r
- cookieOnBlock = aCookieOnBlock;\r
- }\r
-\r
- public String getArticleBlockAction() {\r
- return articleBlockAction;\r
- }\r
-\r
- public void setArticleBlockAction(String anAction) {\r
- articleBlockAction = anAction;\r
- }\r
-\r
- public String getCommentBlockAction() {\r
- return commentBlockAction;\r
- }\r
-\r
- public void setCommentBlockAction(String anAction) {\r
- commentBlockAction = anAction;\r
- }\r
-\r
-\r
- public List getLog() {\r
- synchronized(log) {\r
- List result = new Vector();\r
-\r
- Iterator i = log.iterator();\r
- while (i.hasNext()) {\r
- LogEntry logEntry = (LogEntry) i.next();\r
- Map entry = new HashMap();\r
-\r
- entry.put("ip", logEntry.getIpNumber());\r
- entry.put("id", logEntry.getId());\r
- entry.put("timestamp", new DateToMapAdapter(logEntry.getTimeStamp()));\r
- if (logEntry.getIsArticle())\r
- entry.put("type", "content");\r
- else\r
- entry.put("type", "comment");\r
- entry.put("browser", logEntry.getBrowserString());\r
-\r
- result.add(entry);\r
- }\r
-\r
- return result;\r
- }\r
- }\r
-\r
- public void logComment(String anIp, String anId, Date aTimeStamp, String aBrowser) {\r
- appendLog(new LogEntry(aTimeStamp, anIp, aBrowser, anId, false));\r
- }\r
-\r
- public void logArticle(String anIp, String anId, Date aTimeStamp, String aBrowser) {\r
- appendLog(new LogEntry(aTimeStamp, anIp, aBrowser, anId, true));\r
- }\r
-\r
- public void load() {\r
- try {\r
- ExtendedProperties configuration = new ExtendedProperties();\r
-\r
- try {\r
- configuration = new ExtendedProperties(configFile);\r
- }\r
- catch (FileNotFoundException e) {\r
- }\r
-\r
- getFilterConfig(filters, "abuse.filter", configuration);\r
-\r
- setOpenPostingDisabled(configuration.getString("abuse.openPostingDisabled", "0").equals("1"));\r
- setOpenPostingPassword(configuration.getString("abuse.openPostingPassword", "0").equals("1"));\r
- setCookieOnBlock(configuration.getString("abuse.cookieOnBlock", "0").equals("1"));\r
- setLogEnabled(configuration.getString("abuse.logEnabled", "0").equals("1"));\r
- setLogSize(configuration.getInt("abuse.logSize", 10));\r
- setArticleBlockAction(configuration.getString("abuse.articleBlockAction", ""));\r
- setCommentBlockAction(configuration.getString("abuse.commentBlockAction", ""));\r
- }\r
- catch (Throwable t) {\r
- throw new RuntimeException(t.toString());\r
- }\r
- }\r
- public void save() {\r
- try {\r
- ExtendedProperties configuration = new ExtendedProperties();\r
-\r
- setFilterConfig(filters, "abuse.filter", configuration);\r
-\r
- configuration.addProperty("abuse.openPostingDisabled", getOpenPostingDisabled()?"1":"0");\r
- configuration.addProperty("abuse.openPostingPassword", getOpenPostingPassword()?"1":"0");\r
- configuration.addProperty("abuse.cookieOnBlock", getCookieOnBlock()?"1":"0");\r
- configuration.addProperty("abuse.logEnabled", getLogEnabled()?"1":"0");\r
- configuration.addProperty("abuse.logSize", Integer.toString(getLogSize()));\r
- configuration.addProperty("abuse.articleBlockAction", getArticleBlockAction());\r
- configuration.addProperty("abuse.commentBlockAction", getCommentBlockAction());\r
-\r
- configuration.save(new FileOutputStream(new File(configFile)), "Anti abuse configuration");\r
- }\r
- catch (Throwable t) {\r
- throw new RuntimeException(t.toString());\r
- }\r
- }\r
-\r
- public List getFilterTypes() {\r
- List result = new Vector();\r
-\r
- Map entry = new HashMap();\r
- entry.put("resource", "ip");\r
- entry.put("id", IP_FILTER_TYPE);\r
- result.add(entry);\r
-\r
- entry = new HashMap();\r
- entry.put("resource", "regexp");\r
- entry.put("id", REGEXP_FILTER_TYPE);\r
- result.add(entry);\r
-\r
- return result;\r
- }\r
-\r
- public List getArticleActions() {\r
- try {\r
- List result = new Vector();\r
-\r
- Iterator i = MirGlobal.localizer().adminInterface().simpleArticleOperations().iterator();\r
- while (i.hasNext()) {\r
- MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation =\r
- (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next();\r
-\r
- Map action = new HashMap();\r
- action.put("resource", operation.getName());\r
- action.put("identifier", operation.getName());\r
-\r
- result.add(action);\r
- }\r
-\r
- return result;\r
- }\r
- catch (Throwable t) {\r
- throw new RuntimeException("can't get article actions");\r
- }\r
- }\r
-\r
- public List getCommentActions() {\r
- try {\r
- List result = new Vector();\r
-\r
- Iterator i = MirGlobal.localizer().adminInterface().simpleCommentOperations().iterator();\r
- while (i.hasNext()) {\r
- MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation =\r
- (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next();\r
-\r
- Map action = new HashMap();\r
- action.put("resource", operation.getName());\r
- action.put("identifier", operation.getName());\r
-\r
- result.add(action);\r
- }\r
-\r
- return result;\r
- }\r
- catch (Throwable t) {\r
- throw new RuntimeException("can't get comment actions");\r
- }\r
- }\r
-\r
- public List getFilters() {\r
- return getFiltersAsMaps(filters);\r
- }\r
-\r
- public void addFilter(String aType, String anExpression) {\r
- addFilter(filters, aType, anExpression);\r
- }\r
-\r
- public void setFilter(String anIdentifier, String aType, String anExpression) {\r
- setFilter(filters, anIdentifier, aType, anExpression);\r
- }\r
-\r
- public void deleteFilter(String anIdentifier) {\r
- deleteFilter(filters, anIdentifier);\r
- }\r
-\r
- public void validateIpFilter(String anIdentifier, String anArticleAction, String aCommentAction) throws Exception {\r
- }\r
-\r
- private List getFiltersAsMaps(List aFilters) {\r
- synchronized(aFilters) {\r
- List result = new Vector();\r
-\r
- Iterator i = aFilters.iterator();\r
- while (i.hasNext()) {\r
- Filter filter = (Filter) i.next();\r
- Map map = new HashMap();\r
-\r
- map.put("id", filter.getId());\r
- map.put("expression", filter.getExpression());\r
- map.put("type", filter.getType());\r
-\r
- result.add(map);\r
- }\r
- return result;\r
- }\r
- }\r
-\r
- private void addFilter(List aFilters, String aType, String anExpression) {\r
- Filter filter = new Filter();\r
-\r
- filter.setId(generateId());\r
- filter.setExpression(anExpression);\r
- filter.setType(aType);\r
-\r
- synchronized (aFilters) {\r
- aFilters.add(filter);\r
- }\r
- }\r
-\r
- private void setFilter(List aFilters, String anIdentifier, String aType, String anExpression) {\r
- synchronized (aFilters) {\r
- Filter filter = findFilter(aFilters, anIdentifier);\r
-\r
- if (filter!=null) {\r
- filter.setExpression(anExpression);\r
- filter.setType(aType);\r
- }\r
- }\r
- }\r
-\r
- private Filter findFilter(List aFilters, String anIdentifier) {\r
- synchronized (aFilters) {\r
- Iterator i = aFilters.iterator();\r
- while (i.hasNext()) {\r
- Filter filter = (Filter) i.next();\r
-\r
- if (filter.getId().equals(anIdentifier)) {\r
- return filter;\r
- }\r
- }\r
- }\r
-\r
- return null;\r
- }\r
-\r
- private void deleteFilter(List aFilters, String anIdentifier) {\r
- synchronized (aFilters) {\r
- Filter filter = findFilter(aFilters, anIdentifier);\r
-\r
- if (filter!=null) {\r
- aFilters.remove(filter);\r
- }\r
- }\r
- }\r
-\r
- private String generateId() {\r
- synchronized(this) {\r
- maxIdentifier = maxIdentifier+1;\r
-\r
- return Integer.toString(maxIdentifier);\r
- }\r
- }\r
-\r
- private static class Filter {\r
- private String identifier;\r
- private String expression;\r
- private String type;\r
-\r
- public Filter() {\r
- expression="";\r
- type="";\r
- identifier="";\r
- }\r
-\r
- public String getId() {\r
- return identifier;\r
- }\r
-\r
- public void setId(String anId) {\r
- identifier = anId;\r
- }\r
-\r
- public String getExpression() {\r
- return expression;\r
- }\r
-\r
- public void setExpression(String anExpression) {\r
- expression = anExpression;\r
- }\r
-\r
- public String getType() {\r
- return type;\r
- }\r
-\r
- public void setType(String aType) {\r
- type = aType;\r
- }\r
- }\r
-\r
- private void setFilterConfig(List aFilters, String aConfigKey, ExtendedProperties aConfiguration) {\r
- synchronized(aFilters) {\r
- Iterator i = aFilters.iterator();\r
-\r
- while (i.hasNext()) {\r
- Filter filter = (Filter) i.next();\r
-\r
- aConfiguration.addProperty(aConfigKey, filter.getType()+":"+filter.getExpression());\r
- }\r
- }\r
- }\r
-\r
- private void getFilterConfig(List aFilters, String aConfigKey, ExtendedProperties aConfiguration) {\r
- synchronized(aFilters) {\r
- aFilters.clear();\r
-\r
- Iterator i = Arrays.asList(aConfiguration.getStringArray(aConfigKey)).iterator();\r
-\r
- while (i.hasNext()) {\r
- String filter = (String) i.next();\r
- List parts = StringRoutines.separateString(filter, ":");\r
-\r
- if (parts.size()==2) {\r
- addFilter( (String) parts.get(0), (String) parts.get(1));\r
- }\r
- }\r
- }\r
- }\r
-\r
- private static class LogEntry {\r
- private String ipNumber;\r
- private String browserString;\r
- private String id;\r
- private Date timeStamp;\r
- private boolean isArticle;\r
-\r
- public LogEntry(Date aTimeStamp, String anIpNumber, String aBrowserString, String anId, boolean anIsArticle) {\r
- ipNumber = anIpNumber;\r
- browserString = aBrowserString;\r
- id = anId;\r
- isArticle = anIsArticle;\r
- timeStamp=aTimeStamp;\r
- }\r
-\r
- public String getIpNumber() {\r
- return ipNumber;\r
- }\r
-\r
- public String getBrowserString() {\r
- return browserString;\r
- }\r
-\r
- public String getId() {\r
- return id;\r
- }\r
-\r
- public Date getTimeStamp() {\r
- return timeStamp;\r
- }\r
-\r
- public boolean getIsArticle() {\r
- return isArticle;\r
- }\r
- }\r
-\r
- private void truncateLog() {\r
- synchronized(log) {\r
- if (!logEnabled)\r
- log.clear();\r
- else {\r
- while (log.size()>0 && log.size()>logSize) {\r
- log.remove(0);\r
- }\r
- }\r
- }\r
- };\r
-\r
- private void appendLog(LogEntry anEntry) {\r
- synchronized (log) {\r
- if (logEnabled) {\r
- log.add(anEntry);\r
- truncateLog();\r
- }\r
- }\r
- }\r
-\r
+import mircoders.localizer.MirAdminInterfaceLocalizer;
+
+import org.apache.commons.collections.ExtendedProperties;
+
+
+public class Abuse {
+ private List filters;
+ private int maxIdentifier;
+ private LoggerWrapper logger;
+ private int logSize;
+ private boolean logEnabled;
+ private boolean openPostingDisabled;
+ private boolean openPostingPassword;
+ private boolean cookieOnBlock;
+ private String articleBlockAction;
+ private String commentBlockAction;
+ private List log;
+ private String configFile = MirGlobal.config().getStringWithHome("Abuse.Config");
+
+
+ private static final String IP_FILTER_TYPE="ip";
+ private static final String REGEXP_FILTER_TYPE="regexp";
+ private static String cookieName=MirGlobal.config().getString("Abuse.CookieName");
+ private static int cookieMaxAge = 60*60*MirGlobal.config().getInt("Abuse.CookieMaxAge");
+
+ public Abuse() {
+ logger = new LoggerWrapper("Global.Abuse");
+ filters = new Vector();
+ maxIdentifier = 0;
+ log = new Vector();
+
+ logSize = 100;
+ logEnabled = false;
+ articleBlockAction = "";
+ commentBlockAction = "";
+ openPostingPassword = false;
+ openPostingDisabled = false;
+ cookieOnBlock = false;
+
+ load();
+ }
+
+ public boolean checkIpFilter(String anIpAddress) {
+ synchronized (filters) {
+ Iterator i = filters.iterator();
+
+ while (i.hasNext()) {
+ Filter filter = (Filter) i.next();
+
+ try {
+ if ( (filter.getType().equals(IP_FILTER_TYPE)) &&
+ InternetFunctions.isIpAddressInNetwork(anIpAddress, filter.getExpression())) {
+ logger.debug("ip match on " + filter.getExpression());
+ return true;
+ }
+ }
+ catch (Throwable t) {
+ logger.warn("error while checking ip address " + anIpAddress + " over network " + filter.expression + ": " + t.getMessage());
+ }
+ }
+
+ return false;
+ }
+ }
+
+ private boolean checkRegExpFilter(Entity anEntity) {
+ synchronized (filters) {
+ Iterator i = filters.iterator();
+
+ while (i.hasNext()) {
+ Filter filter = (Filter) i.next();
+
+ if (filter.getType().equals(REGEXP_FILTER_TYPE)) {
+ try {
+ RE regularExpression = new RE(filter.getExpression());
+
+ Iterator j = anEntity.getFields().iterator();
+ while (j.hasNext()) {
+ String field = anEntity.getValue( (String) j.next());
+
+ if (field != null && regularExpression.isMatch(field.toLowerCase())) {
+ logger.debug("regexp match on " + filter.getExpression());
+ return true;
+ }
+ }
+ }
+ catch (Throwable t) {
+ logger.warn("error while checking entity with regexp " + filter.getExpression() + ": " + t.getMessage());
+ }
+ }
+ }
+
+ return false;
+ }
+ }
+
+ private void setCookie(HttpServletResponse aResponse) {
+ Random random = new Random();
+
+ Cookie cookie = new Cookie(cookieName, Integer.toString(random.nextInt(1000000000)));
+ cookie.setMaxAge(cookieMaxAge);
+ cookie.setPath("/");
+
+ if (aResponse!=null)
+ aResponse.addCookie(cookie);
+ }
+
+ private boolean checkCookie(List aCookies) {
+ if (getCookieOnBlock()) {
+ Iterator i = aCookies.iterator();
+
+ while (i.hasNext()) {
+ Cookie cookie = (Cookie) i.next();
+
+ if (cookie.getName().equals(cookieName)) {
+ logger.debug("cookie match");
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ public void checkComment(EntityComment aComment, Request aRequest, HttpServletResponse aResponse) {
+ try {
+ long time = System.currentTimeMillis();
+ String address = "0.0.0.0";
+ String browser = "unknown";
+ Cookie[] cookies = {};
+
+ HttpServletRequest request = null;
+
+ if (aRequest instanceof HTTPAdapters.HTTPParsedRequestAdapter) {
+ request = ((HTTPAdapters.HTTPParsedRequestAdapter) aRequest).getRequest();
+ }
+ else if (aRequest instanceof HTTPAdapters.HTTPRequestAdapter) {
+ request = ((HTTPAdapters.HTTPRequestAdapter) aRequest).getRequest();
+ }
+ if (request!=null) {
+ browser = (String) request.getHeader("User-Agent");
+ address = request.getRemoteAddr();
+ cookies = request.getCookies();
+ }
+
+ logComment(address, aComment.getId(), new Date(), browser);
+
+ MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = MirGlobal.localizer().adminInterface().simpleCommentOperationForName(commentBlockAction);
+
+ if (checkCookie(Arrays.asList(cookies)) || checkIpFilter(address) || checkRegExpFilter(aComment)) {
+ operation.perform(null, MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter("comment", aComment));
+ setCookie(aResponse);
+ }
+
+ logger.info("checkComment: " + (System.currentTimeMillis()-time) + "ms");
+ }
+ catch (Throwable t) {
+ logger.error("Abuse.checkComment: " + t.toString());
+ }
+ }
+
+ public void checkArticle(EntityContent anArticle, HttpServletRequest aRequest, HttpServletResponse aResponse) {
+ try {
+ long time = System.currentTimeMillis();
+
+ logArticle(aRequest.getRemoteAddr(), anArticle.getId(), new Date(), (String) aRequest.getHeader("User-Agent"));
+
+ MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = MirGlobal.localizer().adminInterface().simpleCommentOperationForName(commentBlockAction);
+
+ if (checkCookie(Arrays.asList(aRequest.getCookies())) || checkIpFilter(aRequest.getRemoteAddr()) || checkRegExpFilter(anArticle)) {
+ operation.perform(null, MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter("content", anArticle));
+ setCookie(aResponse);
+ }
+
+ logger.info("checkArticle: " + (System.currentTimeMillis()-time) + "ms");
+ }
+ catch (Throwable t) {
+ logger.error("Abuse.checkArticle: " + t.toString());
+ }
+ }
+
+ public boolean getLogEnabled() {
+ return logEnabled;
+ }
+
+ public void setLogEnabled(boolean anEnabled) {
+ logEnabled = anEnabled;
+ truncateLog();
+ }
+
+ public int getLogSize() {
+ return logSize;
+ }
+
+ public void setLogSize(int aSize) {
+ logSize = aSize;
+ truncateLog();
+ }
+
+ public boolean getOpenPostingDisabled() {
+ return openPostingDisabled;
+ }
+
+ public void setOpenPostingDisabled(boolean anOpenPostingDisabled) {
+ openPostingDisabled = anOpenPostingDisabled;
+ }
+
+ public boolean getOpenPostingPassword() {
+ return openPostingPassword;
+ }
+
+ public void setOpenPostingPassword(boolean anOpenPostingPassword) {
+ openPostingPassword = anOpenPostingPassword;
+ }
+
+ public boolean getCookieOnBlock() {
+ return cookieOnBlock;
+ }
+
+ public void setCookieOnBlock(boolean aCookieOnBlock) {
+ cookieOnBlock = aCookieOnBlock;
+ }
+
+ public String getArticleBlockAction() {
+ return articleBlockAction;
+ }
+
+ public void setArticleBlockAction(String anAction) {
+ articleBlockAction = anAction;
+ }
+
+ public String getCommentBlockAction() {
+ return commentBlockAction;
+ }
+
+ public void setCommentBlockAction(String anAction) {
+ commentBlockAction = anAction;
+ }
+
+
+ public List getLog() {
+ synchronized(log) {
+ List result = new Vector();
+
+ Iterator i = log.iterator();
+ while (i.hasNext()) {
+ LogEntry logEntry = (LogEntry) i.next();
+ Map entry = new HashMap();
+
+ entry.put("ip", logEntry.getIpNumber());
+ entry.put("id", logEntry.getId());
+ entry.put("timestamp", new DateToMapAdapter(logEntry.getTimeStamp()));
+ if (logEntry.getIsArticle())
+ entry.put("type", "content");
+ else
+ entry.put("type", "comment");
+ entry.put("browser", logEntry.getBrowserString());
+
+ result.add(entry);
+ }
+
+ return result;
+ }
+ }
+
+ public void logComment(String anIp, String anId, Date aTimeStamp, String aBrowser) {
+ appendLog(new LogEntry(aTimeStamp, anIp, aBrowser, anId, false));
+ }
+
+ public void logArticle(String anIp, String anId, Date aTimeStamp, String aBrowser) {
+ appendLog(new LogEntry(aTimeStamp, anIp, aBrowser, anId, true));
+ }
+
+ public void load() {
+ try {
+ ExtendedProperties configuration = new ExtendedProperties();
+
+ try {
+ configuration = new ExtendedProperties(configFile);
+ }
+ catch (FileNotFoundException e) {
+ }
+
+ getFilterConfig(filters, "abuse.filter", configuration);
+
+ setOpenPostingDisabled(configuration.getString("abuse.openPostingDisabled", "0").equals("1"));
+ setOpenPostingPassword(configuration.getString("abuse.openPostingPassword", "0").equals("1"));
+ setCookieOnBlock(configuration.getString("abuse.cookieOnBlock", "0").equals("1"));
+ setLogEnabled(configuration.getString("abuse.logEnabled", "0").equals("1"));
+ setLogSize(configuration.getInt("abuse.logSize", 10));
+ setArticleBlockAction(configuration.getString("abuse.articleBlockAction", ""));
+ setCommentBlockAction(configuration.getString("abuse.commentBlockAction", ""));
+ }
+ catch (Throwable t) {
+ throw new RuntimeException(t.toString());
+ }
+ }
+ public void save() {
+ try {
+ ExtendedProperties configuration = new ExtendedProperties();
+
+ setFilterConfig(filters, "abuse.filter", configuration);
+
+ configuration.addProperty("abuse.openPostingDisabled", getOpenPostingDisabled()?"1":"0");
+ configuration.addProperty("abuse.openPostingPassword", getOpenPostingPassword()?"1":"0");
+ configuration.addProperty("abuse.cookieOnBlock", getCookieOnBlock()?"1":"0");
+ configuration.addProperty("abuse.logEnabled", getLogEnabled()?"1":"0");
+ configuration.addProperty("abuse.logSize", Integer.toString(getLogSize()));
+ configuration.addProperty("abuse.articleBlockAction", getArticleBlockAction());
+ configuration.addProperty("abuse.commentBlockAction", getCommentBlockAction());
+
+ configuration.save(new FileOutputStream(new File(configFile)), "Anti abuse configuration");
+ }
+ catch (Throwable t) {
+ throw new RuntimeException(t.toString());
+ }
+ }
+
+ public List getFilterTypes() {
+ List result = new Vector();
+
+ Map entry = new HashMap();
+ entry.put("resource", "ip");
+ entry.put("id", IP_FILTER_TYPE);
+ result.add(entry);
+
+ entry = new HashMap();
+ entry.put("resource", "regexp");
+ entry.put("id", REGEXP_FILTER_TYPE);
+ result.add(entry);
+
+ return result;
+ }
+
+ public List getArticleActions() {
+ try {
+ List result = new Vector();
+
+ Iterator i = MirGlobal.localizer().adminInterface().simpleArticleOperations().iterator();
+ while (i.hasNext()) {
+ MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation =
+ (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next();
+
+ Map action = new HashMap();
+ action.put("resource", operation.getName());
+ action.put("identifier", operation.getName());
+
+ result.add(action);
+ }
+
+ return result;
+ }
+ catch (Throwable t) {
+ throw new RuntimeException("can't get article actions");
+ }
+ }
+
+ public List getCommentActions() {
+ try {
+ List result = new Vector();
+
+ Iterator i = MirGlobal.localizer().adminInterface().simpleCommentOperations().iterator();
+ while (i.hasNext()) {
+ MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation =
+ (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next();
+
+ Map action = new HashMap();
+ action.put("resource", operation.getName());
+ action.put("identifier", operation.getName());
+
+ result.add(action);
+ }
+
+ return result;
+ }
+ catch (Throwable t) {
+ throw new RuntimeException("can't get comment actions");
+ }
+ }
+
+ public List getFilters() {
+ return getFiltersAsMaps(filters);
+ }
+
+ public void addFilter(String aType, String anExpression) {
+ addFilter(filters, aType, anExpression);
+ }
+
+ public void setFilter(String anIdentifier, String aType, String anExpression) {
+ setFilter(filters, anIdentifier, aType, anExpression);
+ }
+
+ public void deleteFilter(String anIdentifier) {
+ deleteFilter(filters, anIdentifier);
+ }
+
+ public void validateIpFilter(String anIdentifier, String anArticleAction, String aCommentAction) throws Exception {
+ }
+
+ private List getFiltersAsMaps(List aFilters) {
+ synchronized(aFilters) {
+ List result = new Vector();
+
+ Iterator i = aFilters.iterator();
+ while (i.hasNext()) {
+ Filter filter = (Filter) i.next();
+ Map map = new HashMap();
+
+ map.put("id", filter.getId());
+ map.put("expression", filter.getExpression());
+ map.put("type", filter.getType());
+
+ result.add(map);
+ }
+ return result;
+ }
+ }
+
+ private void addFilter(List aFilters, String aType, String anExpression) {
+ Filter filter = new Filter();
+
+ filter.setId(generateId());
+ filter.setExpression(anExpression);
+ filter.setType(aType);
+
+ synchronized (aFilters) {
+ aFilters.add(filter);
+ }
+ }
+
+ private void setFilter(List aFilters, String anIdentifier, String aType, String anExpression) {
+ synchronized (aFilters) {
+ Filter filter = findFilter(aFilters, anIdentifier);
+
+ if (filter!=null) {
+ filter.setExpression(anExpression);
+ filter.setType(aType);
+ }
+ }
+ }
+
+ private Filter findFilter(List aFilters, String anIdentifier) {
+ synchronized (aFilters) {
+ Iterator i = aFilters.iterator();
+ while (i.hasNext()) {
+ Filter filter = (Filter) i.next();
+
+ if (filter.getId().equals(anIdentifier)) {
+ return filter;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ private void deleteFilter(List aFilters, String anIdentifier) {
+ synchronized (aFilters) {
+ Filter filter = findFilter(aFilters, anIdentifier);
+
+ if (filter!=null) {
+ aFilters.remove(filter);
+ }
+ }
+ }
+
+ private String generateId() {
+ synchronized(this) {
+ maxIdentifier = maxIdentifier+1;
+
+ return Integer.toString(maxIdentifier);
+ }
+ }
+
+ private static class Filter {
+ private String identifier;
+ private String expression;
+ private String type;
+
+ public Filter() {
+ expression="";
+ type="";
+ identifier="";
+ }
+
+ public String getId() {
+ return identifier;
+ }
+
+ public void setId(String anId) {
+ identifier = anId;
+ }
+
+ public String getExpression() {
+ return expression;
+ }
+
+ public void setExpression(String anExpression) {
+ expression = anExpression;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String aType) {
+ type = aType;
+ }
+ }
+
+ private void setFilterConfig(List aFilters, String aConfigKey, ExtendedProperties aConfiguration) {
+ synchronized(aFilters) {
+ Iterator i = aFilters.iterator();
+
+ while (i.hasNext()) {
+ Filter filter = (Filter) i.next();
+
+ aConfiguration.addProperty(aConfigKey, filter.getType()+":"+filter.getExpression());
+ }
+ }
+ }
+
+ private void getFilterConfig(List aFilters, String aConfigKey, ExtendedProperties aConfiguration) {
+ synchronized(aFilters) {
+ aFilters.clear();
+
+ Iterator i = Arrays.asList(aConfiguration.getStringArray(aConfigKey)).iterator();
+
+ while (i.hasNext()) {
+ String filter = (String) i.next();
+ List parts = StringRoutines.separateString(filter, ":");
+
+ if (parts.size()==2) {
+ addFilter( (String) parts.get(0), (String) parts.get(1));
+ }
+ }
+ }
+ }
+
+ private static class LogEntry {
+ private String ipNumber;
+ private String browserString;
+ private String id;
+ private Date timeStamp;
+ private boolean isArticle;
+
+ public LogEntry(Date aTimeStamp, String anIpNumber, String aBrowserString, String anId, boolean anIsArticle) {
+ ipNumber = anIpNumber;
+ browserString = aBrowserString;
+ id = anId;
+ isArticle = anIsArticle;
+ timeStamp=aTimeStamp;
+ }
+
+ public String getIpNumber() {
+ return ipNumber;
+ }
+
+ public String getBrowserString() {
+ return browserString;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public Date getTimeStamp() {
+ return timeStamp;
+ }
+
+ public boolean getIsArticle() {
+ return isArticle;
+ }
+ }
+
+ private void truncateLog() {
+ synchronized(log) {
+ if (!logEnabled)
+ log.clear();
+ else {
+ while (log.size()>0 && log.size()>logSize) {
+ log.remove(0);
+ }
+ }
+ }
+ };
+
+ private void appendLog(LogEntry anEntry) {
+ synchronized (log) {
+ if (logEnabled) {
+ log.add(anEntry);
+ truncateLog();
+ }
+ }
+ }
+
}
\ No newline at end of file
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.global;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.global;
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two. You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries. If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so. If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.global;\r
-\r
-\r
-import java.util.HashMap;\r
-import java.util.LinkedList;\r
-import java.util.Map;\r
-\r
-import mir.config.MirPropertiesConfiguration;\r
-import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;\r
-import mir.log.LoggerWrapper;\r
-\r
-import mircoders.global.CacheKey;\r
-\r
-public class MRUCache {\r
- private Map cache;\r
- private LinkedList mruList;\r
- private int cacheMaxItems;\r
-\r
- private MirPropertiesConfiguration configuration;\r
- private LoggerWrapper logger;\r
- \r
-\r
-\r
- public MRUCache() {\r
- logger = new LoggerWrapper("Global.MRUCache");\r
- try {\r
- configuration = MirPropertiesConfiguration.instance();\r
- }\r
- catch (PropertiesConfigExc e) {\r
- throw new RuntimeException("Can't get configuration: " + e.getMessage());\r
- }\r
- cacheMaxItems=Integer.parseInt(configuration.getString("Global.Cache.Items"));\r
- cache = new HashMap();\r
- mruList= new LinkedList();\r
- \r
- }\r
-\r
- /**\r
- * Checks if the cache has an object with the specified key \r
- */\r
-\r
- public boolean hasObject(CacheKey aCacheKey) {\r
- synchronized (cache) {\r
- logger.info("MRUCache was this big : "+ mruList.size());\r
- return cache.containsKey(aCacheKey);\r
- }\r
- }\r
- \r
- /**\r
- * Stores an object in the cache by placing it at the top of the\r
- * list If the object is in the cache, it promotes it to the top of\r
- * the list. If the object is not in the cache, it adds it to the\r
- * top of the list, and then checks the max size of the cache versus\r
- * the new size to see if it needs to remove the last element from\r
- * the cache.\r
- */\r
-\r
- public void storeObject(CacheKey aCacheKey,Object data) {\r
- synchronized (cache) {\r
- if (! hasObject(aCacheKey)){\r
- // add to the cache\r
- cache.put(aCacheKey,data);\r
- if (mruList.size() >= cacheMaxItems){\r
- removeObject((CacheKey) mruList.getLast());\r
- }\r
- }\r
- mruList.remove(aCacheKey);\r
- mruList.addFirst(aCacheKey);\r
- }\r
- } \r
- \r
- public void removeObject(CacheKey aCacheKey){\r
- synchronized (cache) {\r
- mruList.remove(aCacheKey);\r
- cache.remove(aCacheKey);\r
- }\r
- }\r
- \r
- /**\r
- * Moves requested item to front of cache\r
- */\r
-\r
- public Object getObject(CacheKey aCacheKey){\r
- synchronized (cache) {\r
- mruList.remove(aCacheKey);\r
- mruList.addFirst(aCacheKey);\r
- return cache.get(aCacheKey);\r
- }\r
- }\r
-}\r
-\r
-\r
-\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+package mircoders.global;
+
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Map;
+
+import mir.config.MirPropertiesConfiguration;
+import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;
+import mir.log.LoggerWrapper;
+
+public class MRUCache {
+ private Map cache;
+ private LinkedList mruList;
+ private int cacheMaxItems;
+
+ private MirPropertiesConfiguration configuration;
+ private LoggerWrapper logger;
+
+
+
+ public MRUCache() {
+ logger = new LoggerWrapper("Global.MRUCache");
+ try {
+ configuration = MirPropertiesConfiguration.instance();
+ }
+ catch (PropertiesConfigExc e) {
+ throw new RuntimeException("Can't get configuration: " + e.getMessage());
+ }
+ cacheMaxItems=Integer.parseInt(configuration.getString("Global.Cache.Items"));
+ cache = new HashMap();
+ mruList= new LinkedList();
+
+ }
+
+ /**
+ * Checks if the cache has an object with the specified key
+ */
+
+ public boolean hasObject(CacheKey aCacheKey) {
+ synchronized (cache) {
+ logger.info("MRUCache was this big : "+ mruList.size());
+ return cache.containsKey(aCacheKey);
+ }
+ }
+
+ /**
+ * Stores an object in the cache by placing it at the top of the
+ * list If the object is in the cache, it promotes it to the top of
+ * the list. If the object is not in the cache, it adds it to the
+ * top of the list, and then checks the max size of the cache versus
+ * the new size to see if it needs to remove the last element from
+ * the cache.
+ */
+
+ public void storeObject(CacheKey aCacheKey,Object data) {
+ synchronized (cache) {
+ if (! hasObject(aCacheKey)){
+ // add to the cache
+ cache.put(aCacheKey,data);
+ if (mruList.size() >= cacheMaxItems){
+ removeObject((CacheKey) mruList.getLast());
+ }
+ }
+ mruList.remove(aCacheKey);
+ mruList.addFirst(aCacheKey);
+ }
+ }
+
+ public void removeObject(CacheKey aCacheKey){
+ synchronized (cache) {
+ mruList.remove(aCacheKey);
+ cache.remove(aCacheKey);
+ }
+ }
+
+ /**
+ * Moves requested item to front of cache
+ */
+
+ public Object getObject(CacheKey aCacheKey){
+ synchronized (cache) {
+ mruList.remove(aCacheKey);
+ mruList.addFirst(aCacheKey);
+ return cache.get(aCacheKey);
+ }
+ }
+}
+
+
+
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.global;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.global;
import java.io.PrintWriter;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.localizer;
import java.util.List;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.localizer;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.localizer;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.localizer;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.localizer;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.localizer;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.localizer;
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two. You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries. If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so. If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.localizer;\r
-\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+package mircoders.localizer;
+
import mir.session.Request;
import mir.session.Session;
import mir.session.SessionHandler;
import mircoders.entity.EntityComment;
-import mircoders.entity.EntityContent;\r
-\r
-public interface MirOpenPostingLocalizer {\r
-\r
- /**\r
- * Class to encapsulate a validation error\r
- *\r
- * <p>Title: </p>\r
- * <p>Description: </p>\r
- * <p>Copyright: Copyright (c) 2003</p>\r
- * <p>Company: </p>\r
- * @author not attributable\r
- * @version 1.0\r
- */\r
-\r
- /**\r
- *\r
- * @param aRequest\r
- * @param aSession\r
- * @return\r
- * @throws MirLocalizerExc\r
- * @throws MirLocalizerFailure\r
- */\r
- public SessionHandler getOpenSessionHandler(Request aRequest, Session aSession) throws MirLocalizerExc, MirLocalizerFailure;\r
-\r
- /**\r
- *\r
- * @param aComment\r
- * @throws MirLocalizerExc\r
- * @throws MirLocalizerFailure\r
- */\r
- public void afterCommentPosting(EntityComment aComment) throws MirLocalizerExc, MirLocalizerFailure;\r
-\r
- /**\r
- *\r
- * @param aContent\r
- * @throws MirLocalizerExc\r
- * @throws MirLocalizerFailure\r
- */\r
- public void afterContentPosting(EntityContent aContent) throws MirLocalizerExc, MirLocalizerFailure;\r
-}\r
+import mircoders.entity.EntityContent;
+
+public interface MirOpenPostingLocalizer {
+
+ /**
+ * Class to encapsulate a validation error
+ *
+ * <p>Title: </p>
+ * <p>Description: </p>
+ * <p>Copyright: Copyright (c) 2003</p>
+ * <p>Company: </p>
+ * @author not attributable
+ * @version 1.0
+ */
+
+ /**
+ *
+ * @param aRequest
+ * @param aSession
+ * @return
+ * @throws MirLocalizerExc
+ * @throws MirLocalizerFailure
+ */
+ public SessionHandler getOpenSessionHandler(Request aRequest, Session aSession) throws MirLocalizerExc, MirLocalizerFailure;
+
+ /**
+ *
+ * @param aComment
+ * @throws MirLocalizerExc
+ * @throws MirLocalizerFailure
+ */
+ public void afterCommentPosting(EntityComment aComment) throws MirLocalizerExc, MirLocalizerFailure;
+
+ /**
+ *
+ * @param aContent
+ * @throws MirLocalizerExc
+ * @throws MirLocalizerFailure
+ */
+ public void afterContentPosting(EntityContent aContent) throws MirLocalizerExc, MirLocalizerFailure;
+}
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.localizer;
import java.util.Map;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.localizer;
import java.util.List;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.localizer.basic;
import java.text.SimpleDateFormat;
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two. You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries. If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so. If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.localizer.basic;\r
-\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+package mircoders.localizer.basic;
+
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import mircoders.module.ModuleComment;
import mircoders.storage.DatabaseComment;
import mircoders.storage.DatabaseCommentToMedia;
-import mircoders.storage.DatabaseContent;\r
-\r
-/**\r
- *\r
- * <p>Title: Experimental session handler for comment postings </p>\r
- * <p>Description: </p>\r
- * <p>Copyright: Copyright (c) 2003</p>\r
- * <p>Company: </p>\r
- * @author not attributable\r
- * @version 1.0\r
- */\r
-\r
-public class MirBasicCommentPostingSessionHandler extends MirBasicPostingSessionHandler {\r
- protected ModuleComment commentModule;\r
- protected DatabaseCommentToMedia commentToMedia = DatabaseCommentToMedia.getInstance();\r
-\r
- public MirBasicCommentPostingSessionHandler() {\r
- super();\r
-\r
- commentModule= new ModuleComment(DatabaseComment.getInstance());\r
- }\r
-\r
- public void processRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure {\r
- if (aSession.getAttribute("initialRequest")==null) {\r
- initialRequest(aRequest, aSession, aResponse);\r
- aSession.setAttribute("initialRequest", "no");\r
- }\r
- else {\r
- subsequentRequest(aRequest, aSession, aResponse);\r
- }\r
- };\r
-\r
- protected void initializeResponseData(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure {\r
- super.initializeResponseData(aRequest, aSession, aResponse);\r
-\r
- Iterator i = DatabaseComment.getInstance().getFields().iterator();\r
- while (i.hasNext()) {\r
- String field = (String) i.next();\r
- aResponse.setResponseValue(field, aRequest.getParameter(field));\r
- }\r
-\r
- };\r
-\r
- public void initialRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure{\r
- super.initialRequest(aRequest, aSession, aResponse);\r
-\r
- String articleId = aRequest.getParameter("to_media");\r
- if (articleId == null)\r
- throw new SessionExc("MirBasicCommentPostingSessionHandler.initialRequest: article id not set!");\r
- aSession.setAttribute("to_media", articleId);\r
-\r
- aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate"));\r
- }\r
-\r
- public List validate(Request aRequest, Session aSession) throws SessionExc, SessionFailure {\r
- List result = new Vector();\r
-\r
- testFieldEntered(aRequest, "title", "validationerror.missing", result);\r
- testFieldEntered(aRequest, "description", "validationerror.missing", result);\r
- testFieldEntered(aRequest, "creator", "validationerror.missing", result);\r
-\r
- return result;\r
- }\r
-\r
- public void subsequentRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure {\r
- try {\r
- initializeResponseData(aRequest, aSession, aResponse);\r
-\r
- List validationErrors = validate(aRequest, aSession);\r
-\r
- if (validationErrors != null && validationErrors.size()>0) {\r
- returnValidationErrors(aRequest, aSession, aResponse, validationErrors);\r
- }\r
- else {\r
- EntityComment comment = (EntityComment) commentModule.createNew ();\r
- Iterator i = DatabaseComment.getInstance().getFields().iterator();\r
-// comment.setValues(commentFields);\r
-\r
- finishComment(aRequest, aSession, comment);\r
-\r
- String id = comment.insert();\r
- if(id==null){\r
- afterDuplicateCommentPosting(aRequest, aSession, aResponse, comment);\r
- logger.info("Dupe comment rejected");\r
- aSession.terminate();\r
- }\r
- else {\r
- i = aRequest.getUploadedFiles().iterator();\r
- while (i.hasNext()) {\r
- UploadedFile file = (UploadedFile) i.next();\r
- processMediaFile(aRequest, aSession, comment, file);\r
- }\r
-\r
- afterCommentPosting(aRequest, aSession, aResponse, comment);\r
- MirGlobal.abuse().checkComment(comment, aRequest, null);\r
- MirGlobal.localizer().openPostings().afterCommentPosting(comment);\r
- logger.info("Comment posted");\r
- aSession.terminate();\r
- }\r
- }\r
- }\r
- catch (Throwable t) {\r
- ExceptionFunctions.traceCauseException(t).printStackTrace();\r
-\r
- throw new SessionFailure("MirBasicCommentPostingSessionHandler.subsequentRequest: " + t.getMessage(), t);\r
- }\r
- }\r
-\r
- public void initializeCommentPosting(Request aRequest, Session aSession, Response aResponse) throws SessionFailure, SessionExc {\r
- String articleId = aRequest.getParameter("to_media");\r
- if (articleId==null)\r
- articleId = aRequest.getParameter("aid");\r
-\r
- if (articleId==null)\r
- throw new SessionExc("initializeCommentPosting: article id not set!");\r
-\r
- aSession.setAttribute("to_media", articleId);\r
- processCommentPosting(aRequest, aSession, aResponse);\r
- };\r
-\r
- public void returnValidationErrors(Request aRequest, Session aSession, Response aResponse, List aValidationErrors) throws SessionFailure, SessionExc {\r
- aResponse.setResponseValue("errors", aValidationErrors);\r
- aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate"));\r
- };\r
-\r
- public void processCommentPosting(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure {\r
- if (MirGlobal.abuse().getOpenPostingPassword()) {\r
- String password = generateOnetimePassword();\r
- aSession.setAttribute("password", password);\r
- aResponse.setResponseValue("password", password);\r
- aResponse.setResponseValue("passwd", password);\r
- }\r
- else {\r
- aResponse.setResponseValue("password", null);\r
- }\r
-\r
- aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate"));\r
- };\r
-\r
- public void processMediaFile(Request aRequest, Session aSession, EntityComment aComment, UploadedFile aFile) throws SessionExc, SessionFailure {\r
- try {\r
- Entity mediaItem = MediaUploadProcessor.processMediaUpload(aFile, new HashMap());\r
- finishMedia(aRequest, aSession, aFile, mediaItem);\r
- mediaItem.update();\r
- commentToMedia.addMedia(aComment.getId(), mediaItem.getId());\r
- }\r
- catch (Throwable t) {\r
- throw new SessionFailure(t);\r
- }\r
- }\r
-\r
- public void finishMedia(Request aRequest, Session aSession, UploadedFile aFile, Entity aMedia) throws SessionExc, SessionFailure {\r
- }\r
-\r
- public void finishComment(Request aRequest, Session aSession, EntityComment aComment) throws SessionExc, SessionFailure {\r
- if (aSession.getAttribute("to_media") == null)\r
- throw new SessionExc("missing to_media");\r
-\r
- aComment.setValueForProperty("is_published", "1");\r
- aComment.setValueForProperty("to_comment_status", "1");\r
- aComment.setValueForProperty("is_html","0");\r
- aComment.setValueForProperty("to_media", (String) aSession.getAttribute("to_media"));\r
- };\r
-\r
- public void addMedia(Request aRequest, Session aSession, EntityComment aComment) throws SessionExc, SessionFailure {\r
- }\r
-\r
- public void afterCommentPosting(Request aRequest, Session aSession, Response aResponse, EntityComment aComment) {\r
- DatabaseContent.getInstance().setUnproduced("id=" + aComment.getValue("to_media"));\r
- aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.DoneTemplate"));\r
- };\r
-\r
- public void afterDuplicateCommentPosting(Request aRequest, Session aSession, Response aResponse, EntityComment aComment) {\r
- aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.DupeTemplate"));\r
- };\r
-\r
- public class ValidationError {\r
- private String field;\r
- private String message;\r
- private List parameters;\r
-\r
- public ValidationError(String aField, String aMessage) {\r
- this (aField, aMessage, new String[] {});\r
- }\r
-\r
- public ValidationError(String aField, String aMessage, Object aParameter) {\r
- this (aField, aMessage, new Object[] {aParameter});\r
- }\r
-\r
- public ValidationError(String aField, String aMessage, Object[] aParameters) {\r
- field = aField;\r
- message = aMessage;\r
- parameters = Arrays.asList(aParameters);\r
- }\r
-\r
- public String getMessage() {\r
- return message;\r
- }\r
-\r
- public String getField() {\r
- return field;\r
- }\r
-\r
- public List getParameters() {\r
- return parameters;\r
- }\r
- }\r
-\r
-\r
-\r
+import mircoders.storage.DatabaseContent;
+
+/**
+ *
+ * <p>Title: Experimental session handler for comment postings </p>
+ * <p>Description: </p>
+ * <p>Copyright: Copyright (c) 2003</p>
+ * <p>Company: </p>
+ * @author not attributable
+ * @version 1.0
+ */
+
+public class MirBasicCommentPostingSessionHandler extends MirBasicPostingSessionHandler {
+ protected ModuleComment commentModule;
+ protected DatabaseCommentToMedia commentToMedia = DatabaseCommentToMedia.getInstance();
+
+ public MirBasicCommentPostingSessionHandler() {
+ super();
+
+ commentModule= new ModuleComment(DatabaseComment.getInstance());
+ }
+
+ public void processRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure {
+ if (aSession.getAttribute("initialRequest")==null) {
+ initialRequest(aRequest, aSession, aResponse);
+ aSession.setAttribute("initialRequest", "no");
+ }
+ else {
+ subsequentRequest(aRequest, aSession, aResponse);
+ }
+ };
+
+ protected void initializeResponseData(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure {
+ super.initializeResponseData(aRequest, aSession, aResponse);
+
+ Iterator i = DatabaseComment.getInstance().getFields().iterator();
+ while (i.hasNext()) {
+ String field = (String) i.next();
+ aResponse.setResponseValue(field, aRequest.getParameter(field));
+ }
+
+ };
+
+ public void initialRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure{
+ super.initialRequest(aRequest, aSession, aResponse);
+
+ String articleId = aRequest.getParameter("to_media");
+ if (articleId == null)
+ throw new SessionExc("MirBasicCommentPostingSessionHandler.initialRequest: article id not set!");
+ aSession.setAttribute("to_media", articleId);
+
+ aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate"));
+ }
+
+ public List validate(Request aRequest, Session aSession) throws SessionExc, SessionFailure {
+ List result = new Vector();
+
+ testFieldEntered(aRequest, "title", "validationerror.missing", result);
+ testFieldEntered(aRequest, "description", "validationerror.missing", result);
+ testFieldEntered(aRequest, "creator", "validationerror.missing", result);
+
+ return result;
+ }
+
+ public void subsequentRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure {
+ try {
+ initializeResponseData(aRequest, aSession, aResponse);
+
+ List validationErrors = validate(aRequest, aSession);
+
+ if (validationErrors != null && validationErrors.size()>0) {
+ returnValidationErrors(aRequest, aSession, aResponse, validationErrors);
+ }
+ else {
+ EntityComment comment = (EntityComment) commentModule.createNew ();
+ Iterator i = DatabaseComment.getInstance().getFields().iterator();
+// comment.setValues(commentFields);
+
+ finishComment(aRequest, aSession, comment);
+
+ String id = comment.insert();
+ if(id==null){
+ afterDuplicateCommentPosting(aRequest, aSession, aResponse, comment);
+ logger.info("Dupe comment rejected");
+ aSession.terminate();
+ }
+ else {
+ i = aRequest.getUploadedFiles().iterator();
+ while (i.hasNext()) {
+ UploadedFile file = (UploadedFile) i.next();
+ processMediaFile(aRequest, aSession, comment, file);
+ }
+
+ afterCommentPosting(aRequest, aSession, aResponse, comment);
+ MirGlobal.abuse().checkComment(comment, aRequest, null);
+ MirGlobal.localizer().openPostings().afterCommentPosting(comment);
+ logger.info("Comment posted");
+ aSession.terminate();
+ }
+ }
+ }
+ catch (Throwable t) {
+ ExceptionFunctions.traceCauseException(t).printStackTrace();
+
+ throw new SessionFailure("MirBasicCommentPostingSessionHandler.subsequentRequest: " + t.getMessage(), t);
+ }
+ }
+
+ public void initializeCommentPosting(Request aRequest, Session aSession, Response aResponse) throws SessionFailure, SessionExc {
+ String articleId = aRequest.getParameter("to_media");
+ if (articleId==null)
+ articleId = aRequest.getParameter("aid");
+
+ if (articleId==null)
+ throw new SessionExc("initializeCommentPosting: article id not set!");
+
+ aSession.setAttribute("to_media", articleId);
+ processCommentPosting(aRequest, aSession, aResponse);
+ };
+
+ public void returnValidationErrors(Request aRequest, Session aSession, Response aResponse, List aValidationErrors) throws SessionFailure, SessionExc {
+ aResponse.setResponseValue("errors", aValidationErrors);
+ aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate"));
+ };
+
+ public void processCommentPosting(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure {
+ if (MirGlobal.abuse().getOpenPostingPassword()) {
+ String password = generateOnetimePassword();
+ aSession.setAttribute("password", password);
+ aResponse.setResponseValue("password", password);
+ aResponse.setResponseValue("passwd", password);
+ }
+ else {
+ aResponse.setResponseValue("password", null);
+ }
+
+ aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate"));
+ };
+
+ public void processMediaFile(Request aRequest, Session aSession, EntityComment aComment, UploadedFile aFile) throws SessionExc, SessionFailure {
+ try {
+ Entity mediaItem = MediaUploadProcessor.processMediaUpload(aFile, new HashMap());
+ finishMedia(aRequest, aSession, aFile, mediaItem);
+ mediaItem.update();
+ commentToMedia.addMedia(aComment.getId(), mediaItem.getId());
+ }
+ catch (Throwable t) {
+ throw new SessionFailure(t);
+ }
+ }
+
+ public void finishMedia(Request aRequest, Session aSession, UploadedFile aFile, Entity aMedia) throws SessionExc, SessionFailure {
+ }
+
+ public void finishComment(Request aRequest, Session aSession, EntityComment aComment) throws SessionExc, SessionFailure {
+ if (aSession.getAttribute("to_media") == null)
+ throw new SessionExc("missing to_media");
+
+ aComment.setValueForProperty("is_published", "1");
+ aComment.setValueForProperty("to_comment_status", "1");
+ aComment.setValueForProperty("is_html","0");
+ aComment.setValueForProperty("to_media", (String) aSession.getAttribute("to_media"));
+ };
+
+ public void addMedia(Request aRequest, Session aSession, EntityComment aComment) throws SessionExc, SessionFailure {
+ }
+
+ public void afterCommentPosting(Request aRequest, Session aSession, Response aResponse, EntityComment aComment) {
+ DatabaseContent.getInstance().setUnproduced("id=" + aComment.getValue("to_media"));
+ aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.DoneTemplate"));
+ };
+
+ public void afterDuplicateCommentPosting(Request aRequest, Session aSession, Response aResponse, EntityComment aComment) {
+ aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.DupeTemplate"));
+ };
+
+ public class ValidationError {
+ private String field;
+ private String message;
+ private List parameters;
+
+ public ValidationError(String aField, String aMessage) {
+ this (aField, aMessage, new String[] {});
+ }
+
+ public ValidationError(String aField, String aMessage, Object aParameter) {
+ this (aField, aMessage, new Object[] {aParameter});
+ }
+
+ public ValidationError(String aField, String aMessage, Object[] aParameters) {
+ field = aField;
+ message = aMessage;
+ parameters = Arrays.asList(aParameters);
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public String getField() {
+ return field;
+ }
+
+ public List getParameters() {
+ return parameters;
+ }
+ }
+
+
+
}
\ No newline at end of file
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.localizer.basic;
-import java.util.HashMap;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Vector;\r
-\r
-import mir.config.MirPropertiesConfiguration;\r
-import mir.entity.Entity;\r
-import mir.entity.adapter.EntityAdapter;\r
-import mir.entity.adapter.EntityAdapterDefinition;\r
-import mir.entity.adapter.EntityAdapterModel;\r
-import mir.log.LoggerWrapper;\r
-import mir.media.MediaHelper;\r
-import mir.media.MirMedia;\r
-import mir.util.ParameterExpander;\r
-import mir.util.RewindableIterator;\r
-import mircoders.entity.EntityUploadedMedia;\r
-import mircoders.global.MirGlobal;\r
-import mircoders.localizer.MirAdminInterfaceLocalizer;\r
-import mircoders.localizer.MirDataModelLocalizer;\r
-import mircoders.localizer.MirLocalizerExc;\r
-import mircoders.localizer.MirLocalizerFailure;\r
-import mircoders.storage.DatabaseArticleType;\r
-import mircoders.storage.DatabaseAudio;\r
-import mircoders.storage.DatabaseBreaking;\r
-import mircoders.storage.DatabaseComment;\r
-import mircoders.storage.DatabaseCommentStatus;\r
-import mircoders.storage.DatabaseContent;\r
-import mircoders.storage.DatabaseImageType;\r
-import mircoders.storage.DatabaseImages;\r
-import mircoders.storage.DatabaseLanguage;\r
-import mircoders.storage.DatabaseMedia;\r
-import mircoders.storage.DatabaseMediaType;\r
-import mircoders.storage.DatabaseMediafolder;\r
-import mircoders.storage.DatabaseMessages;\r
-import mircoders.storage.DatabaseOther;\r
-import mircoders.storage.DatabaseTopics;\r
-import mircoders.storage.DatabaseUploadedMedia;\r
-import mircoders.storage.DatabaseUsers;\r
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import mir.config.MirPropertiesConfiguration;
+import mir.entity.Entity;
+import mir.entity.adapter.EntityAdapter;
+import mir.entity.adapter.EntityAdapterDefinition;
+import mir.entity.adapter.EntityAdapterModel;
+import mir.log.LoggerWrapper;
+import mir.media.MediaHelper;
+import mir.media.MirMedia;
+import mir.util.ParameterExpander;
+import mir.util.RewindableIterator;
+import mircoders.entity.EntityUploadedMedia;
+import mircoders.global.MirGlobal;
+import mircoders.localizer.MirAdminInterfaceLocalizer;
+import mircoders.localizer.MirDataModelLocalizer;
+import mircoders.localizer.MirLocalizerExc;
+import mircoders.localizer.MirLocalizerFailure;
+import mircoders.storage.DatabaseArticleType;
+import mircoders.storage.DatabaseAudio;
+import mircoders.storage.DatabaseBreaking;
+import mircoders.storage.DatabaseComment;
+import mircoders.storage.DatabaseCommentStatus;
+import mircoders.storage.DatabaseContent;
+import mircoders.storage.DatabaseImageType;
+import mircoders.storage.DatabaseImages;
+import mircoders.storage.DatabaseLanguage;
+import mircoders.storage.DatabaseMedia;
+import mircoders.storage.DatabaseMediaType;
+import mircoders.storage.DatabaseMediafolder;
+import mircoders.storage.DatabaseMessages;
+import mircoders.storage.DatabaseOther;
+import mircoders.storage.DatabaseTopics;
+import mircoders.storage.DatabaseUploadedMedia;
+import mircoders.storage.DatabaseUsers;
import mircoders.storage.DatabaseVideo;
public class MirBasicDataModelLocalizer implements MirDataModelLocalizer {
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.localizer.basic;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.localizer.basic;
import mircoders.localizer.MirAdminInterfaceLocalizer;
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two. You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries. If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so. If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.localizer.basic;\r
-\r
-import java.util.List;\r
-import java.util.Random;\r
-\r
-import mir.config.MirPropertiesConfiguration;\r
-import mir.log.LoggerWrapper;\r
-import mir.session.Request;\r
-import mir.session.Session;\r
-import mir.session.SessionHandler;\r
-import mircoders.entity.EntityComment;\r
-import mircoders.entity.EntityContent;\r
-import mircoders.global.MirGlobal;\r
-import mircoders.global.ProducerEngine;\r
-import mircoders.localizer.MirLocalizerExc;\r
-import mircoders.localizer.MirLocalizerFailure;\r
-import mircoders.localizer.MirOpenPostingLocalizer;\r
-\r
-public class MirBasicOpenPostingLocalizer implements MirOpenPostingLocalizer {\r
- private List afterContentProducerTasks;\r
- private List afterCommentProducerTasks;\r
- protected LoggerWrapper logger;\r
- protected MirPropertiesConfiguration configuration;\r
-\r
-\r
- public MirBasicOpenPostingLocalizer() throws MirLocalizerExc, MirLocalizerFailure {\r
- logger = new LoggerWrapper("Localizer.Basic.OpenPosting");\r
-\r
- try {\r
- configuration = MirPropertiesConfiguration.instance();\r
- }\r
- catch (Throwable e) {\r
- throw new MirLocalizerFailure("Can't get configuration: " + e.getMessage(), e);\r
- }\r
-\r
- try {\r
- String contentProducers = MirGlobal.config().getString("Mir.Localizer.OpenPosting.ContentProducers");\r
- String commentProducers = MirGlobal.config().getString("Mir.Localizer.OpenPosting.CommentProducers");\r
-\r
- afterContentProducerTasks = ProducerEngine.ProducerTask.parseProducerTaskList(contentProducers);\r
- afterCommentProducerTasks = ProducerEngine.ProducerTask.parseProducerTaskList(commentProducers);\r
- }\r
- catch (Throwable t) {\r
- logger.error("Setting up MirBasicOpenPostingLocalizer failed: " + t.getMessage());\r
-\r
- throw new MirLocalizerFailure(t);\r
- }\r
- }\r
-\r
- public SessionHandler getOpenSessionHandler(Request aRequest, Session aSession) throws MirLocalizerExc, MirLocalizerFailure {\r
- if (aSession.getAttribute("handler")==null)\r
- aSession.setAttribute("handler", new MirBasicCommentPostingSessionHandler());\r
-\r
- return (SessionHandler) aSession.getAttribute("handler");\r
- }\r
-\r
- public void afterContentPosting() {\r
- MirGlobal.producerEngine().addTasks(afterContentProducerTasks);\r
- }\r
-\r
- public void afterContentPosting(EntityContent aContent) {\r
- afterContentPosting();\r
- }\r
-\r
- public void afterCommentPosting(EntityComment aComment) {\r
- afterCommentPosting();\r
- }\r
-\r
- public void afterCommentPosting() {\r
- MirGlobal.producerEngine().addTasks(afterCommentProducerTasks);\r
- }\r
-\r
- public String generateOnetimePassword() {\r
- Random r = new Random();\r
- int random = r.nextInt();\r
-\r
- long l = System.currentTimeMillis();\r
-\r
- l = (l*l*l*l)/random;\r
- if (l<0)\r
- l = l * -1;\r
-\r
- String returnString = ""+l;\r
-\r
- return returnString.substring(5);\r
- }\r
-\r
-}\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+package mircoders.localizer.basic;
+
+import java.util.List;
+import java.util.Random;
+
+import mir.config.MirPropertiesConfiguration;
+import mir.log.LoggerWrapper;
+import mir.session.Request;
+import mir.session.Session;
+import mir.session.SessionHandler;
+import mircoders.entity.EntityComment;
+import mircoders.entity.EntityContent;
+import mircoders.global.MirGlobal;
+import mircoders.global.ProducerEngine;
+import mircoders.localizer.MirLocalizerExc;
+import mircoders.localizer.MirLocalizerFailure;
+import mircoders.localizer.MirOpenPostingLocalizer;
+
+public class MirBasicOpenPostingLocalizer implements MirOpenPostingLocalizer {
+ private List afterContentProducerTasks;
+ private List afterCommentProducerTasks;
+ protected LoggerWrapper logger;
+ protected MirPropertiesConfiguration configuration;
+
+
+ public MirBasicOpenPostingLocalizer() throws MirLocalizerExc, MirLocalizerFailure {
+ logger = new LoggerWrapper("Localizer.Basic.OpenPosting");
+
+ try {
+ configuration = MirPropertiesConfiguration.instance();
+ }
+ catch (Throwable e) {
+ throw new MirLocalizerFailure("Can't get configuration: " + e.getMessage(), e);
+ }
+
+ try {
+ String contentProducers = MirGlobal.config().getString("Mir.Localizer.OpenPosting.ContentProducers");
+ String commentProducers = MirGlobal.config().getString("Mir.Localizer.OpenPosting.CommentProducers");
+
+ afterContentProducerTasks = ProducerEngine.ProducerTask.parseProducerTaskList(contentProducers);
+ afterCommentProducerTasks = ProducerEngine.ProducerTask.parseProducerTaskList(commentProducers);
+ }
+ catch (Throwable t) {
+ logger.error("Setting up MirBasicOpenPostingLocalizer failed: " + t.getMessage());
+
+ throw new MirLocalizerFailure(t);
+ }
+ }
+
+ public SessionHandler getOpenSessionHandler(Request aRequest, Session aSession) throws MirLocalizerExc, MirLocalizerFailure {
+ if (aSession.getAttribute("handler")==null)
+ aSession.setAttribute("handler", new MirBasicCommentPostingSessionHandler());
+
+ return (SessionHandler) aSession.getAttribute("handler");
+ }
+
+ public void afterContentPosting() {
+ MirGlobal.producerEngine().addTasks(afterContentProducerTasks);
+ }
+
+ public void afterContentPosting(EntityContent aContent) {
+ afterContentPosting();
+ }
+
+ public void afterCommentPosting(EntityComment aComment) {
+ afterCommentPosting();
+ }
+
+ public void afterCommentPosting() {
+ MirGlobal.producerEngine().addTasks(afterCommentProducerTasks);
+ }
+
+ public String generateOnetimePassword() {
+ Random r = new Random();
+ int random = r.nextInt();
+
+ long l = System.currentTimeMillis();
+
+ l = (l*l*l*l)/random;
+ if (l<0)
+ l = l * -1;
+
+ String returnString = ""+l;
+
+ return returnString.substring(5);
+ }
+
+}
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two. You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries. If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so. If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.localizer.basic;\r
-\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+package mircoders.localizer.basic;
+
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import mircoders.module.ModuleComment;
import mircoders.storage.DatabaseComment;
import mircoders.storage.DatabaseCommentToMedia;
-import mircoders.storage.DatabaseContent;\r
-\r
-/**\r
- *\r
- * <p>Title: Experimental session handler for comment postings </p>\r
- * <p>Description: </p>\r
- * <p>Copyright: Copyright (c) 2003</p>\r
- * <p>Company: </p>\r
- * @author not attributable\r
- * @version 1.0\r
- */\r
-\r
-public class MirBasicPostingSessionHandler implements SessionHandler {\r
- protected LoggerWrapper logger;\r
- protected MirPropertiesConfiguration configuration;\r
- protected ModuleComment commentModule;\r
- protected DatabaseCommentToMedia commentToMedia = DatabaseCommentToMedia.getInstance();\r
-\r
- public MirBasicPostingSessionHandler() {\r
- logger = new LoggerWrapper("Localizer.OpenPosting");\r
- try {\r
- configuration = MirPropertiesConfiguration.instance();\r
- }\r
- catch (Throwable t) {\r
- logger.fatal("Cannot load configuration: " + t.toString());\r
-\r
- throw new RuntimeException("Cannot load configuration: " + t.toString());\r
- }\r
- commentModule= new ModuleComment(DatabaseComment.getInstance());\r
- }\r
-\r
- public void processRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure {\r
- if (aSession.getAttribute("initialRequest")==null) {\r
- initialRequest(aRequest, aSession, aResponse);\r
- aSession.setAttribute("initialRequest", "no");\r
- }\r
- else {\r
- subsequentRequest(aRequest, aSession, aResponse);\r
- }\r
- };\r
-\r
- protected Map getIntersectingValues(Request aRequest, StorageObject aStorage) throws SessionExc, SessionFailure {\r
- Map result = new HashMap();\r
-\r
- Iterator i = aStorage.getFields().iterator();\r
-\r
- while (i.hasNext()) {\r
- String fieldName = (String) i.next();\r
- Object value = aRequest.getParameter(fieldName);\r
- if (value != null)\r
- result.put(fieldName, value);\r
- }\r
-\r
- return result;\r
- }\r
-\r
-\r
- protected String generateOnetimePassword() {\r
- Random r = new Random();\r
- int random = r.nextInt();\r
-\r
- long l = System.currentTimeMillis();\r
-\r
- l = (l*l*l*l)/random;\r
- if (l<0)\r
- l = l * -1;\r
-\r
- String returnString = ""+l;\r
-\r
- return returnString.substring(5);\r
- }\r
-\r
- protected void initializeResponseData(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure {\r
- if (MirGlobal.abuse().getOpenPostingPassword()) {\r
- String password = (String) aSession.getAttribute("password");\r
- if (password==null) {\r
- password = generateOnetimePassword();\r
- aSession.setAttribute("password", password);\r
- }\r
- aResponse.setResponseValue("password", password);\r
- }\r
- else {\r
- aResponse.setResponseValue("password", null);\r
- aSession.deleteAttribute("password");\r
- }\r
-\r
- aResponse.setResponseValue("errors", null);\r
- };\r
-\r
- protected void initialRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure{\r
- Iterator i = DatabaseComment.getInstance().getFields().iterator();\r
- while (i.hasNext()) {\r
- aResponse.setResponseValue( (String) i.next(), null);\r
- }\r
-\r
- String articleId = aRequest.getParameter("to_media");\r
-\r
- if (articleId == null)\r
- throw new SessionExc("MirBasicPostingSessionHandler.initialRequest: article id not set!");\r
-\r
- aSession.setAttribute("to_media", articleId);\r
-\r
- initializeResponseData(aRequest, aSession, aResponse);\r
-\r
- try {\r
- aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate"));\r
- }\r
- catch (Throwable e) {\r
- throw new SessionFailure("Can't get configuration: " + e.getMessage(), e);\r
- }\r
-\r
- }\r
-\r
- protected boolean testFieldEntered(Request aRequest, String aFieldName, String anErrorMessageResource, List aValidationResults) {\r
- Object value = aRequest.getParameter(aFieldName);\r
- if (value==null || !(value instanceof String) || ((String) value).trim().length()==0) {\r
- logger.debug(" missing field " + aFieldName + " value = " + value);\r
- aValidationResults.add(new ValidationError(aFieldName, anErrorMessageResource));\r
- return false;\r
- }\r
- else\r
- return true;\r
- }\r
-\r
- protected boolean testFieldIsNumeric(Request aRequest, String aFieldName, String anErrorMessageResource, List aValidationResults) {\r
- Object value = aRequest.getParameter(aFieldName);\r
- if (value!=null) {\r
- try {\r
- Integer.parseInt((String) value);\r
- return true;\r
- }\r
- catch (Throwable t) {\r
- logger.debug(" field not numeric: " + aFieldName + " value = " + value);\r
- aValidationResults.add(new ValidationError(aFieldName, anErrorMessageResource));\r
- return false;\r
- }\r
- }\r
- return true;\r
- }\r
-\r
- public void validate(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure {\r
-\r
- }\r
-\r
- public List validate(Request aRequest, Session aSession) throws SessionExc, SessionFailure {\r
- List result = new Vector();\r
-\r
- testFieldEntered(aRequest, "title", "validationerror.missing", result);\r
- testFieldEntered(aRequest, "description", "validationerror.missing", result);\r
- testFieldEntered(aRequest, "creator", "validationerror.missing", result);\r
-\r
- return result;\r
- }\r
-\r
- public void subsequentRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure {\r
- try {\r
- Map commentFields = new HashMap();\r
-\r
- Iterator i = DatabaseContent.getInstance().getFields().iterator();\r
- while (i.hasNext()) {\r
- String field = (String) i.next();\r
- aResponse.setResponseValue(field, aRequest.getParameter(field));\r
- if (aRequest.getParameter(field)!=null) {\r
- commentFields.put(field, aRequest.getParameter(field));\r
- }\r
- }\r
-\r
- initializeResponseData(aRequest, aSession, aResponse);\r
-\r
- List validationErrors = validate(aRequest, aSession);\r
-\r
- if (validationErrors != null && validationErrors.size()>0) {\r
- returnValidationErrors(aRequest, aSession, aResponse, validationErrors);\r
- }\r
- else {\r
-// finish(aRequest, aSession, aResponse);\r
-\r
- EntityComment comment = (EntityComment) commentModule.createNew ();\r
-// comment.setValues(getIntersectingValues(aRequest, ));\r
-\r
- finishComment(aRequest, aSession, comment);\r
-\r
- String id = comment.insert();\r
- if(id==null){\r
- afterDuplicateCommentPosting(aRequest, aSession, aResponse, comment);\r
- logger.info("Dupe comment rejected");\r
- aSession.terminate();\r
- }\r
- else {\r
- i = aRequest.getUploadedFiles().iterator();\r
- while (i.hasNext()) {\r
- UploadedFile file = (UploadedFile) i.next();\r
- processMediaFile(aRequest, aSession, comment, file);\r
- }\r
-\r
- afterCommentPosting(aRequest, aSession, aResponse, comment);\r
- MirGlobal.abuse().checkComment(comment, aRequest, null);\r
- MirGlobal.localizer().openPostings().afterCommentPosting(comment);\r
- logger.info("Comment posted");\r
- aSession.terminate();\r
- }\r
- }\r
- }\r
- catch (Throwable t) {\r
- ExceptionFunctions.traceCauseException(t).printStackTrace();\r
-\r
- throw new SessionFailure("MirBasicPostingSessionHandler.subsequentRequest: " + t.getMessage(), t);\r
- }\r
- }\r
-\r
- public void initializeCommentPosting(Request aRequest, Session aSession, Response aResponse) throws SessionFailure, SessionExc {\r
- String articleId = aRequest.getParameter("to_media");\r
- if (articleId==null)\r
- articleId = aRequest.getParameter("aid");\r
-\r
- if (articleId==null)\r
- throw new SessionExc("initializeCommentPosting: article id not set!");\r
-\r
- aSession.setAttribute("to_media", articleId);\r
- processCommentPosting(aRequest, aSession, aResponse);\r
- };\r
-\r
- public void returnValidationErrors(Request aRequest, Session aSession, Response aResponse, List aValidationErrors) throws SessionFailure, SessionExc {\r
- aResponse.setResponseValue("errors", aValidationErrors);\r
- aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate"));\r
- };\r
-\r
- public void processCommentPosting(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure {\r
- if (MirGlobal.abuse().getOpenPostingPassword()) {\r
- String password = generateOnetimePassword();\r
- aSession.setAttribute("password", password);\r
- aResponse.setResponseValue("password", password);\r
- aResponse.setResponseValue("passwd", password);\r
- }\r
- else {\r
- aResponse.setResponseValue("password", null);\r
- }\r
-\r
- aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate"));\r
- };\r
-\r
- public void processMediaFile(Request aRequest, Session aSession, EntityComment aComment, UploadedFile aFile) throws SessionExc, SessionFailure {\r
- try {\r
- Entity mediaItem = MediaUploadProcessor.processMediaUpload(aFile, new HashMap());\r
- finishMedia(aRequest, aSession, aFile, mediaItem);\r
- mediaItem.update();\r
- commentToMedia.addMedia(aComment.getId(), mediaItem.getId());\r
- }\r
- catch (Throwable t) {\r
- throw new SessionFailure(t);\r
- }\r
- }\r
-\r
- public void finishMedia(Request aRequest, Session aSession, UploadedFile aFile, Entity aMedia) throws SessionExc, SessionFailure {\r
- }\r
-\r
- public void finishComment(Request aRequest, Session aSession, EntityComment aComment) throws SessionExc, SessionFailure {\r
- if (aSession.getAttribute("to_media") == null)\r
- throw new SessionExc("missing to_media");\r
-\r
- aComment.setValueForProperty("is_published", "1");\r
- aComment.setValueForProperty("to_comment_status", "1");\r
- aComment.setValueForProperty("is_html","0");\r
- aComment.setValueForProperty("to_media", (String) aSession.getAttribute("to_media"));\r
- };\r
-\r
- public void addMedia(Request aRequest, Session aSession, EntityComment aComment) throws SessionExc, SessionFailure {\r
- }\r
-\r
- public void afterCommentPosting(Request aRequest, Session aSession, Response aResponse, EntityComment aComment) {\r
- DatabaseContent.getInstance().setUnproduced("id=" + aComment.getValue("to_media"));\r
- aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.DoneTemplate"));\r
- };\r
-\r
- public void afterDuplicateCommentPosting(Request aRequest, Session aSession, Response aResponse, EntityComment aComment) {\r
- aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.DupeTemplate"));\r
- };\r
-\r
- public class ValidationError {\r
- private String field;\r
- private String message;\r
- private List parameters;\r
-\r
- public ValidationError(String aField, String aMessage) {\r
- this (aField, aMessage, new String[] {});\r
- }\r
-\r
- public ValidationError(String aField, String aMessage, Object aParameter) {\r
- this (aField, aMessage, new Object[] {aParameter});\r
- }\r
-\r
- public ValidationError(String aField, String aMessage, Object[] aParameters) {\r
- field = aField;\r
- message = aMessage;\r
- parameters = Arrays.asList(aParameters);\r
- }\r
-\r
- public String getMessage() {\r
- return message;\r
- }\r
-\r
- public String getField() {\r
- return field;\r
- }\r
-\r
- public List getParameters() {\r
- return parameters;\r
- }\r
- }\r
-\r
-\r
-\r
-}\r
+import mircoders.storage.DatabaseContent;
+
+/**
+ *
+ * <p>Title: Experimental session handler for comment postings </p>
+ * <p>Description: </p>
+ * <p>Copyright: Copyright (c) 2003</p>
+ * <p>Company: </p>
+ * @author not attributable
+ * @version 1.0
+ */
+
+public class MirBasicPostingSessionHandler implements SessionHandler {
+ protected LoggerWrapper logger;
+ protected MirPropertiesConfiguration configuration;
+ protected ModuleComment commentModule;
+ protected DatabaseCommentToMedia commentToMedia = DatabaseCommentToMedia.getInstance();
+
+ public MirBasicPostingSessionHandler() {
+ logger = new LoggerWrapper("Localizer.OpenPosting");
+ try {
+ configuration = MirPropertiesConfiguration.instance();
+ }
+ catch (Throwable t) {
+ logger.fatal("Cannot load configuration: " + t.toString());
+
+ throw new RuntimeException("Cannot load configuration: " + t.toString());
+ }
+ commentModule= new ModuleComment(DatabaseComment.getInstance());
+ }
+
+ public void processRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure {
+ if (aSession.getAttribute("initialRequest")==null) {
+ initialRequest(aRequest, aSession, aResponse);
+ aSession.setAttribute("initialRequest", "no");
+ }
+ else {
+ subsequentRequest(aRequest, aSession, aResponse);
+ }
+ };
+
+ protected Map getIntersectingValues(Request aRequest, StorageObject aStorage) throws SessionExc, SessionFailure {
+ Map result = new HashMap();
+
+ Iterator i = aStorage.getFields().iterator();
+
+ while (i.hasNext()) {
+ String fieldName = (String) i.next();
+ Object value = aRequest.getParameter(fieldName);
+ if (value != null)
+ result.put(fieldName, value);
+ }
+
+ return result;
+ }
+
+
+ protected String generateOnetimePassword() {
+ Random r = new Random();
+ int random = r.nextInt();
+
+ long l = System.currentTimeMillis();
+
+ l = (l*l*l*l)/random;
+ if (l<0)
+ l = l * -1;
+
+ String returnString = ""+l;
+
+ return returnString.substring(5);
+ }
+
+ protected void initializeResponseData(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure {
+ if (MirGlobal.abuse().getOpenPostingPassword()) {
+ String password = (String) aSession.getAttribute("password");
+ if (password==null) {
+ password = generateOnetimePassword();
+ aSession.setAttribute("password", password);
+ }
+ aResponse.setResponseValue("password", password);
+ }
+ else {
+ aResponse.setResponseValue("password", null);
+ aSession.deleteAttribute("password");
+ }
+
+ aResponse.setResponseValue("errors", null);
+ };
+
+ protected void initialRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure{
+ Iterator i = DatabaseComment.getInstance().getFields().iterator();
+ while (i.hasNext()) {
+ aResponse.setResponseValue( (String) i.next(), null);
+ }
+
+ String articleId = aRequest.getParameter("to_media");
+
+ if (articleId == null)
+ throw new SessionExc("MirBasicPostingSessionHandler.initialRequest: article id not set!");
+
+ aSession.setAttribute("to_media", articleId);
+
+ initializeResponseData(aRequest, aSession, aResponse);
+
+ try {
+ aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate"));
+ }
+ catch (Throwable e) {
+ throw new SessionFailure("Can't get configuration: " + e.getMessage(), e);
+ }
+
+ }
+
+ protected boolean testFieldEntered(Request aRequest, String aFieldName, String anErrorMessageResource, List aValidationResults) {
+ Object value = aRequest.getParameter(aFieldName);
+ if (value==null || !(value instanceof String) || ((String) value).trim().length()==0) {
+ logger.debug(" missing field " + aFieldName + " value = " + value);
+ aValidationResults.add(new ValidationError(aFieldName, anErrorMessageResource));
+ return false;
+ }
+ else
+ return true;
+ }
+
+ protected boolean testFieldIsNumeric(Request aRequest, String aFieldName, String anErrorMessageResource, List aValidationResults) {
+ Object value = aRequest.getParameter(aFieldName);
+ if (value!=null) {
+ try {
+ Integer.parseInt((String) value);
+ return true;
+ }
+ catch (Throwable t) {
+ logger.debug(" field not numeric: " + aFieldName + " value = " + value);
+ aValidationResults.add(new ValidationError(aFieldName, anErrorMessageResource));
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public void validate(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure {
+
+ }
+
+ public List validate(Request aRequest, Session aSession) throws SessionExc, SessionFailure {
+ List result = new Vector();
+
+ testFieldEntered(aRequest, "title", "validationerror.missing", result);
+ testFieldEntered(aRequest, "description", "validationerror.missing", result);
+ testFieldEntered(aRequest, "creator", "validationerror.missing", result);
+
+ return result;
+ }
+
+ public void subsequentRequest(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure {
+ try {
+ Map commentFields = new HashMap();
+
+ Iterator i = DatabaseContent.getInstance().getFields().iterator();
+ while (i.hasNext()) {
+ String field = (String) i.next();
+ aResponse.setResponseValue(field, aRequest.getParameter(field));
+ if (aRequest.getParameter(field)!=null) {
+ commentFields.put(field, aRequest.getParameter(field));
+ }
+ }
+
+ initializeResponseData(aRequest, aSession, aResponse);
+
+ List validationErrors = validate(aRequest, aSession);
+
+ if (validationErrors != null && validationErrors.size()>0) {
+ returnValidationErrors(aRequest, aSession, aResponse, validationErrors);
+ }
+ else {
+// finish(aRequest, aSession, aResponse);
+
+ EntityComment comment = (EntityComment) commentModule.createNew ();
+// comment.setValues(getIntersectingValues(aRequest, ));
+
+ finishComment(aRequest, aSession, comment);
+
+ String id = comment.insert();
+ if(id==null){
+ afterDuplicateCommentPosting(aRequest, aSession, aResponse, comment);
+ logger.info("Dupe comment rejected");
+ aSession.terminate();
+ }
+ else {
+ i = aRequest.getUploadedFiles().iterator();
+ while (i.hasNext()) {
+ UploadedFile file = (UploadedFile) i.next();
+ processMediaFile(aRequest, aSession, comment, file);
+ }
+
+ afterCommentPosting(aRequest, aSession, aResponse, comment);
+ MirGlobal.abuse().checkComment(comment, aRequest, null);
+ MirGlobal.localizer().openPostings().afterCommentPosting(comment);
+ logger.info("Comment posted");
+ aSession.terminate();
+ }
+ }
+ }
+ catch (Throwable t) {
+ ExceptionFunctions.traceCauseException(t).printStackTrace();
+
+ throw new SessionFailure("MirBasicPostingSessionHandler.subsequentRequest: " + t.getMessage(), t);
+ }
+ }
+
+ public void initializeCommentPosting(Request aRequest, Session aSession, Response aResponse) throws SessionFailure, SessionExc {
+ String articleId = aRequest.getParameter("to_media");
+ if (articleId==null)
+ articleId = aRequest.getParameter("aid");
+
+ if (articleId==null)
+ throw new SessionExc("initializeCommentPosting: article id not set!");
+
+ aSession.setAttribute("to_media", articleId);
+ processCommentPosting(aRequest, aSession, aResponse);
+ };
+
+ public void returnValidationErrors(Request aRequest, Session aSession, Response aResponse, List aValidationErrors) throws SessionFailure, SessionExc {
+ aResponse.setResponseValue("errors", aValidationErrors);
+ aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate"));
+ };
+
+ public void processCommentPosting(Request aRequest, Session aSession, Response aResponse) throws SessionExc, SessionFailure {
+ if (MirGlobal.abuse().getOpenPostingPassword()) {
+ String password = generateOnetimePassword();
+ aSession.setAttribute("password", password);
+ aResponse.setResponseValue("password", password);
+ aResponse.setResponseValue("passwd", password);
+ }
+ else {
+ aResponse.setResponseValue("password", null);
+ }
+
+ aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.EditTemplate"));
+ };
+
+ public void processMediaFile(Request aRequest, Session aSession, EntityComment aComment, UploadedFile aFile) throws SessionExc, SessionFailure {
+ try {
+ Entity mediaItem = MediaUploadProcessor.processMediaUpload(aFile, new HashMap());
+ finishMedia(aRequest, aSession, aFile, mediaItem);
+ mediaItem.update();
+ commentToMedia.addMedia(aComment.getId(), mediaItem.getId());
+ }
+ catch (Throwable t) {
+ throw new SessionFailure(t);
+ }
+ }
+
+ public void finishMedia(Request aRequest, Session aSession, UploadedFile aFile, Entity aMedia) throws SessionExc, SessionFailure {
+ }
+
+ public void finishComment(Request aRequest, Session aSession, EntityComment aComment) throws SessionExc, SessionFailure {
+ if (aSession.getAttribute("to_media") == null)
+ throw new SessionExc("missing to_media");
+
+ aComment.setValueForProperty("is_published", "1");
+ aComment.setValueForProperty("to_comment_status", "1");
+ aComment.setValueForProperty("is_html","0");
+ aComment.setValueForProperty("to_media", (String) aSession.getAttribute("to_media"));
+ };
+
+ public void addMedia(Request aRequest, Session aSession, EntityComment aComment) throws SessionExc, SessionFailure {
+ }
+
+ public void afterCommentPosting(Request aRequest, Session aSession, Response aResponse, EntityComment aComment) {
+ DatabaseContent.getInstance().setUnproduced("id=" + aComment.getValue("to_media"));
+ aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.DoneTemplate"));
+ };
+
+ public void afterDuplicateCommentPosting(Request aRequest, Session aSession, Response aResponse, EntityComment aComment) {
+ aResponse.setResponseGenerator(configuration.getString("Localizer.OpenSession.comment.DupeTemplate"));
+ };
+
+ public class ValidationError {
+ private String field;
+ private String message;
+ private List parameters;
+
+ public ValidationError(String aField, String aMessage) {
+ this (aField, aMessage, new String[] {});
+ }
+
+ public ValidationError(String aField, String aMessage, Object aParameter) {
+ this (aField, aMessage, new Object[] {aParameter});
+ }
+
+ public ValidationError(String aField, String aMessage, Object[] aParameters) {
+ field = aField;
+ message = aMessage;
+ parameters = Arrays.asList(aParameters);
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public String getField() {
+ return field;
+ }
+
+ public List getParameters() {
+ return parameters;
+ }
+ }
+
+
+
+}
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.localizer.basic;
-import java.util.GregorianCalendar;\r
-import java.util.HashMap;\r
-import java.util.Iterator;\r
-import java.util.Map;\r
-\r
-import mir.config.MirPropertiesConfiguration;\r
-import mir.entity.adapter.EntityAdapter;\r
-import mir.entity.adapter.EntityIteratorAdapter;\r
-import mir.log.LoggerWrapper;\r
-import mir.misc.StringUtil;\r
-import mir.util.DateToMapAdapter;\r
-import mir.util.GeneratorExpressionFunctions;\r
-import mir.util.GeneratorHTMLFunctions;\r
-import mir.util.GeneratorIntegerFunctions;\r
-import mir.util.GeneratorListFunctions;\r
-import mir.util.GeneratorStringFunctions;\r
-import mircoders.global.MirGlobal;\r
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import mir.config.MirPropertiesConfiguration;
+import mir.entity.adapter.EntityAdapter;
+import mir.entity.adapter.EntityIteratorAdapter;
+import mir.log.LoggerWrapper;
+import mir.misc.StringUtil;
+import mir.util.DateToMapAdapter;
+import mir.util.GeneratorExpressionFunctions;
+import mir.util.GeneratorHTMLFunctions;
+import mir.util.GeneratorIntegerFunctions;
+import mir.util.GeneratorListFunctions;
+import mir.util.GeneratorStringFunctions;
+import mircoders.global.MirGlobal;
import mircoders.localizer.MirProducerAssistantLocalizer;
public class MirBasicProducerAssistantLocalizer implements MirProducerAssistantLocalizer {
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.localizer.basic;
import java.io.File;
}
catch (Throwable t) {
logger.error("MirBasicProducerLocalizer.factories(): Unable to setup factories: "+t.getMessage());
- t.printStackTrace(logger.asPrintWriter(logger.DEBUG_MESSAGE));
+ t.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
}
}
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.localizer.basic;
import java.io.File;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.media;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.media;
* @see mir.media.MediaHandlerGeneric
* @see mir.media.MirMedia
* @author mh <mh@nadir.org>
- * @version $Id: MediaHandlerAudio.java,v 1.7 2003/01/25 17:50:35 idfx Exp $
+ * @version $Id: MediaHandlerAudio.java,v 1.8 2003/04/21 12:42:48 idfx Exp $
*/
public class MediaHandlerAudio extends MediaHandlerGeneric implements MirMedia
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.media;
import java.io.File;
*
* @see mir.media.MirMedia
* @author mh <mh@nadir.org>
- * @version $Id: MediaHandlerGeneric.java,v 1.18 2003/03/09 19:14:21 idfx Exp $
+ * @version $Id: MediaHandlerGeneric.java,v 1.19 2003/04/21 12:42:48 idfx Exp $
*/
public class MediaHandlerGeneric implements MirMedia
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
-
package mircoders.media;
import java.io.File;
*
* @see mir.media.MirMedia
* @author mh
- * @version $Id: MediaHandlerImages.java,v 1.21 2003/03/09 19:14:21 idfx Exp $
+ * @version $Id: MediaHandlerImages.java,v 1.22 2003/04/21 12:42:48 idfx Exp $
*/
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two. You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries. If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so. If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.media;\r
-\r
-\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.InputStream;\r
-\r
-import mir.config.MirPropertiesConfiguration;\r
-import mir.entity.Entity;\r
-import mir.log.LoggerWrapper;\r
-import mir.media.MediaExc;\r
-import mir.media.MediaFailure;\r
-import mir.misc.StringUtil;\r
-import mircoders.storage.DatabaseUploadedMedia;\r
-\r
-\r
-/**\r
- * Image handler that stores images outside of the database. Will be replaced by the new\r
- * media handling system.\r
- * @author Zapata\r
- * @version 1.0\r
- */\r
-\r
-public class MediaHandlerImagesExtern extends MediaHandlerGeneric\r
-{\r
- private int maxIconSize;\r
- private float minDescaleRatio;\r
- private int minDescaleReduction;\r
-\r
- public MediaHandlerImagesExtern() {\r
-\r
- logger = new LoggerWrapper("Media.Images.Extern");\r
- try {\r
- MirPropertiesConfiguration configuration = MirPropertiesConfiguration.instance();\r
- }\r
- catch (Throwable t) {\r
- logger.fatal("MediaHandlerImagesExtern: can't get configuration");\r
-\r
- throw new RuntimeException(t.toString());\r
- }\r
-\r
- maxIconSize = configuration.getInt("Producer.Image.MaxIconSize");\r
- minDescaleRatio = configuration.getFloat("Producer.Image.MinDescalePercentage")/100;\r
- minDescaleReduction = configuration.getInt("Producer.Image.MinDescaleReduction");\r
- }\r
-\r
- public void produce(Entity anImageEntity, Entity mediaTypeEnt) throws MediaExc, MediaFailure {\r
- try {\r
- String date = anImageEntity.getValue("date");\r
- String datePath = StringUtil.webdbDate2path(date);\r
- String ext = "." + mediaTypeEnt.getValue("name");\r
- String filePath = datePath + anImageEntity.getId() + ext;\r
- String iconFilePath = MirPropertiesConfiguration.instance().getString("Producer.StorageRoot") + getIconStoragePath() + filePath;\r
- String imageFilePath = getStoragePath() + File.separator + filePath;\r
-\r
- File imageFile = new File(imageFilePath);\r
- File iconFile = new File(iconFilePath);\r
-\r
- if (!imageFile.exists()) {\r
- throw new MediaExc("error in MediaHandlerImagesExtern.produce(): " + filePath + " does not exist!");\r
- }\r
- else {\r
- ImageProcessor processor = new ImageProcessor(imageFile, "JPEG");\r
-\r
- processor.descaleImage(maxIconSize, minDescaleRatio, minDescaleReduction);\r
- File dir = new File(iconFile.getParent());\r
- if (dir!=null && !dir.exists()){\r
- dir.mkdirs();\r
- }\r
- processor.writeScaledData(iconFile);\r
-\r
- logger.info(processor.getWidth()+"x"+processor.getHeight());\r
-\r
- anImageEntity.setValueForProperty("img_height", new Integer(processor.getHeight()).toString());\r
- anImageEntity.setValueForProperty("img_width", new Integer(processor.getWidth()).toString());\r
-\r
- anImageEntity.setValueForProperty("icon_height", new Integer(processor.getScaledHeight()).toString());\r
- anImageEntity.setValueForProperty("icon_width", new Integer(processor.getScaledWidth()).toString());\r
-\r
- anImageEntity.setValueForProperty("icon_path", getIconStoragePath()+filePath);\r
- anImageEntity.setValueForProperty("publish_path", filePath);\r
-\r
- anImageEntity.update();\r
- }\r
- }\r
- catch(Throwable t) {\r
- logger.error("MediaHandlerImagesExtern.produce: " + t.getMessage());\r
- t.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));\r
- throw new MediaFailure(t.getMessage(), t);\r
- }\r
- }\r
-\r
-\r
- public InputStream getIcon(Entity anImageEntity) throws MediaExc, MediaFailure {\r
- try {\r
- Entity mediaType = DatabaseUploadedMedia.getInstance().getMediaType(\r
- anImageEntity);\r
-\r
- String date = anImageEntity.getValue("date");\r
- String datePath = StringUtil.webdbDate2path(date);\r
- String ext = "." + mediaType.getValue("name");\r
- String filePath = MirPropertiesConfiguration.instance().getString("Producer.StorageRoot") +\r
- getIconStoragePath() + datePath + anImageEntity.getId() + ext;\r
-\r
- return new FileInputStream(new File(filePath));\r
- }\r
- catch (Throwable t) {\r
- throw new MediaFailure(t);\r
- }\r
- }\r
-\r
- public String getStoragePath()\r
- {\r
- return configuration.getString("Producer.Image.Path");\r
- }\r
-\r
- public String getIconStoragePath()\r
- {\r
- return configuration.getString("Producer.Image.IconPath");\r
- }\r
-\r
- public String getPublishHost()\r
- {\r
- return StringUtil.removeSlash(configuration.getString("Producer.Image.Host"));\r
- }\r
-\r
- public String getTinyIconName()\r
- {\r
- return configuration.getString("Producer.Icon.TinyImage");\r
- }\r
-\r
- public String getBigIconName()\r
- {\r
- return configuration.getString("Producer.Icon.BigImage");\r
- }\r
-\r
- public String getIconAltName()\r
- {\r
- return "Image";\r
- }\r
-\r
- public boolean isVideo()\r
- {\r
- return false;\r
- }\r
-\r
- public boolean isAudio()\r
- {\r
- return false;\r
- }\r
-\r
- public boolean isImage ()\r
- {\r
- return true;\r
- }\r
-\r
- public String getDescr(Entity mediaType)\r
- {\r
- return "image/jpeg";\r
- }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+package mircoders.media;
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+import mir.config.MirPropertiesConfiguration;
+import mir.entity.Entity;
+import mir.log.LoggerWrapper;
+import mir.media.MediaExc;
+import mir.media.MediaFailure;
+import mir.misc.StringUtil;
+import mircoders.storage.DatabaseUploadedMedia;
+
+
+/**
+ * Image handler that stores images outside of the database. Will be replaced by the new
+ * media handling system.
+ * @author Zapata
+ * @version 1.0
+ */
+
+public class MediaHandlerImagesExtern extends MediaHandlerGeneric
+{
+ private int maxIconSize;
+ private float minDescaleRatio;
+ private int minDescaleReduction;
+
+ public MediaHandlerImagesExtern() {
+
+ logger = new LoggerWrapper("Media.Images.Extern");
+ try {
+ MirPropertiesConfiguration configuration = MirPropertiesConfiguration.instance();
+ }
+ catch (Throwable t) {
+ logger.fatal("MediaHandlerImagesExtern: can't get configuration");
+
+ throw new RuntimeException(t.toString());
+ }
+
+ maxIconSize = configuration.getInt("Producer.Image.MaxIconSize");
+ minDescaleRatio = configuration.getFloat("Producer.Image.MinDescalePercentage")/100;
+ minDescaleReduction = configuration.getInt("Producer.Image.MinDescaleReduction");
+ }
+
+ public void produce(Entity anImageEntity, Entity mediaTypeEnt) throws MediaExc, MediaFailure {
+ try {
+ String date = anImageEntity.getValue("date");
+ String datePath = StringUtil.webdbDate2path(date);
+ String ext = "." + mediaTypeEnt.getValue("name");
+ String filePath = datePath + anImageEntity.getId() + ext;
+ String iconFilePath = MirPropertiesConfiguration.instance().getString("Producer.StorageRoot") + getIconStoragePath() + filePath;
+ String imageFilePath = getStoragePath() + File.separator + filePath;
+
+ File imageFile = new File(imageFilePath);
+ File iconFile = new File(iconFilePath);
+
+ if (!imageFile.exists()) {
+ throw new MediaExc("error in MediaHandlerImagesExtern.produce(): " + filePath + " does not exist!");
+ }
+ else {
+ ImageProcessor processor = new ImageProcessor(imageFile, "JPEG");
+
+ processor.descaleImage(maxIconSize, minDescaleRatio, minDescaleReduction);
+ File dir = new File(iconFile.getParent());
+ if (dir!=null && !dir.exists()){
+ dir.mkdirs();
+ }
+ processor.writeScaledData(iconFile);
+
+ logger.info(processor.getWidth()+"x"+processor.getHeight());
+
+ anImageEntity.setValueForProperty("img_height", new Integer(processor.getHeight()).toString());
+ anImageEntity.setValueForProperty("img_width", new Integer(processor.getWidth()).toString());
+
+ anImageEntity.setValueForProperty("icon_height", new Integer(processor.getScaledHeight()).toString());
+ anImageEntity.setValueForProperty("icon_width", new Integer(processor.getScaledWidth()).toString());
+
+ anImageEntity.setValueForProperty("icon_path", getIconStoragePath()+filePath);
+ anImageEntity.setValueForProperty("publish_path", filePath);
+
+ anImageEntity.update();
+ }
+ }
+ catch(Throwable t) {
+ logger.error("MediaHandlerImagesExtern.produce: " + t.getMessage());
+ t.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
+ throw new MediaFailure(t.getMessage(), t);
+ }
+ }
+
+
+ public InputStream getIcon(Entity anImageEntity) throws MediaExc, MediaFailure {
+ try {
+ Entity mediaType = DatabaseUploadedMedia.getInstance().getMediaType(
+ anImageEntity);
+
+ String date = anImageEntity.getValue("date");
+ String datePath = StringUtil.webdbDate2path(date);
+ String ext = "." + mediaType.getValue("name");
+ String filePath = MirPropertiesConfiguration.instance().getString("Producer.StorageRoot") +
+ getIconStoragePath() + datePath + anImageEntity.getId() + ext;
+
+ return new FileInputStream(new File(filePath));
+ }
+ catch (Throwable t) {
+ throw new MediaFailure(t);
+ }
+ }
+
+ public String getStoragePath()
+ {
+ return configuration.getString("Producer.Image.Path");
+ }
+
+ public String getIconStoragePath()
+ {
+ return configuration.getString("Producer.Image.IconPath");
+ }
+
+ public String getPublishHost()
+ {
+ return StringUtil.removeSlash(configuration.getString("Producer.Image.Host"));
+ }
+
+ public String getTinyIconName()
+ {
+ return configuration.getString("Producer.Icon.TinyImage");
+ }
+
+ public String getBigIconName()
+ {
+ return configuration.getString("Producer.Icon.BigImage");
+ }
+
+ public String getIconAltName()
+ {
+ return "Image";
+ }
+
+ public boolean isVideo()
+ {
+ return false;
+ }
+
+ public boolean isAudio()
+ {
+ return false;
+ }
+
+ public boolean isImage ()
+ {
+ return true;
+ }
+
+ public String getDescr(Entity mediaType)
+ {
+ return "image/jpeg";
+ }
+}
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
-
package mircoders.media;
import mir.entity.Entity;
* @see mir.media.MirMedia
* @see mircoders.media.MediaHandlerImages
* @author mh, mir-coders group
- * @version $Id: MediaHandlerImagesJpeg.java,v 1.4 2003/01/25 17:50:35 idfx Exp $
+ * @version $Id: MediaHandlerImagesJpeg.java,v 1.5 2003/04/21 12:42:48 idfx Exp $
*/
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
-
package mircoders.media;
import mir.entity.Entity;
* @see mir.media.MirMedia
* @see mircoders.media.MediaHandlerImages
* @author mh ,mir-coders
- * @version $Id: MediaHandlerImagesPng.java,v 1.5 2003/01/25 17:50:35 idfx Exp $
+ * @version $Id: MediaHandlerImagesPng.java,v 1.6 2003/04/21 12:42:48 idfx Exp $
*/
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.media;
import java.io.StringReader;
*
* @see mir.media.MirMedia
* @author mh <mh@nadir.org>
- * @version $Id: MediaHandlerMp3.java,v 1.14 2003/03/09 19:14:21 idfx Exp $
+ * @version $Id: MediaHandlerMp3.java,v 1.15 2003/04/21 12:42:48 idfx Exp $
*/
public class MediaHandlerMp3 extends MediaHandlerAudio implements MirMedia
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.media;
import java.io.StringReader;
* @see mir.media.MediaHandlerGeneric
* @see mir.media.MirMedia
* @author john <john@manifestor.org>, mh <heckmann@hbe.ca>
- * @version $Id: MediaHandlerRealAudio.java,v 1.18 2003/03/09 19:14:21 idfx Exp $
+ * @version $Id: MediaHandlerRealAudio.java,v 1.19 2003/04/21 12:42:48 idfx Exp $
*/
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.media;
import java.io.File;
* @see mir.media.MediaHandlerGeneric
* @see mir.media.MirMedia
* @author john <john@manifestor.org>, mh <mh@nadir.org>
- * @version $Id: MediaHandlerRealVideo.java,v 1.18 2003/03/09 19:14:21 idfx Exp $
+ * @version $Id: MediaHandlerRealVideo.java,v 1.19 2003/04/21 12:42:48 idfx Exp $
*/
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.media;
import mir.media.MirMedia;
* @see mir.media.MediaHandlerGeneric
* @see mir.media.MirMedia
* @author john <john@manifestor.org>
- * @version $Id: MediaHandlerVideo.java,v 1.8 2003/04/09 02:06:09 zapata Exp $
+ * @version $Id: MediaHandlerVideo.java,v 1.9 2003/04/21 12:42:48 idfx Exp $
*/
public class MediaHandlerVideo extends MediaHandlerGeneric implements MirMedia
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.media;
import java.util.GregorianCalendar;
import mir.misc.StringUtil;
import mir.session.UploadedFile;
import mir.storage.Database;
-
import mircoders.module.ModuleMediaType;
public class MediaUploadProcessor {
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.media;
import mir.media.MediaExc;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.module;
import mir.log.LoggerWrapper;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.module;
import mir.entity.EntityList;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.module;
import java.util.Map;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.module;
import mir.log.LoggerWrapper;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.module;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.module;
import mir.log.LoggerWrapper;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.module;
import mir.log.LoggerWrapper;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.module;
import mir.log.LoggerWrapper;
-package mircoders.module;\r
-\r
-import java.util.List;\r
-\r
-import mir.entity.Entity;\r
-import mir.entity.EntityList;\r
-import mir.log.LoggerWrapper;\r
-import mir.module.AbstractModule;\r
-import mir.module.ModuleExc;\r
-import mir.module.ModuleFailure;\r
-import mir.storage.StorageObject;\r
-import mir.util.JDBCStringRoutines;\r
-import mir.util.StringRoutines;\r
-import mircoders.storage.DatabaseMediaType;\r
-\r
-public class ModuleMediaType extends AbstractModule {\r
- static LoggerWrapper logger = new LoggerWrapper("Module.Content");\r
-\r
- public ModuleMediaType() {\r
- this (DatabaseMediaType.getInstance());\r
- }\r
-\r
- public ModuleMediaType(StorageObject aStorage) {\r
- this.theStorage = aStorage;\r
- }\r
-\r
- public Entity findMediaTypeForMimeType(String aMimeType) throws ModuleExc, ModuleFailure {\r
- List contentTypeParts = StringRoutines.splitString(aMimeType, "/");\r
-\r
- if (contentTypeParts.size()!=2) {\r
- throw new InvalidMimeTypeExc("Invalid mimetype: " + aMimeType, aMimeType);\r
- }\r
- String mimeTypeMajor = (String) contentTypeParts.get(0);\r
-\r
- EntityList mediaTypes;\r
-\r
- mediaTypes = DatabaseMediaType.getInstance().selectByWhereClause("mime_type = '"+JDBCStringRoutines.escapeStringLiteral(aMimeType)+"'");\r
- if (mediaTypes.size() == 0) {\r
- mediaTypes = DatabaseMediaType.getInstance().selectByWhereClause("mime_type = '"+JDBCStringRoutines.escapeStringLiteral(mimeTypeMajor+"/*")+"'");\r
- }\r
- if (mediaTypes.size() == 0) {\r
- throw new UnsupportedMimeTypeExc("Unsupported mimetype: " + aMimeType, aMimeType);\r
- }\r
-\r
- return (Entity) mediaTypes.get(0);\r
- }\r
-\r
- public static class MimeTypeExc extends ModuleExc {\r
- private String mimeType;\r
-\r
- public MimeTypeExc(String aMessage, String aMimeType) {\r
- super (aMessage);\r
- mimeType = aMimeType;\r
- }\r
-\r
- public String getMimeType() {\r
- return mimeType;\r
- }\r
- }\r
-\r
- public static class UnsupportedMimeTypeExc extends MimeTypeExc {\r
- public UnsupportedMimeTypeExc(String aMessage, String aMimeType) {\r
- super(aMessage, aMimeType);\r
- }\r
- }\r
-\r
- public static class InvalidMimeTypeExc extends MimeTypeExc {\r
- public InvalidMimeTypeExc(String aMessage, String aMimeType) {\r
- super(aMessage, aMimeType);\r
- }\r
- }\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.module;
+
+import java.util.List;
+
+import mir.entity.Entity;
+import mir.entity.EntityList;
+import mir.log.LoggerWrapper;
+import mir.module.AbstractModule;
+import mir.module.ModuleExc;
+import mir.module.ModuleFailure;
+import mir.storage.StorageObject;
+import mir.util.JDBCStringRoutines;
+import mir.util.StringRoutines;
+import mircoders.storage.DatabaseMediaType;
+
+public class ModuleMediaType extends AbstractModule {
+ static LoggerWrapper logger = new LoggerWrapper("Module.Content");
+
+ public ModuleMediaType() {
+ this (DatabaseMediaType.getInstance());
+ }
+
+ public ModuleMediaType(StorageObject aStorage) {
+ this.theStorage = aStorage;
+ }
+
+ public Entity findMediaTypeForMimeType(String aMimeType) throws ModuleExc, ModuleFailure {
+ List contentTypeParts = StringRoutines.splitString(aMimeType, "/");
+
+ if (contentTypeParts.size()!=2) {
+ throw new InvalidMimeTypeExc("Invalid mimetype: " + aMimeType, aMimeType);
+ }
+ String mimeTypeMajor = (String) contentTypeParts.get(0);
+
+ EntityList mediaTypes;
+
+ mediaTypes = DatabaseMediaType.getInstance().selectByWhereClause("mime_type = '"+JDBCStringRoutines.escapeStringLiteral(aMimeType)+"'");
+ if (mediaTypes.size() == 0) {
+ mediaTypes = DatabaseMediaType.getInstance().selectByWhereClause("mime_type = '"+JDBCStringRoutines.escapeStringLiteral(mimeTypeMajor+"/*")+"'");
+ }
+ if (mediaTypes.size() == 0) {
+ throw new UnsupportedMimeTypeExc("Unsupported mimetype: " + aMimeType, aMimeType);
+ }
+
+ return (Entity) mediaTypes.get(0);
+ }
+
+ public static class MimeTypeExc extends ModuleExc {
+ private String mimeType;
+
+ public MimeTypeExc(String aMessage, String aMimeType) {
+ super (aMessage);
+ mimeType = aMimeType;
+ }
+
+ public String getMimeType() {
+ return mimeType;
+ }
+ }
+
+ public static class UnsupportedMimeTypeExc extends MimeTypeExc {
+ public UnsupportedMimeTypeExc(String aMessage, String aMimeType) {
+ super(aMessage, aMimeType);
+ }
+ }
+
+ public static class InvalidMimeTypeExc extends MimeTypeExc {
+ public InvalidMimeTypeExc(String aMessage, String aMimeType) {
+ super(aMessage, aMimeType);
+ }
+ }
}
\ No newline at end of file
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.module;
/**
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.module;
import mir.log.LoggerWrapper;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.module;
import java.util.Map;
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two. You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries. If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so. If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.module;\r
-\r
-import mir.log.LoggerWrapper;\r
-import mir.module.AbstractModule;\r
-import mir.storage.StorageObject;\r
-\r
-/**\r
- *\r
- * <p>Title: </p>\r
- * <p>Description: </p>\r
- * <p>Copyright: Copyright (c) 2003</p>\r
- * <p>Company: </p>\r
- * @author the mir coders\r
- * @version 1.0\r
- */\r
-\r
-public class ModuleUploadedMedia extends AbstractModule\r
-{\r
- static LoggerWrapper logger = new LoggerWrapper("Module.UploadedMedia");\r
-\r
- public ModuleUploadedMedia(StorageObject aStorage) {\r
- theStorage = aStorage;\r
- }\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.module;
+
+import mir.log.LoggerWrapper;
+import mir.module.AbstractModule;
+import mir.storage.StorageObject;
+
+/**
+ *
+ * <p>Title: </p>
+ * <p>Description: </p>
+ * <p>Copyright: Copyright (c) 2003</p>
+ * <p>Company: </p>
+ * @author the mir coders
+ * @version 1.0
+ */
+
+public class ModuleUploadedMedia extends AbstractModule
+{
+ static LoggerWrapper logger = new LoggerWrapper("Module.UploadedMedia");
+
+ public ModuleUploadedMedia(StorageObject aStorage) {
+ theStorage = aStorage;
+ }
}
\ No newline at end of file
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.module;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.pdf;
-import mir.log.LoggerWrapper;
+import gnu.regexp.RE;
+import gnu.regexp.REException;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.MalformedURLException;
-
-import gnu.regexp.RE;
-import gnu.regexp.REException;
-
-import com.lowagie.text.*;
-import com.lowagie.text.pdf.*;
-
+import mir.config.MirPropertiesConfiguration;
+import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;
import mir.entity.EntityList;
-
+import mir.log.LoggerWrapper;
import mircoders.entity.EntityContent;
import mircoders.entity.EntityImages;
import mircoders.storage.DatabaseContentToMedia;
-import mir.config.MirPropertiesConfiguration;
-import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;
+import com.lowagie.text.BadElementException;
+import com.lowagie.text.Document;
+import com.lowagie.text.DocumentException;
+import com.lowagie.text.Element;
+import com.lowagie.text.Font;
+import com.lowagie.text.Image;
+import com.lowagie.text.PageSize;
+import com.lowagie.text.Paragraph;
+import com.lowagie.text.Phrase;
+import com.lowagie.text.pdf.BaseFont;
+import com.lowagie.text.pdf.ColumnText;
+import com.lowagie.text.pdf.PdfContentByte;
+import com.lowagie.text.pdf.PdfTemplate;
+import com.lowagie.text.pdf.PdfWriter;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.producer;
import java.util.Map;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.producer;
import java.util.Map;
-/* Copyright (C) 2001, 2002 The Mir-coders group
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.producer;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.producer;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.producer;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.producer;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.producer;
import java.util.Map;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.producer.reader;
import java.util.Map;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.search;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.search;
-import java.util.StringTokenizer;
import java.util.Map;
+import java.util.StringTokenizer;
import javax.servlet.http.HttpServletRequest;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.search;
-import java.util.StringTokenizer;
+import java.util.List;
import java.util.Map;
+import java.util.StringTokenizer;
import java.util.Vector;
-import java.util.List;
import javax.servlet.http.HttpServletRequest;
-/* Copyright (C) 2001, 2002 The Mir-coders group
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.search;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.search;
import java.util.Map;
+
import javax.servlet.http.HttpServletRequest;
+import mir.entity.Entity;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
-import mir.entity.Entity;
-
public class KeywordSearchTerm extends SearchTerm{
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.search;
import javax.servlet.http.HttpServletRequest;
import mir.entity.Entity;
-import mir.entity.EntityList;
import mir.storage.StorageObjectFailure;
-import mircoders.entity.EntityContent;
-import mircoders.storage.DatabaseContentToMedia;
import org.apache.lucene.document.Document;
-import org.apache.lucene.document.Field;
public class MediaSearchTerm extends SearchTerm{
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.search;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.search;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.search;
import java.util.Map;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.search;
import java.util.Map;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.search;
import java.util.Map;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.search;
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two. You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries. If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so. If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.servlet;\r
-\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+package mircoders.servlet;
+
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
-import org.apache.struts.util.MessageResources;
-
import mir.entity.adapter.EntityIteratorAdapter;
import mir.generator.Generator;
import mir.log.LoggerWrapper;
import mir.servlet.ServletModuleFailure;
import mir.util.CachingRewindableIterator;
import mir.util.ResourceBundleGeneratorFunction;
-import mircoders.global.MirGlobal;\r
-\r
-\r
-\r
-public class ServletHelper {\r
- static LoggerWrapper logger = new LoggerWrapper("ServletModule.Helper");\r
-\r
-\r
- public static Map makeGenerationData(Locale[] aLocales) throws ServletModuleExc {\r
- return makeGenerationData(aLocales, "bundles.adminlocal", "bundles.admin");\r
- }\r
-\r
- public static Map makeGenerationData(Locale[] aLocales, String aBundle) throws ServletModuleExc {\r
- return makeGenerationData(aLocales, aBundle, aBundle);\r
- }\r
-\r
- public static Map makeGenerationData(Locale[] aLocales, String aBundle, String aDefaultBundle) throws ServletModuleExc {\r
-\r
- try {\r
- Map result = new HashMap();\r
-\r
- MirGlobal.localizer().producerAssistant().initializeGenerationValueSet(result);\r
-\r
- result.put("returnurl", null);\r
-\r
- Object languages =\r
- new CachingRewindableIterator(\r
- new EntityIteratorAdapter( "", "id", 30,\r
- MirGlobal.localizer().dataModel().adapterModel(), "language"));\r
- Object topics =\r
- new CachingRewindableIterator(\r
- new EntityIteratorAdapter("", "id", 30,\r
- MirGlobal.localizer().dataModel().adapterModel(), "topic"));\r
-\r
- Object articleTypes =\r
- new CachingRewindableIterator(\r
- new EntityIteratorAdapter( "", "id", 30,\r
- MirGlobal.localizer().dataModel().adapterModel(), "articleType"));\r
-\r
- Object commentStatuses =\r
- new CachingRewindableIterator(\r
- new EntityIteratorAdapter( "", "id", 30,\r
- MirGlobal.localizer().dataModel().adapterModel(), "commentStatus"));\r
-\r
- result.put("commentstatuses", commentStatuses);\r
- result.put("articletypes", articleTypes);\r
- result.put("languages", languages);\r
- result.put("topics", topics);\r
-\r
- result.put( "lang",\r
- new ResourceBundleGeneratorFunction( aLocales,\r
- new MessageResources[] { MessageResources.getMessageResources(aBundle),\r
- MessageResources.getMessageResources(aDefaultBundle)}));\r
-\r
- return result;\r
- }\r
- catch (Throwable t) {\r
- throw new ServletModuleFailure(t);\r
- }\r
- }\r
-\r
- public static void generateResponse(PrintWriter aWriter, Map aGenerationData, String aGenerator) throws ServletModuleExc {\r
- Generator generator;\r
-\r
- try {\r
- generator = MirGlobal.localizer().generators().makeAdminGeneratorLibrary().makeGenerator(aGenerator);\r
-\r
- generator.generate(aWriter, aGenerationData, logger);\r
- }\r
- catch (Throwable t) {\r
- throw new ServletModuleFailure(t);\r
- }\r
- }\r
-\r
- public static void generateOpenPostingResponse(PrintWriter aWriter, Map aGenerationData, String aGenerator) throws ServletModuleExc {\r
- Generator generator;\r
-\r
- try {\r
- generator = MirGlobal.localizer().generators().makeOpenPostingGeneratorLibrary().makeGenerator(aGenerator);\r
-\r
- generator.generate(aWriter, aGenerationData, logger);\r
- }\r
- catch (Throwable t) {\r
- throw new ServletModuleFailure(t);\r
- }\r
- }\r
-}\r
+import mircoders.global.MirGlobal;
+
+import org.apache.struts.util.MessageResources;
+
+
+
+public class ServletHelper {
+ static LoggerWrapper logger = new LoggerWrapper("ServletModule.Helper");
+
+
+ public static Map makeGenerationData(Locale[] aLocales) throws ServletModuleExc {
+ return makeGenerationData(aLocales, "bundles.adminlocal", "bundles.admin");
+ }
+
+ public static Map makeGenerationData(Locale[] aLocales, String aBundle) throws ServletModuleExc {
+ return makeGenerationData(aLocales, aBundle, aBundle);
+ }
+
+ public static Map makeGenerationData(Locale[] aLocales, String aBundle, String aDefaultBundle) throws ServletModuleExc {
+
+ try {
+ Map result = new HashMap();
+
+ MirGlobal.localizer().producerAssistant().initializeGenerationValueSet(result);
+
+ result.put("returnurl", null);
+
+ Object languages =
+ new CachingRewindableIterator(
+ new EntityIteratorAdapter( "", "id", 30,
+ MirGlobal.localizer().dataModel().adapterModel(), "language"));
+ Object topics =
+ new CachingRewindableIterator(
+ new EntityIteratorAdapter("", "id", 30,
+ MirGlobal.localizer().dataModel().adapterModel(), "topic"));
+
+ Object articleTypes =
+ new CachingRewindableIterator(
+ new EntityIteratorAdapter( "", "id", 30,
+ MirGlobal.localizer().dataModel().adapterModel(), "articleType"));
+
+ Object commentStatuses =
+ new CachingRewindableIterator(
+ new EntityIteratorAdapter( "", "id", 30,
+ MirGlobal.localizer().dataModel().adapterModel(), "commentStatus"));
+
+ result.put("commentstatuses", commentStatuses);
+ result.put("articletypes", articleTypes);
+ result.put("languages", languages);
+ result.put("topics", topics);
+
+ result.put( "lang",
+ new ResourceBundleGeneratorFunction( aLocales,
+ new MessageResources[] { MessageResources.getMessageResources(aBundle),
+ MessageResources.getMessageResources(aDefaultBundle)}));
+
+ return result;
+ }
+ catch (Throwable t) {
+ throw new ServletModuleFailure(t);
+ }
+ }
+
+ public static void generateResponse(PrintWriter aWriter, Map aGenerationData, String aGenerator) throws ServletModuleExc {
+ Generator generator;
+
+ try {
+ generator = MirGlobal.localizer().generators().makeAdminGeneratorLibrary().makeGenerator(aGenerator);
+
+ generator.generate(aWriter, aGenerationData, logger);
+ }
+ catch (Throwable t) {
+ throw new ServletModuleFailure(t);
+ }
+ }
+
+ public static void generateOpenPostingResponse(PrintWriter aWriter, Map aGenerationData, String aGenerator) throws ServletModuleExc {
+ Generator generator;
+
+ try {
+ generator = MirGlobal.localizer().generators().makeOpenPostingGeneratorLibrary().makeGenerator(aGenerator);
+
+ generator.generate(aWriter, aGenerationData, logger);
+ }
+ catch (Throwable t) {
+ throw new ServletModuleFailure(t);
+ }
+ }
+}
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two. You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries. If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so. If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.servlet;\r
-\r
-import java.util.Locale;\r
-import java.util.Map;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-\r
-import mir.log.LoggerWrapper;\r
-import mir.servlet.ServletModule;\r
-import mir.servlet.ServletModuleFailure;\r
-import mir.util.HTTPRequestParser;\r
-import mir.util.URLBuilder;\r
-import mircoders.global.MirGlobal;\r
-\r
-public class ServletModuleAbuse extends ServletModule {\r
- private static ServletModuleAbuse instance = new ServletModuleAbuse();\r
- public static ServletModule getInstance() { return instance; }\r
-\r
- private ServletModuleAbuse() {\r
- logger = new LoggerWrapper("ServletModule.Abuse");\r
- defaultAction = "showsettings";\r
- }\r
-\r
- public void editfilter(HttpServletRequest aRequest, HttpServletResponse aResponse) {\r
- HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
-\r
- String type=requestParser.getParameterWithDefault("type", "");\r
- String id=requestParser.getParameterWithDefault("id", "");\r
- String expression=requestParser.getParameterWithDefault("expression", "");\r
-\r
- if (id.equals("")) {\r
- MirGlobal.abuse().addFilter(type, expression);\r
- }\r
- else {\r
- MirGlobal.abuse().setFilter(id, type, expression);\r
- }\r
-\r
- MirGlobal.abuse().save();\r
-\r
- showfilters(aRequest, aResponse);\r
- }\r
-\r
- public void deletefilter(HttpServletRequest aRequest, HttpServletResponse aResponse) {\r
- HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
-\r
- String id=requestParser.getParameterWithDefault("id", "");\r
- MirGlobal.abuse().deleteFilter(id);\r
-\r
- MirGlobal.abuse().save();\r
-\r
- showfilters(aRequest, aResponse);\r
- }\r
-\r
- public void showfilters(HttpServletRequest aRequest, HttpServletResponse aResponse) {\r
- URLBuilder urlBuilder = new URLBuilder();\r
-\r
- try {\r
- Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});\r
-\r
- urlBuilder.setValue("module", "Abuse");\r
- urlBuilder.setValue("do", "showfilters");\r
- responseData.put("thisurl", urlBuilder.getQuery());\r
-\r
- responseData.put("filters", MirGlobal.abuse().getFilters());\r
- responseData.put("filtertypes", MirGlobal.abuse().getFilterTypes());\r
-\r
- ServletHelper.generateResponse(aResponse.getWriter(), responseData, "abuse.filters.template");\r
- }\r
- catch (Throwable e) {\r
- throw new ServletModuleFailure(e);\r
- }\r
- }\r
-\r
-\r
- public void showsettings(HttpServletRequest aRequest, HttpServletResponse aResponse) {\r
- URLBuilder urlBuilder = new URLBuilder();\r
-\r
- try {\r
- Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});\r
-\r
- urlBuilder.setValue("module", "Abuse");\r
- urlBuilder.setValue("do", "showsettings");\r
-\r
- responseData.put("thisurl", urlBuilder.getQuery());\r
-\r
- responseData.put("articleactions", MirGlobal.abuse().getArticleActions());\r
- responseData.put("commentactions", MirGlobal.abuse().getCommentActions());\r
-\r
- responseData.put("disableop", new Boolean(MirGlobal.abuse().getOpenPostingDisabled()));\r
- responseData.put("passwordop", new Boolean(MirGlobal.abuse().getOpenPostingPassword()));\r
- responseData.put("logenabled", new Boolean(MirGlobal.abuse().getLogEnabled()));\r
- responseData.put("logsize", Integer.toString(MirGlobal.abuse().getLogSize()));\r
- responseData.put("usecookies", new Boolean(MirGlobal.abuse().getCookieOnBlock()));\r
- responseData.put("articleaction", MirGlobal.abuse().getArticleBlockAction());\r
- responseData.put("commentaction", MirGlobal.abuse().getCommentBlockAction());\r
-\r
- ServletHelper.generateResponse(aResponse.getWriter(), responseData, "abuse.template");\r
- }\r
- catch (Throwable e) {\r
- throw new ServletModuleFailure(e);\r
- }\r
- }\r
-\r
- public void savesettings(HttpServletRequest aRequest, HttpServletResponse aResponse) {\r
- try {\r
- HTTPRequestParser parser = new HTTPRequestParser(aRequest);\r
-\r
- MirGlobal.abuse().setOpenPostingDisabled(parser.getParameterWithDefault("disableop", "").equals("1"));\r
- MirGlobal.abuse().setOpenPostingPassword(parser.getParameterWithDefault("passwordop", "").equals("1"));\r
- MirGlobal.abuse().setLogEnabled(parser.getParameterWithDefault("logenabled", "").equals("1"));\r
-\r
- try {\r
- MirGlobal.abuse().setLogSize(parser.getIntegerWithDefault("logsize", MirGlobal.abuse().getLogSize()));\r
- }\r
- catch (Throwable t) {\r
- }\r
-\r
- MirGlobal.abuse().setCookieOnBlock(parser.getParameterWithDefault("usecookies", "").equals("1"));\r
-\r
- MirGlobal.abuse().setArticleBlockAction(parser.getParameter("articleaction"));\r
- MirGlobal.abuse().setCommentBlockAction(parser.getParameter("commentaction"));\r
-\r
- MirGlobal.abuse().save();\r
-\r
- showsettings(aRequest, aResponse);\r
- }\r
- catch (Throwable e) {\r
- throw new ServletModuleFailure(e);\r
- }\r
- }\r
-\r
- public void showlog(HttpServletRequest aRequest, HttpServletResponse aResponse) {\r
- URLBuilder urlBuilder = new URLBuilder();\r
- int count;\r
-\r
- try {\r
- Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});\r
- urlBuilder.setValue("module", "Abuse");\r
- urlBuilder.setValue("do", "showlog");\r
- responseData.put("thisurl", urlBuilder.getQuery());\r
-\r
- responseData.put("log", MirGlobal.abuse().getLog());\r
-\r
- ServletHelper.generateResponse(aResponse.getWriter(), responseData, "abuse.log.template");\r
- }\r
- catch (Throwable e) {\r
- throw new ServletModuleFailure(e);\r
- }\r
- }\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.servlet;
+
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import mir.log.LoggerWrapper;
+import mir.servlet.ServletModule;
+import mir.servlet.ServletModuleFailure;
+import mir.util.HTTPRequestParser;
+import mir.util.URLBuilder;
+import mircoders.global.MirGlobal;
+
+public class ServletModuleAbuse extends ServletModule {
+ private static ServletModuleAbuse instance = new ServletModuleAbuse();
+ public static ServletModule getInstance() { return instance; }
+
+ private ServletModuleAbuse() {
+ logger = new LoggerWrapper("ServletModule.Abuse");
+ defaultAction = "showsettings";
+ }
+
+ public void editfilter(HttpServletRequest aRequest, HttpServletResponse aResponse) {
+ HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+
+ String type=requestParser.getParameterWithDefault("type", "");
+ String id=requestParser.getParameterWithDefault("id", "");
+ String expression=requestParser.getParameterWithDefault("expression", "");
+
+ if (id.equals("")) {
+ MirGlobal.abuse().addFilter(type, expression);
+ }
+ else {
+ MirGlobal.abuse().setFilter(id, type, expression);
+ }
+
+ MirGlobal.abuse().save();
+
+ showfilters(aRequest, aResponse);
+ }
+
+ public void deletefilter(HttpServletRequest aRequest, HttpServletResponse aResponse) {
+ HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+
+ String id=requestParser.getParameterWithDefault("id", "");
+ MirGlobal.abuse().deleteFilter(id);
+
+ MirGlobal.abuse().save();
+
+ showfilters(aRequest, aResponse);
+ }
+
+ public void showfilters(HttpServletRequest aRequest, HttpServletResponse aResponse) {
+ URLBuilder urlBuilder = new URLBuilder();
+
+ try {
+ Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});
+
+ urlBuilder.setValue("module", "Abuse");
+ urlBuilder.setValue("do", "showfilters");
+ responseData.put("thisurl", urlBuilder.getQuery());
+
+ responseData.put("filters", MirGlobal.abuse().getFilters());
+ responseData.put("filtertypes", MirGlobal.abuse().getFilterTypes());
+
+ ServletHelper.generateResponse(aResponse.getWriter(), responseData, "abuse.filters.template");
+ }
+ catch (Throwable e) {
+ throw new ServletModuleFailure(e);
+ }
+ }
+
+
+ public void showsettings(HttpServletRequest aRequest, HttpServletResponse aResponse) {
+ URLBuilder urlBuilder = new URLBuilder();
+
+ try {
+ Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});
+
+ urlBuilder.setValue("module", "Abuse");
+ urlBuilder.setValue("do", "showsettings");
+
+ responseData.put("thisurl", urlBuilder.getQuery());
+
+ responseData.put("articleactions", MirGlobal.abuse().getArticleActions());
+ responseData.put("commentactions", MirGlobal.abuse().getCommentActions());
+
+ responseData.put("disableop", new Boolean(MirGlobal.abuse().getOpenPostingDisabled()));
+ responseData.put("passwordop", new Boolean(MirGlobal.abuse().getOpenPostingPassword()));
+ responseData.put("logenabled", new Boolean(MirGlobal.abuse().getLogEnabled()));
+ responseData.put("logsize", Integer.toString(MirGlobal.abuse().getLogSize()));
+ responseData.put("usecookies", new Boolean(MirGlobal.abuse().getCookieOnBlock()));
+ responseData.put("articleaction", MirGlobal.abuse().getArticleBlockAction());
+ responseData.put("commentaction", MirGlobal.abuse().getCommentBlockAction());
+
+ ServletHelper.generateResponse(aResponse.getWriter(), responseData, "abuse.template");
+ }
+ catch (Throwable e) {
+ throw new ServletModuleFailure(e);
+ }
+ }
+
+ public void savesettings(HttpServletRequest aRequest, HttpServletResponse aResponse) {
+ try {
+ HTTPRequestParser parser = new HTTPRequestParser(aRequest);
+
+ MirGlobal.abuse().setOpenPostingDisabled(parser.getParameterWithDefault("disableop", "").equals("1"));
+ MirGlobal.abuse().setOpenPostingPassword(parser.getParameterWithDefault("passwordop", "").equals("1"));
+ MirGlobal.abuse().setLogEnabled(parser.getParameterWithDefault("logenabled", "").equals("1"));
+
+ try {
+ MirGlobal.abuse().setLogSize(parser.getIntegerWithDefault("logsize", MirGlobal.abuse().getLogSize()));
+ }
+ catch (Throwable t) {
+ }
+
+ MirGlobal.abuse().setCookieOnBlock(parser.getParameterWithDefault("usecookies", "").equals("1"));
+
+ MirGlobal.abuse().setArticleBlockAction(parser.getParameter("articleaction"));
+ MirGlobal.abuse().setCommentBlockAction(parser.getParameter("commentaction"));
+
+ MirGlobal.abuse().save();
+
+ showsettings(aRequest, aResponse);
+ }
+ catch (Throwable e) {
+ throw new ServletModuleFailure(e);
+ }
+ }
+
+ public void showlog(HttpServletRequest aRequest, HttpServletResponse aResponse) {
+ URLBuilder urlBuilder = new URLBuilder();
+ int count;
+
+ try {
+ Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});
+ urlBuilder.setValue("module", "Abuse");
+ urlBuilder.setValue("do", "showlog");
+ responseData.put("thisurl", urlBuilder.getQuery());
+
+ responseData.put("log", MirGlobal.abuse().getLog());
+
+ ServletHelper.generateResponse(aResponse.getWriter(), responseData, "abuse.log.template");
+ }
+ catch (Throwable e) {
+ throw new ServletModuleFailure(e);
+ }
+ }
}
\ No newline at end of file
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two. You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries. If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so. If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.servlet;\r
-\r
-import java.util.Locale;\r
-import java.util.Map;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-\r
-import mir.log.LoggerWrapper;\r
-import mir.servlet.ServletModule;\r
-import mir.servlet.ServletModuleFailure;\r
-import mir.util.URLBuilder;\r
-\r
-public class ServletModuleAdmin extends ServletModule\r
-{\r
- private static ServletModuleAdmin instance = new ServletModuleAdmin();\r
- public static ServletModule getInstance() { return instance; }\r
-\r
- private ServletModuleAdmin() {\r
- logger = new LoggerWrapper("ServletModule.Admin");\r
- defaultAction = "showSuperUserMenu";\r
- }\r
-\r
- public void superusermenu(HttpServletRequest aRequest, HttpServletResponse aResponse) {\r
- URLBuilder urlBuilder = new URLBuilder();\r
- int count;\r
-\r
- try {\r
- Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});\r
- urlBuilder.setValue("module", "Admin");\r
- urlBuilder.setValue("do", "superusermenu");\r
-\r
- responseData.put("thisurl" , urlBuilder.getQuery());\r
-\r
- ServletHelper.generateResponse(aResponse.getWriter(), responseData, "superusermenu.template");\r
- }\r
- catch (Throwable e) {\r
- throw new ServletModuleFailure(e);\r
- }\r
- }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+package mircoders.servlet;
+
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import mir.log.LoggerWrapper;
+import mir.servlet.ServletModule;
+import mir.servlet.ServletModuleFailure;
+import mir.util.URLBuilder;
+
+public class ServletModuleAdmin extends ServletModule
+{
+ private static ServletModuleAdmin instance = new ServletModuleAdmin();
+ public static ServletModule getInstance() { return instance; }
+
+ private ServletModuleAdmin() {
+ logger = new LoggerWrapper("ServletModule.Admin");
+ defaultAction = "showSuperUserMenu";
+ }
+
+ public void superusermenu(HttpServletRequest aRequest, HttpServletResponse aResponse) {
+ URLBuilder urlBuilder = new URLBuilder();
+ int count;
+
+ try {
+ Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});
+ urlBuilder.setValue("module", "Admin");
+ urlBuilder.setValue("do", "superusermenu");
+
+ responseData.put("thisurl" , urlBuilder.getQuery());
+
+ ServletHelper.generateResponse(aResponse.getWriter(), responseData, "superusermenu.template");
+ }
+ catch (Throwable e) {
+ throw new ServletModuleFailure(e);
+ }
+ }
+}
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.servlet;
import mir.config.MirPropertiesConfiguration;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.servlet;
import mir.config.MirPropertiesConfiguration;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.servlet;
-import java.net.URLEncoder;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-\r
-import freemarker.template.SimpleHash;\r
-import mir.config.MirPropertiesConfiguration;\r
-import mir.entity.EntityList;\r
-import mir.log.LoggerWrapper;\r
-import mir.misc.HTMLTemplateProcessor;\r
-import mir.servlet.ServletModule;\r
-import mir.servlet.ServletModuleFailure;\r
-import mircoders.module.ModuleBreaking;\r
+import java.net.URLEncoder;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import mir.config.MirPropertiesConfiguration;
+import mir.entity.EntityList;
+import mir.log.LoggerWrapper;
+import mir.misc.HTMLTemplateProcessor;
+import mir.servlet.ServletModule;
+import mir.servlet.ServletModuleFailure;
+import mircoders.module.ModuleBreaking;
import mircoders.storage.DatabaseBreaking;
+import freemarker.template.SimpleHash;
/*
* ServletModuleBreaking -
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two. You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries. If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so. If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.servlet;\r
-\r
-import java.util.HashMap;\r
-import java.util.Iterator;\r
-import java.util.List;\r
-import java.util.Locale;\r
-import java.util.Map;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-\r
-import mir.config.MirPropertiesConfiguration;\r
-import mir.entity.adapter.EntityAdapterModel;\r
-import mir.entity.adapter.EntityIteratorAdapter;\r
-import mir.log.LoggerWrapper;\r
-import mir.servlet.ServletModule;\r
-import mir.servlet.ServletModuleExc;\r
-import mir.servlet.ServletModuleFailure;\r
-import mir.util.CachingRewindableIterator;\r
-import mir.util.HTTPRequestParser;\r
-import mir.util.JDBCStringRoutines;\r
-import mir.util.SQLQueryBuilder;\r
-import mir.util.URLBuilder;\r
-import mircoders.entity.EntityComment;\r
-import mircoders.global.MirGlobal;\r
-import mircoders.module.ModuleComment;\r
-import mircoders.module.ModuleContent;\r
-import mircoders.storage.DatabaseComment;\r
-import mircoders.storage.DatabaseContent;\r
-\r
-/*\r
- * ServletModuleComment - controls navigation for Comments\r
- *\r
- *\r
- * @author RK\r
- */\r
-\r
-public class ServletModuleComment extends ServletModule\r
-{\r
- private ModuleContent moduleContent;\r
-\r
- private static ServletModuleComment instance = new ServletModuleComment();\r
- public static ServletModule getInstance() { return instance; }\r
-\r
- private ServletModuleComment() {\r
- logger = new LoggerWrapper("ServletModule.Comment");\r
- try {\r
- configuration = MirPropertiesConfiguration.instance();\r
- templateListString = configuration.getString("ServletModule.Comment.ListTemplate");\r
- templateObjektString = configuration.getString("ServletModule.Comment.ObjektTemplate");\r
- templateConfirmString = configuration.getString("ServletModule.Comment.ConfirmTemplate");\r
-\r
- mainModule = new ModuleComment(DatabaseComment.getInstance());\r
- moduleContent = new ModuleContent(DatabaseContent.getInstance());\r
- }\r
- catch (Exception e) {\r
- logger.error("servletmodule comment could not be initialized:" + e.getMessage());\r
- }\r
- }\r
-\r
- public void edit(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc\r
- {\r
- String idParam = req.getParameter("id");\r
-\r
- if (idParam == null)\r
- throw new ServletModuleExc("Invalid call: id not supplied ");\r
-\r
- showComment(idParam, req, res);\r
- }\r
-\r
- public void showComment(String anId, HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc {\r
- try {\r
- HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
- Map responseData = ServletHelper.makeGenerationData(new Locale[] {getLocale(aRequest), getFallbackLocale(aRequest)});\r
- EntityAdapterModel model = MirGlobal.localizer().dataModel().adapterModel();\r
- Map comment;\r
- URLBuilder urlBuilder = new URLBuilder();\r
-\r
- urlBuilder.setValue("module", "Comment");\r
- urlBuilder.setValue("do", "edit");\r
- urlBuilder.setValue("id", anId);\r
- urlBuilder.setValue("returnurl", requestParser.getParameter("returnurl"));\r
-\r
- if (anId != null) {\r
- responseData.put("new", Boolean.FALSE);\r
- comment = model.makeEntityAdapter("comment", mainModule.getById(anId));\r
- }\r
- else {\r
- List fields = DatabaseComment.getInstance().getFields();\r
- responseData.put("new", Boolean.TRUE);\r
- comment = new HashMap();\r
- Iterator i = fields.iterator();\r
- while (i.hasNext()) {\r
- comment.put(i.next(), null);\r
- }\r
-\r
-// MirGlobal.localizer().adminInterface().initializeArticle(article);\r
- }\r
- responseData.put("comment", comment);\r
-\r
- responseData.put("returnurl", requestParser.getParameter("returnurl"));\r
- responseData.put("thisurl", urlBuilder.getQuery());\r
-\r
- ServletHelper.generateResponse(aResponse.getWriter(), responseData, templateObjektString);\r
- }\r
- catch (Throwable e) {\r
- throw new ServletModuleFailure(e);\r
- }\r
- }\r
-\r
- public void attach(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc\r
- {\r
- String mediaIdParam = req.getParameter("mid");\r
- String commentId = req.getParameter("commentid");\r
-\r
- if (commentId == null || mediaIdParam==null) throw new ServletModuleExc("smod comment :: attach :: commentid/mid missing");\r
-\r
- try {\r
- EntityComment comment = (EntityComment) mainModule.getById(commentId);\r
- comment.attach(mediaIdParam);\r
- }\r
- catch(Throwable e) {\r
- throw new ServletModuleFailure(e);\r
- }\r
-\r
- showComment(commentId, req, res);\r
- }\r
-\r
- public void dettach(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc\r
- {\r
- String commentId = req.getParameter("commentid");\r
- String midParam = req.getParameter("mid");\r
- if (commentId == null)\r
- throw new ServletModuleExc("smod comment :: dettach :: commentid missing");\r
- if (midParam == null)\r
- throw new ServletModuleExc("smod comment :: dettach :: mid missing");\r
-\r
- try {\r
- EntityComment comment = (EntityComment)mainModule.getById(commentId);\r
- comment.dettach(commentId, midParam);\r
- }\r
- catch(Throwable e) {\r
- throw new ServletModuleFailure(e);\r
- }\r
-\r
- showComment(commentId, req, res);\r
- }\r
-\r
-\r
- public void list(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc\r
- {\r
- HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
-\r
- String where = requestParser.getParameter("where");\r
- String order = requestParser.getParameterWithDefault("order", "webdb_create desc");\r
- int offset = requestParser.getIntegerWithDefault("offset", 0);\r
-\r
- returnCommentList(aRequest, aResponse, where, order, offset);\r
- }\r
-\r
- public void search(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc\r
- {\r
- HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
- SQLQueryBuilder queryBuilder = new SQLQueryBuilder();\r
-\r
- String queryField = "";\r
- String searchField = requestParser.getParameter("searchfield");\r
- String searchText = requestParser.getParameter("searchtext");\r
- String searchIsPublished = requestParser.getParameter("searchispublished");\r
- String searchStatus = requestParser.getParameter("searchstatus");\r
- String searchOrder = requestParser.getParameter("searchorder");\r
-\r
- if (searchIsPublished.equals("0")) {\r
- queryBuilder.appendAndCondition("is_published='f'");\r
- }\r
- else if (searchIsPublished.equals("1")) {\r
- queryBuilder.appendAndCondition("is_published='t'");\r
- }\r
-\r
- if (searchText.length()>0) {\r
- queryBuilder.appendAndCondition(\r
- "lower("+ searchField + ") like " +\r
- "'%" + JDBCStringRoutines.escapeStringLiteral(searchText.toLowerCase()) + "%'");\r
- }\r
-\r
- if (searchStatus.length()>0) {\r
- queryBuilder.appendAndCondition("to_comment_status="+Integer.parseInt(searchStatus));\r
- }\r
-\r
- if (searchOrder.length()>0) {\r
- if (searchOrder.equals("datedesc"))\r
- queryBuilder.appendAscendingOrder("webdb_create");\r
- else if (searchOrder.equals("dateasc"))\r
- queryBuilder.appendDescendingOrder("webdb_create");\r
- else if (searchOrder.equals("articletitle"))\r
- queryBuilder.appendAscendingOrder("(select content.title from content where content.id = comment.to_media)");\r
- else if (searchOrder.equals("creator"))\r
- queryBuilder.appendDescendingOrder("creator");\r
- }\r
-\r
- returnCommentList(aRequest, aResponse, queryBuilder.getWhereClause(), queryBuilder.getOrderByClause(), 0);\r
- }\r
-\r
- public void articlecomments(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc\r
- {\r
- String articleIdString = req.getParameter("articleid");\r
- int articleId;\r
-\r
- try {\r
- articleId = Integer.parseInt(articleIdString);\r
-\r
- returnCommentList( req, res, "to_media="+articleId, "webdb_create desc", 0);\r
- }\r
- catch (Throwable e) {\r
- throw new ServletModuleFailure(e);\r
- }\r
- }\r
-\r
- public void returnCommentList(HttpServletRequest aRequest, HttpServletResponse aResponse,\r
- String aWhereClause, String anOrderByClause, int anOffset) throws ServletModuleExc {\r
-\r
- HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
- URLBuilder urlBuilder = new URLBuilder();\r
- EntityAdapterModel model;\r
- int nrCommentsPerPage = 20;\r
- int count;\r
-\r
- try {\r
- Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});\r
- model = MirGlobal.localizer().dataModel().adapterModel();\r
-\r
- Object commentList =\r
- new CachingRewindableIterator(\r
- new EntityIteratorAdapter( aWhereClause, anOrderByClause, nrCommentsPerPage,\r
- MirGlobal.localizer().dataModel().adapterModel(), "comment", nrCommentsPerPage, anOffset)\r
- );\r
-\r
- responseData.put("nexturl", null);\r
- responseData.put("prevurl", null);\r
-\r
- count=mainModule.getSize(aWhereClause);\r
-\r
- urlBuilder.setValue("module", "Comment");\r
- urlBuilder.setValue("do", "list");\r
- urlBuilder.setValue("where", aWhereClause);\r
- urlBuilder.setValue("order", anOrderByClause);\r
-\r
- urlBuilder.setValue("searchfield", requestParser.getParameter("searchfield"));\r
- urlBuilder.setValue("searchtext", requestParser.getParameter("searchtext"));\r
- urlBuilder.setValue("searchispublished", requestParser.getParameter("searchispublished"));\r
- urlBuilder.setValue("searchstatus", requestParser.getParameter("searchstatus"));\r
- urlBuilder.setValue("searchorder", requestParser.getParameter("searchorder"));\r
-\r
- responseData.put("searchfield", requestParser.getParameter("searchfield"));\r
- responseData.put("searchtext", requestParser.getParameter("searchtext"));\r
- responseData.put("searchispublished", requestParser.getParameter("searchispublished"));\r
- responseData.put("searchstatus", requestParser.getParameter("searchstatus"));\r
- responseData.put("searchorder", requestParser.getParameter("searchorder"));\r
-\r
- urlBuilder.setValue("offset", anOffset);\r
- responseData.put("offset" , new Integer(anOffset).toString());\r
- responseData.put("thisurl" , urlBuilder.getQuery());\r
-\r
- if (count>=anOffset+nrCommentsPerPage) {\r
- urlBuilder.setValue("offset", anOffset + nrCommentsPerPage);\r
- responseData.put("nexturl" , urlBuilder.getQuery());\r
- }\r
-\r
- if (anOffset>0) {\r
- urlBuilder.setValue("offset", Math.max(anOffset - nrCommentsPerPage, 0));\r
- responseData.put("prevurl" , urlBuilder.getQuery());\r
- }\r
-\r
- responseData.put("comments", commentList);\r
- responseData.put("from" , Integer.toString(anOffset+1));\r
- responseData.put("count", Integer.toString(count));\r
- responseData.put("to", Integer.toString(Math.min(anOffset+nrCommentsPerPage, count)));\r
-\r
- ServletHelper.generateResponse(aResponse.getWriter(), responseData, "commentlist.template");\r
- }\r
- catch (Throwable e) {\r
- throw new ServletModuleFailure(e);\r
- }\r
- }\r
-}\r
-\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.servlet;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import mir.config.MirPropertiesConfiguration;
+import mir.entity.adapter.EntityAdapterModel;
+import mir.entity.adapter.EntityIteratorAdapter;
+import mir.log.LoggerWrapper;
+import mir.servlet.ServletModule;
+import mir.servlet.ServletModuleExc;
+import mir.servlet.ServletModuleFailure;
+import mir.util.CachingRewindableIterator;
+import mir.util.HTTPRequestParser;
+import mir.util.JDBCStringRoutines;
+import mir.util.SQLQueryBuilder;
+import mir.util.URLBuilder;
+import mircoders.entity.EntityComment;
+import mircoders.global.MirGlobal;
+import mircoders.module.ModuleComment;
+import mircoders.module.ModuleContent;
+import mircoders.storage.DatabaseComment;
+import mircoders.storage.DatabaseContent;
+
+/*
+ * ServletModuleComment - controls navigation for Comments
+ *
+ *
+ * @author RK
+ */
+
+public class ServletModuleComment extends ServletModule
+{
+ private ModuleContent moduleContent;
+
+ private static ServletModuleComment instance = new ServletModuleComment();
+ public static ServletModule getInstance() { return instance; }
+
+ private ServletModuleComment() {
+ logger = new LoggerWrapper("ServletModule.Comment");
+ try {
+ configuration = MirPropertiesConfiguration.instance();
+ templateListString = configuration.getString("ServletModule.Comment.ListTemplate");
+ templateObjektString = configuration.getString("ServletModule.Comment.ObjektTemplate");
+ templateConfirmString = configuration.getString("ServletModule.Comment.ConfirmTemplate");
+
+ mainModule = new ModuleComment(DatabaseComment.getInstance());
+ moduleContent = new ModuleContent(DatabaseContent.getInstance());
+ }
+ catch (Exception e) {
+ logger.error("servletmodule comment could not be initialized:" + e.getMessage());
+ }
+ }
+
+ public void edit(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc
+ {
+ String idParam = req.getParameter("id");
+
+ if (idParam == null)
+ throw new ServletModuleExc("Invalid call: id not supplied ");
+
+ showComment(idParam, req, res);
+ }
+
+ public void showComment(String anId, HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc {
+ try {
+ HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+ Map responseData = ServletHelper.makeGenerationData(new Locale[] {getLocale(aRequest), getFallbackLocale(aRequest)});
+ EntityAdapterModel model = MirGlobal.localizer().dataModel().adapterModel();
+ Map comment;
+ URLBuilder urlBuilder = new URLBuilder();
+
+ urlBuilder.setValue("module", "Comment");
+ urlBuilder.setValue("do", "edit");
+ urlBuilder.setValue("id", anId);
+ urlBuilder.setValue("returnurl", requestParser.getParameter("returnurl"));
+
+ if (anId != null) {
+ responseData.put("new", Boolean.FALSE);
+ comment = model.makeEntityAdapter("comment", mainModule.getById(anId));
+ }
+ else {
+ List fields = DatabaseComment.getInstance().getFields();
+ responseData.put("new", Boolean.TRUE);
+ comment = new HashMap();
+ Iterator i = fields.iterator();
+ while (i.hasNext()) {
+ comment.put(i.next(), null);
+ }
+
+// MirGlobal.localizer().adminInterface().initializeArticle(article);
+ }
+ responseData.put("comment", comment);
+
+ responseData.put("returnurl", requestParser.getParameter("returnurl"));
+ responseData.put("thisurl", urlBuilder.getQuery());
+
+ ServletHelper.generateResponse(aResponse.getWriter(), responseData, templateObjektString);
+ }
+ catch (Throwable e) {
+ throw new ServletModuleFailure(e);
+ }
+ }
+
+ public void attach(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc
+ {
+ String mediaIdParam = req.getParameter("mid");
+ String commentId = req.getParameter("commentid");
+
+ if (commentId == null || mediaIdParam==null) throw new ServletModuleExc("smod comment :: attach :: commentid/mid missing");
+
+ try {
+ EntityComment comment = (EntityComment) mainModule.getById(commentId);
+ comment.attach(mediaIdParam);
+ }
+ catch(Throwable e) {
+ throw new ServletModuleFailure(e);
+ }
+
+ showComment(commentId, req, res);
+ }
+
+ public void dettach(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc
+ {
+ String commentId = req.getParameter("commentid");
+ String midParam = req.getParameter("mid");
+ if (commentId == null)
+ throw new ServletModuleExc("smod comment :: dettach :: commentid missing");
+ if (midParam == null)
+ throw new ServletModuleExc("smod comment :: dettach :: mid missing");
+
+ try {
+ EntityComment comment = (EntityComment)mainModule.getById(commentId);
+ comment.dettach(commentId, midParam);
+ }
+ catch(Throwable e) {
+ throw new ServletModuleFailure(e);
+ }
+
+ showComment(commentId, req, res);
+ }
+
+
+ public void list(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
+ {
+ HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+
+ String where = requestParser.getParameter("where");
+ String order = requestParser.getParameterWithDefault("order", "webdb_create desc");
+ int offset = requestParser.getIntegerWithDefault("offset", 0);
+
+ returnCommentList(aRequest, aResponse, where, order, offset);
+ }
+
+ public void search(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleExc
+ {
+ HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+ SQLQueryBuilder queryBuilder = new SQLQueryBuilder();
+
+ String queryField = "";
+ String searchField = requestParser.getParameter("searchfield");
+ String searchText = requestParser.getParameter("searchtext");
+ String searchIsPublished = requestParser.getParameter("searchispublished");
+ String searchStatus = requestParser.getParameter("searchstatus");
+ String searchOrder = requestParser.getParameter("searchorder");
+
+ if (searchIsPublished.equals("0")) {
+ queryBuilder.appendAndCondition("is_published='f'");
+ }
+ else if (searchIsPublished.equals("1")) {
+ queryBuilder.appendAndCondition("is_published='t'");
+ }
+
+ if (searchText.length()>0) {
+ queryBuilder.appendAndCondition(
+ "lower("+ searchField + ") like " +
+ "'%" + JDBCStringRoutines.escapeStringLiteral(searchText.toLowerCase()) + "%'");
+ }
+
+ if (searchStatus.length()>0) {
+ queryBuilder.appendAndCondition("to_comment_status="+Integer.parseInt(searchStatus));
+ }
+
+ if (searchOrder.length()>0) {
+ if (searchOrder.equals("datedesc"))
+ queryBuilder.appendAscendingOrder("webdb_create");
+ else if (searchOrder.equals("dateasc"))
+ queryBuilder.appendDescendingOrder("webdb_create");
+ else if (searchOrder.equals("articletitle"))
+ queryBuilder.appendAscendingOrder("(select content.title from content where content.id = comment.to_media)");
+ else if (searchOrder.equals("creator"))
+ queryBuilder.appendDescendingOrder("creator");
+ }
+
+ returnCommentList(aRequest, aResponse, queryBuilder.getWhereClause(), queryBuilder.getOrderByClause(), 0);
+ }
+
+ public void articlecomments(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc
+ {
+ String articleIdString = req.getParameter("articleid");
+ int articleId;
+
+ try {
+ articleId = Integer.parseInt(articleIdString);
+
+ returnCommentList( req, res, "to_media="+articleId, "webdb_create desc", 0);
+ }
+ catch (Throwable e) {
+ throw new ServletModuleFailure(e);
+ }
+ }
+
+ public void returnCommentList(HttpServletRequest aRequest, HttpServletResponse aResponse,
+ String aWhereClause, String anOrderByClause, int anOffset) throws ServletModuleExc {
+
+ HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
+ URLBuilder urlBuilder = new URLBuilder();
+ EntityAdapterModel model;
+ int nrCommentsPerPage = 20;
+ int count;
+
+ try {
+ Map responseData = ServletHelper.makeGenerationData(new Locale[] { getLocale(aRequest), getFallbackLocale(aRequest)});
+ model = MirGlobal.localizer().dataModel().adapterModel();
+
+ Object commentList =
+ new CachingRewindableIterator(
+ new EntityIteratorAdapter( aWhereClause, anOrderByClause, nrCommentsPerPage,
+ MirGlobal.localizer().dataModel().adapterModel(), "comment", nrCommentsPerPage, anOffset)
+ );
+
+ responseData.put("nexturl", null);
+ responseData.put("prevurl", null);
+
+ count=mainModule.getSize(aWhereClause);
+
+ urlBuilder.setValue("module", "Comment");
+ urlBuilder.setValue("do", "list");
+ urlBuilder.setValue("where", aWhereClause);
+ urlBuilder.setValue("order", anOrderByClause);
+
+ urlBuilder.setValue("searchfield", requestParser.getParameter("searchfield"));
+ urlBuilder.setValue("searchtext", requestParser.getParameter("searchtext"));
+ urlBuilder.setValue("searchispublished", requestParser.getParameter("searchispublished"));
+ urlBuilder.setValue("searchstatus", requestParser.getParameter("searchstatus"));
+ urlBuilder.setValue("searchorder", requestParser.getParameter("searchorder"));
+
+ responseData.put("searchfield", requestParser.getParameter("searchfield"));
+ responseData.put("searchtext", requestParser.getParameter("searchtext"));
+ responseData.put("searchispublished", requestParser.getParameter("searchispublished"));
+ responseData.put("searchstatus", requestParser.getParameter("searchstatus"));
+ responseData.put("searchorder", requestParser.getParameter("searchorder"));
+
+ urlBuilder.setValue("offset", anOffset);
+ responseData.put("offset" , new Integer(anOffset).toString());
+ responseData.put("thisurl" , urlBuilder.getQuery());
+
+ if (count>=anOffset+nrCommentsPerPage) {
+ urlBuilder.setValue("offset", anOffset + nrCommentsPerPage);
+ responseData.put("nexturl" , urlBuilder.getQuery());
+ }
+
+ if (anOffset>0) {
+ urlBuilder.setValue("offset", Math.max(anOffset - nrCommentsPerPage, 0));
+ responseData.put("prevurl" , urlBuilder.getQuery());
+ }
+
+ responseData.put("comments", commentList);
+ responseData.put("from" , Integer.toString(anOffset+1));
+ responseData.put("count", Integer.toString(count));
+ responseData.put("to", Integer.toString(Math.min(anOffset+nrCommentsPerPage, count)));
+
+ ServletHelper.generateResponse(aResponse.getWriter(), responseData, "commentlist.template");
+ }
+ catch (Throwable e) {
+ throw new ServletModuleFailure(e);
+ }
+ }
+}
+
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.servlet;
import mir.config.MirPropertiesConfiguration;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.servlet;
-import java.util.Arrays;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import org.apache.lucene.index.IndexReader;
-import freemarker.template.SimpleHash;
-
import mir.entity.adapter.EntityAdapterModel;
import mir.entity.adapter.EntityIteratorAdapter;
import mir.log.LoggerWrapper;
import mircoders.storage.DatabaseContentToMedia;
import mircoders.storage.DatabaseContentToTopics;
+import org.apache.lucene.index.IndexReader;
+
+import freemarker.template.SimpleHash;
+
/*
* ServletModuleContent -
* deliver html for the article admin form.
*
- * @version $Id: ServletModuleContent.java,v 1.49 2003/04/21 00:24:06 zapata Exp $
+ * @version $Id: ServletModuleContent.java,v 1.50 2003/04/21 12:42:51 idfx Exp $
* @author rk, mir-coders
*
*/
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.servlet;
import java.io.StringWriter;
import java.util.Arrays;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Vector;
-import java.util.Locale;
+
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
* Allows one to do a basic edit of a file in a directory specified
* in the config file.
*
- * @author $Author: zapata $
- * @version $Revision: 1.9 $ $Date: 2003/04/09 02:06:09 $
+ * @author $Author: idfx $
+ * @version $Revision: 1.10 $ $Date: 2003/04/21 12:42:51 $
*
*/
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.servlet;
import javax.servlet.http.HttpServletRequest;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.servlet;
import mir.log.LoggerWrapper;
/*
* ServletModuleImages -
*
- * @version $Id: ServletModuleImages.java,v 1.25 2003/01/25 17:50:36 idfx Exp $
+ * @version $Id: ServletModuleImages.java,v 1.26 2003/04/21 12:42:51 idfx Exp $
* @author RK, the mir-coders group
*/
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.servlet;
import mir.log.LoggerWrapper;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.servlet;
import java.io.PrintWriter;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.servlet;
import java.util.List;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.servlet;
/**
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two. You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries. If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so. If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.servlet;\r
-\r
-import java.net.URLEncoder;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-\r
-import freemarker.template.SimpleHash;\r
-import mir.entity.EntityList;\r
-import mir.log.LoggerWrapper;\r
-import mir.misc.HTMLTemplateProcessor;\r
-import mir.servlet.ServletModule;\r
-import mir.servlet.ServletModuleExc;\r
-import mir.servlet.ServletModuleFailure;\r
-import mir.storage.StorageObjectFailure;\r
-import mircoders.module.ModuleMessage;\r
-import mircoders.storage.DatabaseMessages;\r
-\r
-/**\r
- * Title: ServletModuleMessage\r
- * Description:\r
- * Copyright: Copyright (c) 2001-2002\r
- * Company: mir-coders\r
- * @author\r
- * @version 1.0\r
- */\r
-\r
-\r
-public class ServletModuleMessage extends ServletModule\r
-{\r
-\r
- // Singelton / Kontruktor\r
-\r
- private static ServletModuleMessage instance = new ServletModuleMessage();\r
- public static ServletModule getInstance() { return instance; }\r
-\r
- private ServletModuleMessage() {\r
- super();\r
- logger = new LoggerWrapper("ServletModule.Messages");\r
-\r
- templateListString = configuration.getString("ServletModule.Messages.ListTemplate");\r
- templateObjektString = configuration.getString("ServletModule.Messages.ObjektTemplate");\r
- templateConfirmString = configuration.getString("ServletModule.Messages.ConfirmTemplate");\r
-\r
- try {\r
- mainModule = new ModuleMessage(DatabaseMessages.getInstance());\r
- }\r
- catch (StorageObjectFailure e) {\r
- logger.error("initialization of ServletModuleMessage failed!: " + e.getMessage());\r
-\r
- throw new ServletModuleFailure(e);\r
- }\r
- }\r
-\r
- public void list(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc\r
- {\r
-// fetch and deliver\r
- try {\r
- SimpleHash mergeData = new SimpleHash();\r
- String offset = req.getParameter("offset");\r
- if (offset==null || offset.equals("")) offset="0";\r
- mergeData.put("offset",offset);\r
- EntityList theList = mainModule.getByWhereClause(null, "webdb_create desc", (new Integer(offset)).intValue());\r
- mergeData.put("contentlist",theList);\r
- if(theList.getOrder()!=null) {\r
- mergeData.put("order", theList.getOrder());\r
- mergeData.put("order_encoded", URLEncoder.encode(theList.getOrder()));\r
- }\r
- mergeData.put("count", (new Integer(theList.getCount())).toString());\r
- mergeData.put("from", (new Integer(theList.getFrom())).toString());\r
- mergeData.put("to", (new Integer(theList.getTo())).toString());\r
- if (theList.hasNextBatch())\r
- mergeData.put("next", (new Integer(theList.getNextBatch())).toString());\r
- if (theList.hasPrevBatch())\r
- mergeData.put("prev", (new Integer(theList.getPrevBatch())).toString());\r
-\r
- HTMLTemplateProcessor.process(res, templateListString, mergeData, res.getWriter(), getLocale(req), getFallbackLocale(req));\r
-\r
- }\r
- catch (Throwable e) {\r
- throw new ServletModuleFailure(e);\r
- }\r
- }\r
-\r
-\r
-}\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+package mircoders.servlet;
+
+import java.net.URLEncoder;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import mir.entity.EntityList;
+import mir.log.LoggerWrapper;
+import mir.misc.HTMLTemplateProcessor;
+import mir.servlet.ServletModule;
+import mir.servlet.ServletModuleExc;
+import mir.servlet.ServletModuleFailure;
+import mir.storage.StorageObjectFailure;
+import mircoders.module.ModuleMessage;
+import mircoders.storage.DatabaseMessages;
+import freemarker.template.SimpleHash;
+
+/**
+ * Title: ServletModuleMessage
+ * Description:
+ * Copyright: Copyright (c) 2001-2002
+ * Company: mir-coders
+ * @author
+ * @version 1.0
+ */
+
+
+public class ServletModuleMessage extends ServletModule
+{
+
+ // Singelton / Kontruktor
+
+ private static ServletModuleMessage instance = new ServletModuleMessage();
+ public static ServletModule getInstance() { return instance; }
+
+ private ServletModuleMessage() {
+ super();
+ logger = new LoggerWrapper("ServletModule.Messages");
+
+ templateListString = configuration.getString("ServletModule.Messages.ListTemplate");
+ templateObjektString = configuration.getString("ServletModule.Messages.ObjektTemplate");
+ templateConfirmString = configuration.getString("ServletModule.Messages.ConfirmTemplate");
+
+ try {
+ mainModule = new ModuleMessage(DatabaseMessages.getInstance());
+ }
+ catch (StorageObjectFailure e) {
+ logger.error("initialization of ServletModuleMessage failed!: " + e.getMessage());
+
+ throw new ServletModuleFailure(e);
+ }
+ }
+
+ public void list(HttpServletRequest req, HttpServletResponse res) throws ServletModuleExc
+ {
+// fetch and deliver
+ try {
+ SimpleHash mergeData = new SimpleHash();
+ String offset = req.getParameter("offset");
+ if (offset==null || offset.equals("")) offset="0";
+ mergeData.put("offset",offset);
+ EntityList theList = mainModule.getByWhereClause(null, "webdb_create desc", (new Integer(offset)).intValue());
+ mergeData.put("contentlist",theList);
+ if(theList.getOrder()!=null) {
+ mergeData.put("order", theList.getOrder());
+ mergeData.put("order_encoded", URLEncoder.encode(theList.getOrder()));
+ }
+ mergeData.put("count", (new Integer(theList.getCount())).toString());
+ mergeData.put("from", (new Integer(theList.getFrom())).toString());
+ mergeData.put("to", (new Integer(theList.getTo())).toString());
+ if (theList.hasNextBatch())
+ mergeData.put("next", (new Integer(theList.getNextBatch())).toString());
+ if (theList.hasPrevBatch())
+ mergeData.put("prev", (new Integer(theList.getPrevBatch())).toString());
+
+ HTMLTemplateProcessor.process(res, templateListString, mergeData, res.getWriter(), getLocale(req), getFallbackLocale(req));
+
+ }
+ catch (Throwable e) {
+ throw new ServletModuleFailure(e);
+ }
+ }
+
+
+}
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.servlet;
* open-postings to the newswire
*
* @author mir-coders group
- * @version $Id: ServletModuleOpenIndy.java,v 1.79 2003/04/21 02:58:30 zapata Exp $
+ * @version $Id: ServletModuleOpenIndy.java,v 1.80 2003/04/21 12:42:51 idfx Exp $
*
*/
deliver(aRequest, aResponse, mergeData, null, postingFormDoneTemplate);
}
catch (Throwable e) {
- e.printStackTrace(logger.asPrintWriter(logger.DEBUG_MESSAGE));
+ e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
Throwable cause = ExceptionFunctions.traceCauseException(e);
if (cause instanceof UnsupportedMediaFormatExc) {
}
catch (Throwable t) {
logger.error(t.toString());
- t.printStackTrace(logger.asPrintWriter(logger.DEBUG_MESSAGE));
+ t.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
throw new ServletModuleFailure(t);
}
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.servlet;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.servlet;
import java.io.PrintWriter;
import mir.producer.ProducerFactory;
import mir.servlet.ServletModule;
import mir.servlet.ServletModuleFailure;
-import mir.util.NullWriter;
import mir.util.ResourceBundleGeneratorFunction;
import mircoders.global.MirGlobal;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.servlet;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.servlet;
import java.util.List;
import java.util.Map;
import java.util.Vector;
+
import javax.servlet.ServletContext;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import org.apache.commons.fileupload.FileItem;
-import freemarker.template.SimpleHash;
-import freemarker.template.SimpleList;
-
import mir.config.MirPropertiesConfiguration;
import mir.entity.Entity;
import mir.entity.EntityList;
import mircoders.storage.DatabaseContent;
import mircoders.storage.DatabaseMediafolder;
+import org.apache.commons.fileupload.FileItem;
+
+import freemarker.template.SimpleHash;
+import freemarker.template.SimpleList;
+
/*
* ServletModuleBilder -
* liefert HTML fuer Bilder
*
- * @version $Id: ServletModuleUploadedMedia.java,v 1.25 2003/04/21 02:58:30 zapata Exp $
+ * @version $Id: ServletModuleUploadedMedia.java,v 1.26 2003/04/21 12:42:51 idfx Exp $
* @author RK, the mir-coders group
*/
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.servlet;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.servlet;
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two. You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries. If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so. If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package mircoders.storage;\r
-\r
-/**\r
- * Title:\r
- * Description:\r
- * Copyright: Copyright (c) 2001\r
- * Company: Indymedia\r
- * @author\r
- * @version 1.0\r
- */\r
-\r
-import freemarker.template.SimpleList;\r
-import mir.log.LoggerWrapper;\r
-import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
-import mir.storage.StorageObjectFailure;\r
-\r
-\r
-public class DatabaseArticleType extends Database implements StorageObject{\r
-\r
- private static DatabaseArticleType instance;\r
- private static SimpleList articletypePopupData;\r
-\r
- public synchronized static DatabaseArticleType getInstance() throws StorageObjectFailure {\r
- if (instance == null) {\r
- instance = new DatabaseArticleType();\r
- instance.myselfDatabase = instance;\r
- }\r
- return instance;\r
- }\r
-\r
- private DatabaseArticleType() throws StorageObjectFailure {\r
- super();\r
- logger = new LoggerWrapper("Database.ArticleType");\r
- this.hasTimestamp = false;\r
- this.theTable = "article_type";\r
- }\r
-\r
- public SimpleList getPopupData() throws StorageObjectFailure {\r
- return getPopupData("name", false);\r
- }\r
-}\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+
+package mircoders.storage;
+
+/**
+ * Title:
+ * Description:
+ * Copyright: Copyright (c) 2001
+ * Company: Indymedia
+ * @author
+ * @version 1.0
+ */
+
+import mir.log.LoggerWrapper;
+import mir.storage.Database;
+import mir.storage.StorageObject;
+import mir.storage.StorageObjectFailure;
+import freemarker.template.SimpleList;
+
+
+public class DatabaseArticleType extends Database implements StorageObject{
+
+ private static DatabaseArticleType instance;
+ private static SimpleList articletypePopupData;
+
+ public synchronized static DatabaseArticleType getInstance() throws StorageObjectFailure {
+ if (instance == null) {
+ instance = new DatabaseArticleType();
+ instance.myselfDatabase = instance;
+ }
+ return instance;
+ }
+
+ private DatabaseArticleType() throws StorageObjectFailure {
+ super();
+ logger = new LoggerWrapper("Database.ArticleType");
+ this.hasTimestamp = false;
+ this.theTable = "article_type";
+ }
+
+ public SimpleList getPopupData() throws StorageObjectFailure {
+ return getPopupData("name", false);
+ }
+}
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.storage;
import java.util.GregorianCalendar;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.storage;
-import java.sql.Connection;\r
-import java.sql.SQLException;\r
-import java.sql.Statement;\r
-\r
-import freemarker.template.SimpleList;\r
-import mir.log.LoggerWrapper;\r
-import mir.storage.Database;\r
-import mir.storage.StorageObject;\r
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import mir.log.LoggerWrapper;
+import mir.storage.Database;
+import mir.storage.StorageObject;
import mir.storage.StorageObjectFailure;
+import freemarker.template.SimpleList;
/**
* <b>This class implements the access to the comment-table for the
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.storage;
* <b>implements abstract DB connection to the comment_x_media SQL table
*
* @author RK, mir-coders group
- * @version $Id: DatabaseCommentToMedia.java,v 1.1 2003/04/10 03:31:47 zapata Exp $
+ * @version $Id: DatabaseCommentToMedia.java,v 1.2 2003/04/21 12:42:47 idfx Exp $
*
*/
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.storage;
* <b>implements abstract DB connection to the content_x_media SQL table
*
* @author RK, mir-coders group
- * @version $Id: DatabaseContentToMedia.java,v 1.17 2003/04/09 02:06:10 zapata Exp $
+ * @version $Id: DatabaseContentToMedia.java,v 1.18 2003/04/21 12:42:48 idfx Exp $
*
*/
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.storage;
import mir.log.LoggerWrapper;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.storage;
import mir.log.LoggerWrapper;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.storage;
-import mir.log.LoggerWrapper;\r
-import mir.storage.Database;\r
+import mir.log.LoggerWrapper;
+import mir.storage.Database;
import mir.storage.StorageObject;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
-
package mircoders.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.storage;
/*
- * Copyright (C) 2001, 2002 The Mir-coders group
+ * Copyright (C) 2001, 2002 The Mir-coders group
*
* This file is part of Mir.
*
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two. You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries. If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so. If you do
- * not wish to do so, delete this exception statement from your version.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
*/
package mircoders.storage;
-/*\r
- * Copyright (C) 2001, 2002 The Mir-coders group\r
- *\r
- * This file is part of Mir.\r
- *\r
- * Mir is free software; you can redistribute it and/or modify\r
- * it under the terms of the GNU General Public License as published by\r
- * the Free Software Foundation; either version 2 of the License, or\r
- * (at your option) any later version.\r
- *\r
- * Mir is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
- * GNU General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU General Public License\r
- * along with Mir; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * In addition, as a special exception, The Mir-coders gives permission to link\r
- * the code of this program with the com.oreilly.servlet library, any library\r
- * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
- * the above that use the same license as the above), and distribute linked\r
- * combinations including the two. You must obey the GNU General Public\r
- * License in all respects for all of the code used other than the above\r
- * mentioned libraries. If you modify this file, you may extend this exception\r
- * to your version of the file, but you are not obligated to do so. If you do\r
- * not wish to do so, delete this exception statement from your version.\r
- */\r
-\r
-package tool;\r
-\r
+/*
+ * Copyright (C) 2001, 2002 The Mir-coders group
+ *
+ * This file is part of Mir.
+ *
+ * Mir is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Mir is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Mir; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * In addition, as a special exception, The Mir-coders gives permission to link
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+
+package tool;
+
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Iterator;
import mir.util.ExceptionFunctions;
-import mir.util.PropertiesManipulator;\r
-\r
-public class BundleTool {\r
-\r
- public static void compare(String aMaster, String aSlave) {\r
- PropertiesManipulator master;\r
- PropertiesManipulator slave;\r
- PropertiesManipulator result;\r
-\r
- try {\r
- master = PropertiesManipulator.readProperties(new FileInputStream(new File(aMaster)));\r
- }\r
- catch (Throwable t) {\r
- System.out.println("Unable to read master properties: " + t.getMessage());\r
- return;\r
- }\r
-\r
- try {\r
- slave = PropertiesManipulator.readProperties(new FileInputStream(new File(aSlave)));\r
- }\r
- catch (FileNotFoundException t) {\r
- slave = new PropertiesManipulator();\r
- }\r
- catch (Throwable t) {\r
- System.out.println("Unable to read slave properties: " + t.getMessage());\r
- return;\r
- }\r
-\r
- int missing=0;\r
-\r
- Iterator i = master.getEntries();\r
- while (i.hasNext()) {\r
- Object e = i.next();\r
-\r
- if (e instanceof PropertiesManipulator.Entry) {\r
- String key = ( (PropertiesManipulator.Entry) e).getKey();\r
-\r
- if (!slave.containsKey(key) || slave.get(key) == null || slave.get(key).length()==0 ) {\r
- if (missing==0) {\r
- System.out.println(aSlave+" is missing:");\r
- }\r
- System.out.println(" " + key);\r
- missing++;\r
- }\r
- }\r
- }\r
-\r
- if (missing>0)\r
- System.out.println("total missing: " +missing);\r
-\r
- missing=0;\r
- i = slave.getEntries();\r
- while (i.hasNext()) {\r
- Object e = i.next();\r
-\r
- if (e instanceof PropertiesManipulator.Entry) {\r
- String key = ( (PropertiesManipulator.Entry) e).getKey();\r
-\r
- if (!master.containsKey(key)) {\r
- if (missing==0) {\r
- System.out.println(aSlave+" has extra:");\r
- }\r
- System.out.println(" " + key);\r
- missing++;\r
- }\r
- }\r
- }\r
- if (missing>0)\r
- System.out.println("total extra: " +missing);\r
- }\r
-\r
- public static void align(String aMaster, String aSlave) {\r
- PropertiesManipulator master;\r
- PropertiesManipulator slave;\r
- PropertiesManipulator result;\r
-\r
- try {\r
- master = PropertiesManipulator.readProperties(new FileInputStream(new File(aMaster)));\r
- }\r
- catch (Throwable t) {\r
- System.out.println("Unable to read master properties: " + t.getMessage());\r
- return;\r
- }\r
-\r
- try {\r
- slave = PropertiesManipulator.readProperties(new FileInputStream(new File(aSlave)));\r
- }\r
- catch (FileNotFoundException t) {\r
- slave = new PropertiesManipulator();\r
- }\r
- catch (Throwable t) {\r
- System.out.println("Unable to read slave properties: " + t.getMessage());\r
- return;\r
- }\r
-\r
- result = new PropertiesManipulator();\r
-\r
- // skip past the header in the slave bundle\r
- Iterator i = slave.getEntries();\r
- while (i.hasNext()) {\r
- Object e = i.next();\r
-\r
- if (e instanceof PropertiesManipulator.EmptyLine) {\r
- result.addEmptyLine();\r
- }\r
- else if (e instanceof PropertiesManipulator.Comment) {\r
- result.addComment( ( (PropertiesManipulator.Comment) e).getComment());\r
- }\r
-\r
- if (! (e instanceof PropertiesManipulator.Comment))\r
- break;\r
- }\r
-\r
- boolean insideHeader = true;\r
- i = master.getEntries();\r
- while (i.hasNext()) {\r
- Object e = i.next();\r
-\r
- if (!insideHeader && (e instanceof PropertiesManipulator.EmptyLine)) {\r
- result.addEmptyLine();\r
- }\r
- else if (!insideHeader && e instanceof PropertiesManipulator.Comment) {\r
- result.addComment( ( (PropertiesManipulator.Comment) e).getComment());\r
- }\r
- else if (e instanceof PropertiesManipulator.Entry) {\r
- String key = ( (PropertiesManipulator.Entry) e).getKey();\r
- String value = slave.get(key);\r
-\r
- if (value==null || value.length()==0) {\r
- result.addComment("# missing (master value = \"" +master.get(key)+"\")");\r
- }\r
-\r
- result.addEntry(key, value);\r
- }\r
-\r
- insideHeader = insideHeader && (e instanceof PropertiesManipulator.Comment);\r
- }\r
-\r
- try {\r
- PropertiesManipulator.writeProperties(result, new FileOutputStream(new File(aSlave)));\r
- }\r
- catch (Throwable t) {\r
- System.out.println("Unable to write slave properties: " + t.getMessage());\r
- return;\r
- }\r
- }\r
-\r
- public static void encode(String aBundle, String anEncoding, String anOutputFile) {\r
- PropertiesManipulator bundle;\r
-\r
- try {\r
- bundle = PropertiesManipulator.readProperties(new FileInputStream(new File(aBundle)));\r
-\r
- PropertiesManipulator.writeProperties(bundle, new FileOutputStream(anOutputFile), anEncoding, false);\r
- }\r
- catch (Throwable t) {\r
- System.out.println("Unable to read master properties: " + t.getMessage());\r
- return;\r
- }\r
- }\r
-\r
- public static void decode(String aBundle, String anEncoding, String aSourceFile) {\r
- PropertiesManipulator bundle;\r
-\r
- try {\r
- bundle = PropertiesManipulator.readProperties(new FileInputStream(new File(aSourceFile)), anEncoding);\r
- }\r
- catch (Throwable t) {\r
- Throwable s = ExceptionFunctions.traceCauseException(t);\r
-\r
- System.out.println("Unable to read sourcefile: " + s.toString());\r
- return;\r
- }\r
- try {\r
- PropertiesManipulator.writeProperties(bundle, new FileOutputStream(aBundle));\r
- }\r
- catch (Throwable t) {\r
- System.out.println("Unable to write bundle: " + t.toString());\r
- return;\r
- }\r
- }\r
-\r
- public static void main(String[] anArguments) {\r
- String command = "help";\r
-\r
- if (anArguments.length >= 1) {\r
- command = anArguments[0];\r
-\r
- if (command.equals("compare")) {\r
- if (anArguments.length==3) {\r
- compare(anArguments[1], anArguments[2]);\r
-\r
- return;\r
- }\r
- }\r
- else if (command.equals("align")) {\r
- if (anArguments.length==3) {\r
- align(anArguments[1], anArguments[2]);\r
-\r
- return;\r
- }\r
- }\r
- else if (command.equals("encode")) {\r
- if (anArguments.length==4) {\r
- encode(anArguments[1], anArguments[2], anArguments[3]);\r
-\r
- return;\r
- }\r
- }\r
- else if (command.equals("decode")) {\r
- if (anArguments.length==4) {\r
- decode(anArguments[1], anArguments[2], anArguments[3]);\r
-\r
- return;\r
- }\r
- }\r
- }\r
-\r
-\r
-\r
- System.out.println("Usage:");\r
-\r
- System.out.println(" BundleTool align <master bundle> <slave bundle>");\r
- System.out.println("");\r
- System.out.println(" Reorders keys/values in a slave bundle according to a master bundle.");\r
- System.out.println("");\r
- System.out.println(" BundleTool compare <master bundle> <slave bundle>");\r
- System.out.println("");\r
- System.out.println(" Compares availability of bundle keys.");\r
- System.out.println("");\r
- System.out.println(" BundleTool encode <bundle> <encoding> <destinationfile>");\r
- System.out.println("");\r
- System.out.println(" Encodes the keys/values with a custom encoding.");\r
- System.out.println("");\r
- System.out.println(" BundleTool decode <bundle> <encoding> <sourcefile>");\r
- System.out.println("");\r
- System.out.println(" Decodes the keys/values with a custom encoding.");\r
- }\r
-\r
+import mir.util.PropertiesManipulator;
+
+public class BundleTool {
+
+ public static void compare(String aMaster, String aSlave) {
+ PropertiesManipulator master;
+ PropertiesManipulator slave;
+ PropertiesManipulator result;
+
+ try {
+ master = PropertiesManipulator.readProperties(new FileInputStream(new File(aMaster)));
+ }
+ catch (Throwable t) {
+ System.out.println("Unable to read master properties: " + t.getMessage());
+ return;
+ }
+
+ try {
+ slave = PropertiesManipulator.readProperties(new FileInputStream(new File(aSlave)));
+ }
+ catch (FileNotFoundException t) {
+ slave = new PropertiesManipulator();
+ }
+ catch (Throwable t) {
+ System.out.println("Unable to read slave properties: " + t.getMessage());
+ return;
+ }
+
+ int missing=0;
+
+ Iterator i = master.getEntries();
+ while (i.hasNext()) {
+ Object e = i.next();
+
+ if (e instanceof PropertiesManipulator.Entry) {
+ String key = ( (PropertiesManipulator.Entry) e).getKey();
+
+ if (!slave.containsKey(key) || slave.get(key) == null || slave.get(key).length()==0 ) {
+ if (missing==0) {
+ System.out.println(aSlave+" is missing:");
+ }
+ System.out.println(" " + key);
+ missing++;
+ }
+ }
+ }
+
+ if (missing>0)
+ System.out.println("total missing: " +missing);
+
+ missing=0;
+ i = slave.getEntries();
+ while (i.hasNext()) {
+ Object e = i.next();
+
+ if (e instanceof PropertiesManipulator.Entry) {
+ String key = ( (PropertiesManipulator.Entry) e).getKey();
+
+ if (!master.containsKey(key)) {
+ if (missing==0) {
+ System.out.println(aSlave+" has extra:");
+ }
+ System.out.println(" " + key);
+ missing++;
+ }
+ }
+ }
+ if (missing>0)
+ System.out.println("total extra: " +missing);
+ }
+
+ public static void align(String aMaster, String aSlave) {
+ PropertiesManipulator master;
+ PropertiesManipulator slave;
+ PropertiesManipulator result;
+
+ try {
+ master = PropertiesManipulator.readProperties(new FileInputStream(new File(aMaster)));
+ }
+ catch (Throwable t) {
+ System.out.println("Unable to read master properties: " + t.getMessage());
+ return;
+ }
+
+ try {
+ slave = PropertiesManipulator.readProperties(new FileInputStream(new File(aSlave)));
+ }
+ catch (FileNotFoundException t) {
+ slave = new PropertiesManipulator();
+ }
+ catch (Throwable t) {
+ System.out.println("Unable to read slave properties: " + t.getMessage());
+ return;
+ }
+
+ result = new PropertiesManipulator();
+
+ // skip past the header in the slave bundle
+ Iterator i = slave.getEntries();
+ while (i.hasNext()) {
+ Object e = i.next();
+
+ if (e instanceof PropertiesManipulator.EmptyLine) {
+ result.addEmptyLine();
+ }
+ else if (e instanceof PropertiesManipulator.Comment) {
+ result.addComment( ( (PropertiesManipulator.Comment) e).getComment());
+ }
+
+ if (! (e instanceof PropertiesManipulator.Comment))
+ break;
+ }
+
+ boolean insideHeader = true;
+ i = master.getEntries();
+ while (i.hasNext()) {
+ Object e = i.next();
+
+ if (!insideHeader && (e instanceof PropertiesManipulator.EmptyLine)) {
+ result.addEmptyLine();
+ }
+ else if (!insideHeader && e instanceof PropertiesManipulator.Comment) {
+ result.addComment( ( (PropertiesManipulator.Comment) e).getComment());
+ }
+ else if (e instanceof PropertiesManipulator.Entry) {
+ String key = ( (PropertiesManipulator.Entry) e).getKey();
+ String value = slave.get(key);
+
+ if (value==null || value.length()==0) {
+ result.addComment("# missing (master value = \"" +master.get(key)+"\")");
+ }
+
+ result.addEntry(key, value);
+ }
+
+ insideHeader = insideHeader && (e instanceof PropertiesManipulator.Comment);
+ }
+
+ try {
+ PropertiesManipulator.writeProperties(result, new FileOutputStream(new File(aSlave)));
+ }
+ catch (Throwable t) {
+ System.out.println("Unable to write slave properties: " + t.getMessage());
+ return;
+ }
+ }
+
+ public static void encode(String aBundle, String anEncoding, String anOutputFile) {
+ PropertiesManipulator bundle;
+
+ try {
+ bundle = PropertiesManipulator.readProperties(new FileInputStream(new File(aBundle)));
+
+ PropertiesManipulator.writeProperties(bundle, new FileOutputStream(anOutputFile), anEncoding, false);
+ }
+ catch (Throwable t) {
+ System.out.println("Unable to read master properties: " + t.getMessage());
+ return;
+ }
+ }
+
+ public static void decode(String aBundle, String anEncoding, String aSourceFile) {
+ PropertiesManipulator bundle;
+
+ try {
+ bundle = PropertiesManipulator.readProperties(new FileInputStream(new File(aSourceFile)), anEncoding);
+ }
+ catch (Throwable t) {
+ Throwable s = ExceptionFunctions.traceCauseException(t);
+
+ System.out.println("Unable to read sourcefile: " + s.toString());
+ return;
+ }
+ try {
+ PropertiesManipulator.writeProperties(bundle, new FileOutputStream(aBundle));
+ }
+ catch (Throwable t) {
+ System.out.println("Unable to write bundle: " + t.toString());
+ return;
+ }
+ }
+
+ public static void main(String[] anArguments) {
+ String command = "help";
+
+ if (anArguments.length >= 1) {
+ command = anArguments[0];
+
+ if (command.equals("compare")) {
+ if (anArguments.length==3) {
+ compare(anArguments[1], anArguments[2]);
+
+ return;
+ }
+ }
+ else if (command.equals("align")) {
+ if (anArguments.length==3) {
+ align(anArguments[1], anArguments[2]);
+
+ return;
+ }
+ }
+ else if (command.equals("encode")) {
+ if (anArguments.length==4) {
+ encode(anArguments[1], anArguments[2], anArguments[3]);
+
+ return;
+ }
+ }
+ else if (command.equals("decode")) {
+ if (anArguments.length==4) {
+ decode(anArguments[1], anArguments[2], anArguments[3]);
+
+ return;
+ }
+ }
+ }
+
+
+
+ System.out.println("Usage:");
+
+ System.out.println(" BundleTool align <master bundle> <slave bundle>");
+ System.out.println("");
+ System.out.println(" Reorders keys/values in a slave bundle according to a master bundle.");
+ System.out.println("");
+ System.out.println(" BundleTool compare <master bundle> <slave bundle>");
+ System.out.println("");
+ System.out.println(" Compares availability of bundle keys.");
+ System.out.println("");
+ System.out.println(" BundleTool encode <bundle> <encoding> <destinationfile>");
+ System.out.println("");
+ System.out.println(" Encodes the keys/values with a custom encoding.");
+ System.out.println("");
+ System.out.println(" BundleTool decode <bundle> <encoding> <sourcefile>");
+ System.out.println("");
+ System.out.println(" Decodes the keys/values with a custom encoding.");
+ }
+
}
\ No newline at end of file