########## admin ##########
# language: english
-# $Id: admin_en.properties,v 1.48.2.20 2003/12/21 13:32:01 zapata Exp $
+# $Id: admin_en.properties,v 1.48.2.21 2004/01/11 20:35:50 zapata Exp $
languagename=English
list.next=next
list.previous=previous
+system.status = Status:
+system.loggedin = Logged in:
# media - used by image, audio, video and other media
media.urls = Urls
########## admin ##########
# language: spanish
-# $Id: admin_es.properties,v 1.29.2.2 2003/12/07 23:30:34 init Exp $
+# $Id: admin_es.properties,v 1.29.2.3 2004/01/11 20:35:50 zapata Exp $
languagename = Castellano
list.next = siguiente
list.previous = anterior
+# missing (master value = "Status:")
+system.status =
+# missing (master value = "Logged in:")
+system.loggedin =
# media - used by image, audio, video and other media
+# missing (master value = "Urls")
+media.urls =
media.created = creado
media.changed = \u00faltima modificaci\u00f3n
media.published = publicado
media.icon = Icono
media.nr_of_media = N\u00famero de recursos medi\u00e1ticos (m\u00e1ximo 20)
media.nr_of_media.submit = definir n\u00famero
+# missing (master value = "Comments ")
+media.comments =
+# missing (master value = "Articles")
+media.articles =
medialist.search_text_in = Buscar texto en
# breaking
breaking.htmltitle = \u00daltimas noticias
breaking.textinfo = (m\u00e1x. 5 l\u00edneas / 250 caracteres)
+# missing (master value = "id")
+breaking.id =
breaking.text = texto
breaking.date = fecha
comment.html = HTML
comment.status = Estado
comment.language = Idioma
+# missing (master value = "All comments")
+comment.allcomments =
+# missing (master value = "Internal Comment")
+comment.comment =
+# missing (master value = "(internal)")
+comment.comment.info =
comment.operation.hide = ocultar
comment.operation.unhide = desocultar
commentlist.htmltitle = Lista de comentarios
commentlist.published = publicado
commentlist.hidden = oculto
-# missing (master value = "All comments for this article")
-commentlist.allcomments = Todos los comentarios de este artÃculo
+commentlist.allcomments = Todos los comentarios de este art\u00edculo
commentlist.search = buscar
commentlist.activate = activar modificaciones
commentlist.order = orden
commentsearch.field = Buscar
commentsearch.field.title = T\u00edtulo
commentsearch.field.creator = Autor
+# missing (master value = "Url")
+commentsearch.field.main_url =
+# missing (master value = "Email")
+commentsearch.field.email =
commentsearch.field.description = Descripci\u00f3n
commentsearch.value = Valor
content.html = HTML?
content.comment = Comentario interno
content.internal = (prop\u00f3sito interno)
+# missing (master value = "Keywords")
+content.keywords =
+# missing (master value = "Locked by {0}")
+content.lockedby =
+# missing (master value = "Lock")
+content.lock =
+# missing (master value = "Unlock")
+content.unlock =
+# missing (master value = "Force lock")
+content.forcelock =
content.attachments = Adjuntos
content.images = Im\u00e1genes
content.operation.unhide = desocultar
content.operation.newswire = newswire
-# missing (master value = "search")
contentsearch.value = buscar
contentsearch.field = campo
contentsearch.field.title = T\u00edtulo
contentsearch.field.creator = Autor
contentsearch.field.contents = Contenido
+# missing (master value = "Email")
+contentsearch.field.creator_email =
+# missing (master value = "Web address")
+contentsearch.field.creator_main_url =
contentsearch.publishedstate = estado de publicaci\u00f3n
contentsearch.publishedstate.hidden = oculto
# language
language.htmltitle = Idioma
+# missing (master value = "Id")
+language.id =
language.name = Idioma
language.code = C\u00f3digo de idioma
languagelist.htmltitle = Idiomas
-
-# imcs
-linkimcs.htmltitle = Enlaces a CMIs
-linkimcs.name = Nombre
-linkimcs.continent = Continente
-linkimcs.new_parent = Nuevo padre
-linkimcs.url = URL
-linkimcs.sort_by = Criterio de ordenaci\u00f3n
-linkimcs.language = Idioma
-linkimcs.parent = Padre
-
-linkimcslist.htmltitle = Lista de enlaces a CMIs
-linkimcslist.search_in = Buscar texto en
-
-
# login
login.htmltitle = Entrada
login.info = Esta zona es accesible exclusivamente a grupos autorizados. Si quieres colaborar como editor, por favor contacta con nosotros en {0}.
# mediafolder
mediafolder.htmltitle = Carpeta de recursos medi\u00e1ticos
+# missing (master value = "id")
+mediafolder.id =
mediafolder.date = fecha
mediafolder.name = nombre
mediafolder.location = lugar de origen
# message
message.htmltitle = Mensajes
+# missing (master value = "id")
+message.id =
message.date = fecha
message.title = t\u00edtulo
message.creator = autor
# admin start page
start.htmltitle = Administraci\u00f3n
-start.breaking.new = a\u00f1adir \u00faltima noticia
start.content.new = nuevo art\u00edculo
start.show = mostrar
-start.open_by_id = ID env\u00edo
+# missing (master value = "open comment #")
+start.comment.open_by_id =
+# missing (master value = "open article #")
+start.content.open_by_id =
-start.administer.comments = comentarios
start.content.hidden = art\u00edculos ocultos
start.content.not_published = art\u00edculos (aun) sin publicar
start.content.with_media = con recursos medi\u00e1ticos
start.content.search = buscar
start.allarticlesoftype = {0}
+# missing (master value = "{0}")
+start.allcommentswithstatus =
start.producers.title = GENERAR MANUALMENTE
start.producers.produceAllNew = generar todos los nuevos
+# missing (master value = "generate all new")
+start.producers.recipe.allnew =
+
start.producers.advanced = p\u00e1gina avanzada (usar con cuidado!)
-start.openpostings.title = ENV\u00cdOS ABIERTOS
+start.administer.title = ADMINISTRAR
+start.administer.comments = comentarios
+
start.comments.title = COMENTARIOS
+
start.breaking.title = \u00faltimas noticias
-start.content.title = ART\u00cdCULOS
-start.administer.title = ADMINISTRAR
-start.list.title = LISTA
+# missing (master value = "ARTICLES")
+start.articles.title =
start.fileedit.includes.title = editar ficheros
start.addandedit.title = A\u00d1ADIR / EDITAR
start.extra.title = EXTRA
start.search.title = BUSCAR
-start.topics.title = TEMAS
start.other_media.title = otros recursos medi\u00e1ticos
start.images.title = im\u00e1genes
+# missing (master value = "open image #")
+start.images.open_by_id =
start.video.title = video
start.audio.title = audio
start.media.title = MEDIA
# topic
+
topic.htmltitle = tema
+
+# missing (master value = "id")
+topic.id =
topic.title = nombre
topic.description = descripci\u00f3n
topic.filename = nombre del fichero
# users
user.htmltitle = Usuario
user.login = Usuario
+# missing (master value = "Your own password")
+user.ownpassword =
+# missing (master value = "Old password")
+user.oldpassword =
user.password = Contrase\u00f1a
user.password2 = Contrase\u00f1a (confirmaci\u00f3n)
user.admin = Administrador
+# missing (master value = "Disabled ?")
+user.is_disabled =
+# missing (master value = "Creation date")
+user.creationdate =
+# missing (master value = "Last login")
+user.lastlogindate =
+# missing (master value = "Email address")
+user.email =
+# missing (master value = "Comment")
+user.comment =
+# missing (master value = "Profile")
+user.profile =
+
+
+
userlist.htmltitle = Lista de usuarios
articletypelist.htmltitle = Lista de tipos de art\u00edculo
# mediatypes
-### needs translation
mediatypelist.htmltitle = Manage Mediatypes
mediatype.id = id
mediatype.name = Name
mediatype.classname = Classname
mediatype.tablename = Tabelname
-
-
#commentstatus
commentstatus.htmltitle = Estado de comentario
commentstatus.id = ID
producer.job.name = Trabajo
producer.job.status = Estado
producer.job.date = \u00daltima modificacion
-producer.job.cancel = cancelar
-producer.job.abort = abortar
producer.job.empty = La cola est\u00e1 vac\u00eda
+# missing (master value = "Running time")
+producer.job.runningtime =
+# missing (master value = "Cancel selected jobs")
+producer.jobqueue.canceljobs =
+# missing (master value = "Cancel all pending jobs")
+producer.jobqueue.cancelalljobs =
producer.jobqueue.title = Trabajos actuales
producer.jobqueue.refresh = refrescar
producer.producerlist.title = A\u00f1adir un nuevo trabajo
abuse.logpostings = Hacer un log de las IPs de los env\u00edos abiertos
abuse.logsize = Tama\u00f1o del buffer del log
abuse.cookies = Utilizar cookies para los usuarios bloqueados
-abuse.articleaction = Acción a realizar con un artÃculo bloqueado
-abuse.commentaction = Acción a realizar con un comentario bloqueado
+abuse.articleaction = Acci\u00f3n a realizar con un art\u00edculo bloqueado
+abuse.commentaction = Acci\u00f3n a realizar con un comentario bloqueado
abuse.showlog = Mostrar el log de IPs
abuse.showfilters = Gestionar filtros
abuse.log.address = N\u00famero de IP
abuse.log.object = Objeto
abuse.log.browser = Navegador
+# missing (master value = "Filter type")
+abuse.log.filtertype =
+# missing (master value = "Expression")
+abuse.log.filterexpression =
abuse.filters = Filtros
+# missing (master value = "down")
+abuse.filters.movedown =
+# missing (master value = "up")
+abuse.filters.moveup =
+
abuse.filter.type = Tipos
+abuse.filter.expression = Expresi\u00f3n
+# missing (master value = "Article ")
+abuse.filter.articleaction =
+# missing (master value = "Comment ")
+abuse.filter.commentaction =
+# missing (master value = "Comments (internal usage)")
+abuse.filter.comments =
+# missing (master value = "Last hit")
+abuse.filter.lasthit =
+# missing (master value = "Edit filter")
+abuse.filter.htmltitle =
+
abuse.filtertype.ip = N\u00famero de IP
abuse.filtertype.regexp = Expresi\u00f3n regular
-abuse.filter.expression = Expresi\u00f3n
+# missing (master value = "User Agent")
+abuse.filtertype.useragent =
+# missing (master value = "Error:")
+abuse.filtererror.title =
+# missing (master value = "Invalid filter type")
+abuse.filtererror.invalidtype =
+# missing (master value = "Invalid expression for this type")
+abuse.filtererror.invalidexpression =
+
+# missing (master value = "Anti-abuse filter rules")
+abuse.filters.htmltitle =
+# missing (master value = "Anti-abuse open posting log")
+abuse.log.htmltitle =
# head
head.start = inicio
head.logout = salir
+# missing (master value = "password")
+head.changepassword =
head.help = ayuda
head.search = buscar
head.logged_in = identificado
# Comment status values
commentstatus.normal = normal
-commentstatus.good = bueno
-commentstatus.bad = malo
user.error.missingpasswords = La nueva contrase\u00f1a debe ser introducida dos veces
user.error.passwordmismatch = Las contrase\u00f1as no son iguales
user.error.missingpassword = Es necesario introducir alguna contrase\u00f1a
+# missing (master value = "Incorrect password")
+user.error.incorrectpassword =
+
+
########## infomessages ##########
infomessage.htmltitle = Informaci\u00f3n
-infomessage.produceAllNewAddedToQueue = Tu petici\u00f3n se ha a\u00f1adido a la cola.
+# missing (master value = "Your request has been added to the queue.")
+infomessage.recipeAddedToQueue =
########## admin ##########
# language: euskera / basque
-# $Id: admin_eu.properties,v 1.12.2.2 2003/12/07 23:30:34 init Exp $
+# $Id: admin_eu.properties,v 1.12.2.3 2004/01/11 20:35:50 zapata Exp $
languagename = Euskera
list.next = hurrengoa
list.previous = aurrekoa
+# missing (master value = "Status:")
+system.status =
+# missing (master value = "Logged in:")
+system.loggedin =
# media - used by image, audio, video and other media
+# missing (master value = "Urls")
+media.urls =
media.created = sortua
media.changed = aldatua
media.published = argitaratua
media.icon = Ikonoa
media.nr_of_media = Baliabide mediatikoen kopurua
media.nr_of_media.submit = Aldatu kopurua
+# missing (master value = "Comments ")
+media.comments =
+# missing (master value = "Articles")
+media.articles =
medialist.search_text_in = Testua non bilatu
# breaking
breaking.htmltitle = Azken albisteak
breaking.textinfo = (gehienez 5 lerrro / 250 letra)
+# missing (master value = "id")
+breaking.id =
breaking.text = testua
breaking.date = data
comment.html = HTML da?
comment.status = Egoera
comment.language = Hizkuntza
+# missing (master value = "All comments")
+comment.allcomments =
+# missing (master value = "Internal Comment")
+comment.comment =
+# missing (master value = "(internal)")
+comment.comment.info =
# missing (master value = "hide")
comment.operation.hide =
commentlist.activate =
# missing (master value = "order")
commentlist.order =
-# missing (master value = "date (desc.)")
+# missing (master value = "newest first")
commentlist.order.datedesc =
-# missing (master value = "date (asc.)")
+# missing (master value = "oldest first")
commentlist.order.dateasc =
# missing (master value = "article title")
commentlist.order.articletitle =
commentsearch.field.title =
# missing (master value = "Author")
commentsearch.field.creator =
+# missing (master value = "Url")
+commentsearch.field.main_url =
+# missing (master value = "Email")
+commentsearch.field.email =
# missing (master value = "Description")
commentsearch.field.description =
# missing (master value = "Value")
content.html = HTML da?
content.comment = Barne komentarioa
content.internal = (barne xederako)
+# missing (master value = "Keywords")
+content.keywords =
+# missing (master value = "Locked by {0}")
+content.lockedby =
+# missing (master value = "Lock")
+content.lock =
+# missing (master value = "Unlock")
+content.unlock =
+# missing (master value = "Force lock")
+content.forcelock =
content.attachments = Atxekiak
content.images = Irudiak
contentsearch.field.creator =
# missing (master value = "Contents")
contentsearch.field.contents =
+# missing (master value = "Email")
+contentsearch.field.creator_email =
+# missing (master value = "Web address")
+contentsearch.field.creator_main_url =
# missing (master value = "publication state")
contentsearch.publishedstate =
# language
language.htmltitle = Hizkuntza
+# missing (master value = "Id")
+language.id =
language.name = hizkuntza
language.code = Hizkuntza kodea
languagelist.htmltitle = Hizkuntzen zerrenda
-
-# imcs
-linkimcs.htmltitle = MIGen loturak
-linkimcs.name = Izena
-linkimcs.continent = Kontinentea
-linkimcs.new_parent = Aita berria
-linkimcs.url = URL
-linkimcs.sort_by = Hurrenkera irizpidea
-linkimcs.language = Hizkuntza
-linkimcs.parent = Aita
-
-linkimcslist.htmltitle = MIGen loturen zerrenda
-linkimcslist.search_in = Testua non bilatu
-
-
# login
login.htmltitle = Sarrera
login.info = Eremu hau baimendutako taldeentzat bakarrik da. Editore lanetan lagundu nahi baduzu, jar zaitez gurekin kontaktuan <a href="mailto:imc-euskalherria-editorial@lists.indymedia.org">imceuskalherria-editorial@lists.indymedia.org</a> helbidean mesedez.
# mediafolder
mediafolder.htmltitle = Baliabide mediatikoen karpeta
+# missing (master value = "id")
+mediafolder.id =
mediafolder.date = data
mediafolder.name = izena
mediafolder.location = jatorrizko lekua
# message
message.htmltitle = Mezuak
+# missing (master value = "id")
+message.id =
message.date = data
message.title = izenburua
message.creator = Egilea
# admin start page
start.htmltitle = Administrazioa
-start.breaking.new = azken albiste berriak
start.content.new = artikulu berriak
start.show = Erakutsi
-# missing (master value = "open id")
-start.open_by_id =
+# missing (master value = "open comment #")
+start.comment.open_by_id =
+# missing (master value = "open article #")
+start.content.open_by_id =
-# missing (master value = "comments")
-start.administer.comments =
start.content.hidden = aritukulu ezkutukoak
start.content.not_published = argitaratzeke dauden artikuluak
start.content.with_media = baliabide mediatikoekin
start.content.search = bilatu
start.allarticlesoftype = {0} motatako artikulu guztiak
+# missing (master value = "{0}")
+start.allcommentswithstatus =
start.producers.title = Euskuz ekoiztu
start.producers.produceAllNew = Dena berria ekoiztu
+# missing (master value = "generate all new")
+start.producers.recipe.allnew =
+
start.producers.advanced = Aukera arreratuak (kontuz honekin!)
-start.openpostings.title = BIDALKETA IREKIAK
-start.comments.title = KOMENTARIOAK
-start.breaking.title = AZKEN ALBISTRAK
-start.content.title = ARTIKULUAK
# missing (master value = "ADMINISTER")
start.administer.title =
-# missing (master value = "LIST")
-start.list.title =
+# missing (master value = "comments")
+start.administer.comments =
+
+start.comments.title = KOMENTARIOAK
+
+start.breaking.title = AZKEN ALBISTRAK
+# missing (master value = "ARTICLES")
+start.articles.title =
# missing (master value = "edit include files")
start.fileedit.includes.title =
# missing (master value = "ADD / EDIT")
start.extra.title =
# missing (master value = "SEARCH")
start.search.title =
-start.topics.title = GAIAK
start.other_media.title = BESTE MEDIOEN FITXATEGIAK
start.images.title = IRUDIAK
+# missing (master value = "open image #")
+start.images.open_by_id =
start.video.title = BIDEO FITXATEGIAK
start.audio.title = AUDIO FITXATEGIAK
# missing (master value = "MEDIA")
# topic
+
topic.htmltitle = Gaia
+
+# missing (master value = "id")
+topic.id =
topic.title = Izena
topic.description = deskripzioa
topic.filename = Fitxategiaren izena
# users
user.htmltitle = Erabiltzailea
user.login = erabiltzailea
+# missing (master value = "Your own password")
+user.ownpassword =
+# missing (master value = "Old password")
+user.oldpassword =
user.password = pasahitza
# missing (master value = "Password (confirmation)")
-user.password2 =
+user.password2 =
user.admin = administratzailea
+# missing (master value = "Disabled ?")
+user.is_disabled =
+# missing (master value = "Creation date")
+user.creationdate =
+# missing (master value = "Last login")
+user.lastlogindate =
+# missing (master value = "Email address")
+user.email =
+# missing (master value = "Comment")
+user.comment =
+# missing (master value = "Profile")
+user.profile =
+
+
+
userlist.htmltitle = Erabiltzaileen zerrenda
articletypelist.htmltitle = Artikuluen mota zerrenda
# mediatypes
-### needs translation
mediatypelist.htmltitle = Manage Mediatypes
mediatype.id = id
mediatype.name = Name
mediatype.classname = Classname
mediatype.tablename = Tabelname
-
-
#commentstatus
commentstatus.htmltitle = Komentarioen egoera
commentstatus.id = ID
fileedit.htmltitle = Fitxategia aldatu
fileedit.filename = Fitxategiaren izena
# missing (master value = "Subdirectory")
-fileedit.subdirectory =
+fileedit.subdirectory =
fileeditlist.htmltitle = Fitxategien aldaketak
fileeditlist.filename = Fitxategiaren izena
# missing (master value = "Subdirectory")
-fileeditlist.dirname =
+fileeditlist.dirname =
#producers
producer.job.name = Lana
producer.job.status = Egoera
producer.job.date = azken aldaketa
-producer.job.cancel = ezeztatu
-producer.job.abort = utzi
# missing (master value = "Queue is empty")
-producer.job.empty =
-
+producer.job.empty =
+# missing (master value = "Running time")
+producer.job.runningtime =
+
+# missing (master value = "Cancel selected jobs")
+producer.jobqueue.canceljobs =
+# missing (master value = "Cancel all pending jobs")
+producer.jobqueue.cancelalljobs =
producer.jobqueue.title = Oraingo lanak
producer.jobqueue.refresh = birkargatu
producer.producerlist.title = Lan berri bat gehitu
#superusermenu
superusermenu.htmltitle = Aukera aurreratuak
# missing (master value = "MANAGE")
-superusermenu.manage =
+superusermenu.manage =
superusermenu.topics = Gaien kudeaketa
superusermenu.articletypes = Artiukuluen moten kudeaketa
superusermenu.mediatypes = Mediatypes
abuse.log.object =
# missing (master value = "Browser")
abuse.log.browser =
+# missing (master value = "Filter type")
+abuse.log.filtertype =
+# missing (master value = "Expression")
+abuse.log.filterexpression =
# missing (master value = "Filters")
abuse.filters =
+# missing (master value = "down")
+abuse.filters.movedown =
+# missing (master value = "up")
+abuse.filters.moveup =
+
# missing (master value = "Type")
abuse.filter.type =
+# missing (master value = "Expression")
+abuse.filter.expression =
+# missing (master value = "Article ")
+abuse.filter.articleaction =
+# missing (master value = "Comment ")
+abuse.filter.commentaction =
+# missing (master value = "Comments (internal usage)")
+abuse.filter.comments =
+# missing (master value = "Last hit")
+abuse.filter.lasthit =
+# missing (master value = "Edit filter")
+abuse.filter.htmltitle =
+
# missing (master value = "IP Number")
abuse.filtertype.ip =
# missing (master value = "Regular expression")
abuse.filtertype.regexp =
-# missing (master value = "Expression")
-abuse.filter.expression =
+# missing (master value = "User Agent")
+abuse.filtertype.useragent =
+# missing (master value = "Error:")
+abuse.filtererror.title =
+# missing (master value = "Invalid filter type")
+abuse.filtererror.invalidtype =
+# missing (master value = "Invalid expression for this type")
+abuse.filtererror.invalidexpression =
+
+# missing (master value = "Anti-abuse filter rules")
+abuse.filters.htmltitle =
+# missing (master value = "Anti-abuse open posting log")
+abuse.log.htmltitle =
# head
head.start = hasiera
head.logout = irten
+# missing (master value = "password")
+head.changepassword =
head.help = laguntza
head.search = bilatu
head.logged_in = erregistraturik zaude
# Comment status values
# missing (master value = "normal")
commentstatus.normal =
-# missing (master value = "good")
-commentstatus.good =
-# missing (master value = "bad")
-commentstatus.bad =
user.error.passwordmismatch =
# missing (master value = "A password must be entered")
user.error.missingpassword =
+# missing (master value = "Incorrect password")
+user.error.incorrectpassword =
+
+
########## infomessages ##########
infomessage.htmltitle = Oharra
-infomessage.produceAllNewAddedToQueue = Lana zerrendan sartuta
-
-########## HTML-charset ##########
+# missing (master value = "Your request has been added to the queue.")
+infomessage.recipeAddedToQueue =
<html>
<head>
<title>${lang("comment.htmltitle")}</title>
- <meta http-equiv="Content-Type" content="text/html; charset=${config["Mir.DefaultHTMLCharset"]}">
+ <meta http-equiv="Content-Type" content="text/html; charset=${config["Mir.DefaultHTMLCharset"]}">
</head>
<body bgcolor="white" text="black" link="#006600" vlink="#009900" alink="red">
<input type="hidden" name="do" value="inscomment">
<table width="100%" border="0" cellspacing="0" cellpadding="4" bgcolor="silver">
- <tr>
- <td bgcolor="#663399" colspan="3">
- <font color="White"><b>${lang("comment.header")}</b></font>
- </td>
- </tr>
- <tr>
- <td bgcolor="#003300" colspan="3">
- <p>
- <font color="white"">
- ${lang("comment.note")}
-<if data.passwd>
+ <tr>
+ <td bgcolor="#663399" colspan="3">
+ <font color="White"><b>${lang("comment.header")}</b></font>
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="#003300" colspan="3">
+ <p>
+ <font color="white"">
+ ${lang("comment.note")}
+<if data.passwd>
<br>
${data.passwd}
</if>
- </font>
- </p>
+ </font>
+ </p>
- </td>
- </tr>
- <tr>
- <td bgcolor="#663399" colspan="3">
- <font face="Helvetica, Arial" color="white" size=+2><b>${lang("comment.formtitle")}</b></font>
- </td>
- </tr>
-<if data.passwd>
- <tr>
- <td><td>${lang("comment.password")}:</td>
- <td><input type="text" name="passwd" size="10"></td>
- </tr>
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="#663399" colspan="3">
+ <font face="Helvetica, Arial" color="white" size=+2><b>${lang("comment.formtitle")}</b></font>
+ </td>
+ </tr>
+<if data.passwd>
+ <tr>
+ <td><td>${lang("comment.password")}:</td>
+ <td><input type="text" name="passwd" size="10"></td>
+ </tr>
</if>
- <tr>
- <td>
- <b>${lang("comment.title")}:</b>
- </td>
- <td colspan="2">
- <input type="text" name="title" size="45" maxlength="45"> <font size="-1" color="#663399">(${lang("required")})</font>
- </td>
- </tr>
- <tr>
- <td>
- <b>${lang("comment.name")}:</b>
- </td>
- <td colspan="2">
- <input type="text" name="creator" size="20" maxlength="45"> <font size="-1" color="#663399">(${lang("required")})</font>
- </td>
- </tr>
- <tr>
- <td>
- ${lang("comment.email")}:
- </td>
- <td colspan="2">
- <input type="text" name="email" size="30" maxlength="80"> <font size="-1">(<i>${lang("optional")}</i>)</font>
- </td>
- </tr>
- <tr>
- <td>
- ${lang("comment.url")}:
- </td>
- <td colspan="2">
- <input type="text" name="main_url" size="40" maxlength="160" value="http://"> <font size="-1">(<i>${lang("optional")}</i>)</font>
- </td>
- </tr>
- <tr>
- <td>
- ${lang("comment.phone")}:
- </td>
- <td colspan="2">
- <input type="text" name="phone" size="30" maxlength="80"> <font size="-1">(<i>${lang("optional")}</i>)</font>
- </td>
- </tr>
- <tr>
- <td>
- ${lang("comment.address")}:
- </td>
- <td colspan="2">
- <input type="text" name="address" size="40" maxlength="160"><font size="-1"> <i>(${lang("optional")})</i></font>
- </td>
- </tr>
- <tr>
- <td>
- ${lang("comment.language")}:
- </td>
- <td colspan="2">
- <select name="to_language">
- <list extra.languagePopUpData as l>
- <option value="${l.key}">${l.value}</option>
- </list>
- </select>
- <font size="-1"><i>(${lang("optional")})</i></font>
- </td>
- </tr>
- <tr>
- <td valign="top">
- <b>${lang("comment.text")}:</b>
- </td>
- <td bgcolor="#003300" colspan="2">
- <textarea name="description" rows="20" cols="60" wrap=virtual></textarea>
- <br><br>
- </td>
- </tr>
- <tr>
- <td>
- </td>
- <td bgcolor="#663399" valign="top" align="center">
- <br>
- <input type="submit" value="${lang("comment.submit")}"><br>
+ <tr>
+ <td>
+ <b>${lang("comment.title")}:</b>
+ </td>
+ <td colspan="2">
+ <input type="text" name="title" size="45" maxlength="45"> <font size="-1" color="#663399">(${lang("required")})</font>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>${lang("comment.name")}:</b>
+ </td>
+ <td colspan="2">
+ <input type="text" name="creator" size="20" maxlength="45"> <font size="-1" color="#663399">(${lang("required")})</font>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ${lang("comment.email")}:
+ </td>
+ <td colspan="2">
+ <input type="text" name="email" size="30" maxlength="80"> <font size="-1">(<i>${lang("optional")}</i>)</font>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ${lang("comment.url")}:
+ </td>
+ <td colspan="2">
+ <input type="text" name="main_url" size="40" maxlength="160" value="http://"> <font size="-1">(<i>${lang("optional")}</i>)</font>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ${lang("comment.phone")}:
+ </td>
+ <td colspan="2">
+ <input type="text" name="phone" size="30" maxlength="80"> <font size="-1">(<i>${lang("optional")}</i>)</font>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ${lang("comment.address")}:
+ </td>
+ <td colspan="2">
+ <input type="text" name="address" size="40" maxlength="160"><font size="-1"> <i>(${lang("optional")})</i></font>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ${lang("comment.language")}:
+ </td>
+ <td colspan="2">
+ <select name="to_language">
+ <list extra.languagePopUpData as l>
+ <option value="${l.key}">${l.value}</option>
+ </list>
+ </select>
+ <font size="-1"><i>(${lang("optional")})</i></font>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ <b>${lang("comment.text")}:</b>
+ </td>
+ <td bgcolor="#003300" colspan="2">
+ <textarea name="description" rows="20" cols="60" wrap=virtual></textarea>
+ <br><br>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ </td>
+ <td bgcolor="#663399" valign="top" align="center">
+ <br>
+ <input type="submit" value="${lang("comment.submit")}"><br>
- </td>
- <td bgcolor="#003300" valign="top" align="center">
- <br>
- <input type="reset" value="${lang("comment.reset")}"><br>
- <input type="hidden" name="to_media" value="${data.aid}">
- <br>
- </td>
- </tr>
+ </td>
+ <td bgcolor="#003300" valign="top" align="center">
+ <br>
+ <input type="reset" value="${lang("comment.reset")}"><br>
+ <input type="hidden" name="to_media" value="${data.aid}">
+ <br>
+ </td>
+ </tr>
</table>
</form>
<html>
<head>
- <title>${lang("commentdone.htmltitle")}</title>
+ <title>${lang("commentdone.htmltitle")}</title>
</head>
<body bgcolor="White" text="Black" link="#006600" vlink="#009900" alink="Red">
<table width="100%" border="0" cellspacing="0" cellpadding="10">
- <tr>
- <td valign="top" align="center" bgcolor="#663399">
- <font color="White"><b>${lang("commentdone.thanks")}</b></font
- </td>
- </tr>
- <tr>
- <td bgcolor="#cccccc" align="center">
+ <tr>
+ <td valign="top" align="center" bgcolor="#663399">
+ <font color="White"><b>${lang("commentdone.thanks")}</b></font
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="#cccccc" align="center">
- <br>
+ <br>
${lang("commentdone.wait")}
- <br>
+ <br>
${lang("commentdone.criteria")}
- <br>
- <em>${lang("commentdone.stay_calm")}</em><br>
- <br>
+ <br>
+ <em>${lang("commentdone.stay_calm")}</em><br>
+ <br>
- </td>
- </tr>
- <tr>
- <td valign="top" align="center" bgcolor="#663399">
- <a href="javascript:history.go(-2)"><font color="White"><b>>> ${lang("commentdone.back")}</b></font></a>
- </td>
- </tr>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" align="center" bgcolor="#663399">
+ <a href="javascript:history.go(-2)"><font color="White"><b>>> ${lang("commentdone.back")}</b></font></a>
+ </td>
+ </tr>
</table>
</body>
<html>
<head>
- <title>${lang("commentdupe.htmltitle")}</title>
+ <title>${lang("commentdupe.htmltitle")}</title>
</head>
<body bgcolor="White" text="Black" link="white" vlink="#009900" alink="Red">
<table width="100%" border="0" cellspacing="0" cellpadding="10">
- <tr>
- <td valign="top" align="center" bgcolor="#663399">
- <font color="White"><b>
- ${lang("commentdupe.title")}
- </b></font
- </td>
- </tr>
- <tr>
- <td bgcolor="003300" width=70%>
- <font color="White">
- <br>
+ <tr>
+ <td valign="top" align="center" bgcolor="#663399">
+ <font color="White"><b>
+ ${lang("commentdupe.title")}
+ </b></font
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="003300" width=70%>
+ <font color="White">
+ <br>
${lang("commentdupe.explanation")}
- <br>
- <center><em>${lang("commentdupe.no_panic")}</em></center><br>
- <br>
- </font>
- </td>
- </tr>
- <tr>
- <td valign="top" align="center" bgcolor="#663399">
- <a href="javascript:history.go(-2)"><font color="White"><b>>> ${lang("commentdupe.back")}</b></font></a>
- </td>
- </tr>
+ <br>
+ <center><em>${lang("commentdupe.no_panic")}</em></center><br>
+ <br>
+ </font>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" align="center" bgcolor="#663399">
+ <a href="javascript:history.go(-2)"><font color="White"><b>>> ${lang("commentdupe.back")}</b></font></a>
+ </td>
+ </tr>
</table>
</body>
Außerdem gibt es Beiträge, die sofort in ein
Müllarchiv kommen:
<ul>
- <li>Diskriminierender oder menschenverachtender Inhalt
- <li>Offensichtlicher Spam
+ <li>Diskriminierender oder menschenverachtender Inhalt
+ <li>Offensichtlicher Spam
</ul>
</ul>
<html>
<head>
- <title>${lang("postingdone.htmltitle")}</title>
- <style type="text/css" media="all">@import "forms.css";</style>
+ <title>${lang("postingdone.htmltitle")}</title>
+ <style type="text/css" media="all">@import "forms.css";</style>
</head>
<body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" bgcolor="#dddddd">
- <table cellspacing="0" cellpadding="0" width="100%">
- <tr>
- <td colspan="3" width="100%"> </td>
- </tr>
- <tr>
- <td width="20%" bgcolor="#ff9966">
- <a href="${config["Producer.ProductionHost"]}/index.shtml" class="startlink">start >></a>
- </td>
- <td width="60%" bgcolor="#ff9966" class="pad4x">
- <span id="title"><b>${lang("postingdone.title")}</b></span>
- </td>
- <td width="20%"> </td>
- </tr>
- <tr>
- <td colspan="3" class="pad4x"><span class="size2px"> </span></td>
- </tr>
- <tr>
- <td align="right"> </td>
- <td class="pad5L">
- <br>
+ <table cellspacing="0" cellpadding="0" width="100%">
+ <tr>
+ <td colspan="3" width="100%"> </td>
+ </tr>
+ <tr>
+ <td width="20%" bgcolor="#ff9966">
+ <a href="${config["Producer.ProductionHost"]}/index.shtml" class="startlink">start >></a>
+ </td>
+ <td width="60%" bgcolor="#ff9966" class="pad4x">
+ <span id="title"><b>${lang("postingdone.title")}</b></span>
+ </td>
+ <td width="20%"> </td>
+ </tr>
+ <tr>
+ <td colspan="3" class="pad4x"><span class="size2px"> </span></td>
+ </tr>
+ <tr>
+ <td align="right"> </td>
+ <td class="pad5L">
+ <br>
${lang("postingdone.info")}<br>
- <br>
- <em>${lang("commentdone.stay_calm")}</em><br>
- <br>
- </td>
- <td> </td>
- </tr>
-
- <tr>
- <td align="right"> </td>
- <td class="pad5Lx" bgcolor="#eecc99">
- <if referer>
+ <br>
+ <em>${lang("commentdone.stay_calm")}</em><br>
+ <br>
+ </td>
+ <td> </td>
+ </tr>
+
+ <tr>
+ <td align="right"> </td>
+ <td class="pad5Lx" bgcolor="#eecc99">
+ <if referer>
<a href="${referer}"><b>${lang("postingdone.back")} >></b></a>
- </if>
- </td>
- <td bgcolor="#eecc99"> </td>
- </tr>
- <tr>
- <td colspan="3" class="pad2x"> <br><br></td>
- </tr>
- </table>
+ </if>
+ </td>
+ <td bgcolor="#eecc99"> </td>
+ </tr>
+ <tr>
+ <td colspan="3" class="pad2x"> <br><br></td>
+ </tr>
+ </table>
</body>
<html>
<head>
- <title>${lang("commentdone.htmltitle")}</title>
+ <title>${lang("commentdone.htmltitle")}</title>
</head>
<body bgcolor="White" text="Black" link="#006600" vlink="#009900" alink="Red">
<table width="100%" border="0" cellspacing="0" cellpadding="10">
- <tr>
- <td valign="top" align="center" bgcolor="#663399">
- <font color="White"><b>${lang("commentdone.thanks")}</b></font
- </td>
- </tr>
- <tr>
- <td bgcolor="#cccccc" align="center">
+ <tr>
+ <td valign="top" align="center" bgcolor="#663399">
+ <font color="White"><b>${lang("commentdone.thanks")}</b></font
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="#cccccc" align="center">
- <br>
+ <br>
${lang("commentdone.wait")}
- <br>
+ <br>
${lang("commentdone.criteria")}
- <br>
- <em>${lang("commentdone.stay_calm")}</em><br>
- <br>
+ <br>
+ <em>${lang("commentdone.stay_calm")}</em><br>
+ <br>
- </td>
- </tr>
- <tr>
- <td valign="top" align="center" bgcolor="#663399">
- <a href="${referer}"><font color="White"><b>>> ${lang("commentdone.back")}</b></font></a>
- </td>
- </tr>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" align="center" bgcolor="#663399">
+ <a href="${referer}"><font color="White"><b>>> ${lang("commentdone.back")}</b></font></a>
+ </td>
+ </tr>
</table>
</body>
<html>
<head>
- <title>${lang("postingdupe.htmltitle")}</title>
- <style type="text/css" media="all">@import "forms.css";</style>
+ <title>${lang("postingdupe.htmltitle")}</title>
+ <style type="text/css" media="all">@import "forms.css";</style>
</head>
<body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0" bgcolor="#dddddd">
- <table cellspacing="0" cellpadding="0" width="100%">
- <tr>
- <td colspan="3" width="100%"> </td>
- </tr>
- <tr>
- <td width="20%" bgcolor="#cc3333">
- <a href="${config["Producer.ProductionHost]}/index.shtml" class="startlink">start >></a>
- </td>
- <td width="60%" bgcolor="#cc3333" class="pad4x">
- <span id="title"><b>${lang("postingdupe.title")}</b></span>
- </td>
- <td width="20%"> </td>
- </tr>
- <tr>
- <td colspan="3" class="pad4x"><span class="size2px"> </span></td>
- </tr>
- <tr>
- <td align="right"> </td>
- <td class="pad5L">
- <br>
+ <table cellspacing="0" cellpadding="0" width="100%">
+ <tr>
+ <td colspan="3" width="100%"> </td>
+ </tr>
+ <tr>
+ <td width="20%" bgcolor="#cc3333">
+ <a href="${config["Producer.ProductionHost]}/index.shtml" class="startlink">start >></a>
+ </td>
+ <td width="60%" bgcolor="#cc3333" class="pad4x">
+ <span id="title"><b>${lang("postingdupe.title")}</b></span>
+ </td>
+ <td width="20%"> </td>
+ </tr>
+ <tr>
+ <td colspan="3" class="pad4x"><span class="size2px"> </span></td>
+ </tr>
+ <tr>
+ <td align="right"> </td>
+ <td class="pad5L">
+ <br>
${lang("postingdupe.explanation")}<br>
- <br>
- <em><font color="#cc3333">${lang("postingdupe.no_panic")}</font></em><br>
- <br>
- </td>
- <td> </td>
- </tr>
-
- <tr>
- <td align="right"> </td>
- <td class="pad5Lx" bgcolor="#eecc99">
- <a href="javascript:history.go(-2)"><b>${lang("postingdupe.back")} >></b></a>
- </td>
- <td bgcolor="#eecc99"> </td>
- </tr>
- <tr>
- <td colspan="3" class="pad2x"> <br><br></td>
- </tr>
- </table>
+ <br>
+ <em><font color="#cc3333">${lang("postingdupe.no_panic")}</font></em><br>
+ <br>
+ </td>
+ <td> </td>
+ </tr>
+
+ <tr>
+ <td align="right"> </td>
+ <td class="pad5Lx" bgcolor="#eecc99">
+ <a href="javascript:history.go(-2)"><b>${lang("postingdupe.back")} >></b></a>
+ </td>
+ <td bgcolor="#eecc99"> </td>
+ </tr>
+ <tr>
+ <td colspan="3" class="pad2x"> <br><br></td>
+ </tr>
+ </table>
</body>
<html>
<head>
- <title>${lang("commentdupe.htmltitle")}</title>
+ <title>${lang("commentdupe.htmltitle")}</title>
</head>
<body bgcolor="White" text="Black" link="white" vlink="#009900" alink="Red">
<table width="100%" border="0" cellspacing="0" cellpadding="10">
- <tr>
- <td valign="top" align="center" bgcolor="#663399">
- <font color="White"><b>
- ${lang("commentdupe.title")}
- </b></font
- </td>
- </tr>
- <tr>
- <td bgcolor="003300" width=70%>
- <font color="White">
- <br>
+ <tr>
+ <td valign="top" align="center" bgcolor="#663399">
+ <font color="White"><b>
+ ${lang("commentdupe.title")}
+ </b></font
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="003300" width=70%>
+ <font color="White">
+ <br>
${lang("commentdupe.explanation")}
- <br>
- <center><em>${lang("commentdupe.no_panic")}</em></center><br>
- <br>
- </font>
- </td>
- </tr>
- <tr>
- <td valign="top" align="center" bgcolor="#663399">
- <a href="javascript:history.go(-2)"><font color="White"><b>>> ${lang("commentdupe.back")}</b></font></a>
- </td>
- </tr>
+ <br>
+ <center><em>${lang("commentdupe.no_panic")}</em></center><br>
+ <br>
+ </font>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" align="center" bgcolor="#663399">
+ <a href="javascript:history.go(-2)"><font color="White"><b>>> ${lang("commentdupe.back")}</b></font></a>
+ </td>
+ </tr>
</table>
</body>
</h2>
<div class="pformstep02">
<table>
- <tr>
- <td>
- ${lang("posting.media.title")} 1:
- </td>
- <td colspan="2">
- <input type="text" name="media1_title" size="40" maxlength="80" value=""><br>
- </td>
- </tr>
- <tr>
- <td>${lang("posting.media.media")} 1</td>
- <td colspan="2">
- <INPUT TYPE="file" NAME="media1">
- </td>
- </tr>
- <tr>
- <td>
- ${lang("posting.media.title")} 2:
- </td>
- <td colspan="2">
- <input type="text" name="media2_title" size="40" maxlength="80" value=""><br>
- </td>
- </tr>
- <tr>
- <td>${lang("posting.media.media")} 2</td>
- <td colspan="2">
- <INPUT TYPE="file" NAME="media2">
- </td>
- </tr>
- <tr>
- <td>
- ${lang("posting.media.title")} 3:
- </td>
- <td colspan="2">
- <input type="text" name="media3_title" size="40" maxlength="80" value=""><br>
- </td>
- </tr>
- <tr>
- <td>${lang("posting.media.media")} 3</td>
- <td colspan="2">
- <INPUT TYPE="file" NAME="media3">
- </td>
- </tr>
+ <tr>
+ <td>
+ ${lang("posting.media.title")} 1:
+ </td>
+ <td colspan="2">
+ <input type="text" name="media1_title" size="40" maxlength="80" value=""><br>
+ </td>
+ </tr>
+ <tr>
+ <td>${lang("posting.media.media")} 1</td>
+ <td colspan="2">
+ <INPUT TYPE="file" NAME="media1">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ${lang("posting.media.title")} 2:
+ </td>
+ <td colspan="2">
+ <input type="text" name="media2_title" size="40" maxlength="80" value=""><br>
+ </td>
+ </tr>
+ <tr>
+ <td>${lang("posting.media.media")} 2</td>
+ <td colspan="2">
+ <INPUT TYPE="file" NAME="media2">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ${lang("posting.media.title")} 3:
+ </td>
+ <td colspan="2">
+ <input type="text" name="media3_title" size="40" maxlength="80" value=""><br>
+ </td>
+ </tr>
+ <tr>
+ <td>${lang("posting.media.media")} 3</td>
+ <td colspan="2">
+ <INPUT TYPE="file" NAME="media3">
+ </td>
+ </tr>
</table>
</div>
------------------------------------------------------------
${data.article.title}
-
+
${data.article.creator}, ${data.article.creationdate.formatted["dd.MM.yyyy HH:mm"]}
${data.article.description}
-
+
${data.article.content_data}
-
-<if data.article.creator_main_url || data.article.creator_email>
+
+<if data.article.creator_main_url || data.article.creator_email>
<if data.article.creator_email>
${lang("article.email.prefix")}: ${data.article.creator_email}
</if>
<table cellpadding="30" cellspacing="0" border="0" width="80%"><tr><td>
<br>
<h2>${data.article.title}(<a href="${config["Producer.ProductionHost"]}/${config["Producer.DocRoot"]}/${data.languagecode}/${data.article.creationdate.formatted["yyyy/MM"]}/${data.article.id}.shtml">original location here</a>)</h2>
-
- <p><i><font size="-1">${data.article.creator}, ${data.article.creationdate.formatted["dd.MM.yyyy HH:mm"]}</font></i></p>
+
+ <p><i><font size="-1">${data.article.creator}, ${data.article.creationdate.formatted["dd.MM.yyyy HH:mm"]}</font></i></p>
<br>
- <p>${data.article.description_parsed}</p>
- <!-- media -->
- <list data.article.to_media_audio as media>
- <p>
- <a href="${media["publish_server"]}${media["publish_path"]}">
- ${media["title"]} - ${media["media_descr"]} ${media["human_readable_size"]}
- </a>
- </p>
- </list>
- <list data.article.to_media_video as media>
- <p>
- <img src="../../../img/${media["big_icon"]}" border="0" alt="">
- <a href="${media["publish_server"]}${media["publish_path"]}">
- ${media["title"]} - ${media["media_descr"]} ${media["human_readable_size"]}</a>
- </p>
- </list>
- <list data.article.to_media_other as media>
- <p>
- <img src="../../../img/${media["big_icon"]}" border="0" alt="">
- <a href="${media["publish_server"]}${media["publish_path"]}">
- ${media["title"]} - ${media["media_descr"]} ${media["human_readable_size"]}</a>
- </p>
- </list>
-
- <list data.article.to_media_images as image>
- <p>
- <img src="${image["publish_server"]}${image["publish_path"]}"
- border="0" width="${image["img_width"]}"
- height="${image["img_height"]}" alt="${image["title"]}">
- <br><i>${image["title"]}</i>
- </p>
- </list>
- <br>
- <p><font size="-1">${data.article.content_data_parsed}</font></p>
- <br>
- <if data.article.creator_main_url || data.article.creator_email>
- <p>
- <font size="-1">
- <if data.article.creator_email>
- <img src="../../../img/mail_small.gif" width="12" height="10" border="0" alt="-"> ${lang("article.email.prefix")}: <a href="mailto:${article.creator_email}">${article.creator_email}</a><br>
- </if>
- <if data.article.creator_main_url>
- <img src="../../../img/link_small.gif" width="12" height="10" border="0" alt=""> ${lang("article.homepage.prefix")}: <a href="${article.creator_main_url}" target="extern">${data.article.creator_main_url}</a><br>
- </if>
- </font>
- </p>
- </if>
- <br>
- <br>
- <br>
- !COMMENT!
- </td>
- </tr>
+ <p>${data.article.description_parsed}</p>
+ <!-- media -->
+ <list data.article.to_media_audio as media>
+ <p>
+ <a href="${media["publish_server"]}${media["publish_path"]}">
+ ${media["title"]} - ${media["media_descr"]} ${media["human_readable_size"]}
+ </a>
+ </p>
+ </list>
+ <list data.article.to_media_video as media>
+ <p>
+ <img src="../../../img/${media["big_icon"]}" border="0" alt="">
+ <a href="${media["publish_server"]}${media["publish_path"]}">
+ ${media["title"]} - ${media["media_descr"]} ${media["human_readable_size"]}</a>
+ </p>
+ </list>
+ <list data.article.to_media_other as media>
+ <p>
+ <img src="../../../img/${media["big_icon"]}" border="0" alt="">
+ <a href="${media["publish_server"]}${media["publish_path"]}">
+ ${media["title"]} - ${media["media_descr"]} ${media["human_readable_size"]}</a>
+ </p>
+ </list>
+
+ <list data.article.to_media_images as image>
+ <p>
+ <img src="${image["publish_server"]}${image["publish_path"]}"
+ border="0" width="${image["img_width"]}"
+ height="${image["img_height"]}" alt="${image["title"]}">
+ <br><i>${image["title"]}</i>
+ </p>
+ </list>
+ <br>
+ <p><font size="-1">${data.article.content_data_parsed}</font></p>
+ <br>
+ <if data.article.creator_main_url || data.article.creator_email>
+ <p>
+ <font size="-1">
+ <if data.article.creator_email>
+ <img src="../../../img/mail_small.gif" width="12" height="10" border="0" alt="-"> ${lang("article.email.prefix")}: <a href="mailto:${article.creator_email}">${article.creator_email}</a><br>
+ </if>
+ <if data.article.creator_main_url>
+ <img src="../../../img/link_small.gif" width="12" height="10" border="0" alt=""> ${lang("article.homepage.prefix")}: <a href="${article.creator_main_url}" target="extern">${data.article.creator_main_url}</a><br>
+ </if>
+ </font>
+ </p>
+ </if>
+ <br>
+ <br>
+ <br>
+ !COMMENT!
+ </td>
+ </tr>
</table>
</body>
</html>
<body>
<include "head.template">
<table width="100%" border="0" align="center">
- <tr class="grey">
- <td>
- <div align="center"><h2><font class="specialtext">${lang("error.title")}</font></h2>
- </div>
- </td>
- </tr>
- <tr>
- <td>
- <p>${lang("error.text", config["Mir.Tech-email.address"], config["Mir.Tech-email.name"])}
- </td>
- </tr>
- <tr>
- <td>
- <p>
- <p align="center"><font color="red">${data.date} -- ${data.errorstring}</font>
- <p>
- </td>
- </tr>
- <tr>
- <td>
- <p align="center">
+ <tr class="grey">
+ <td>
+ <div align="center"><h2><font class="specialtext">${lang("error.title")}</font></h2>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p>${lang("error.text", config["Mir.Tech-email.address"], config["Mir.Tech-email.name"])}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p>
+ <p align="center"><font color="red">${data.date} -- ${data.errorstring}</font>
+ <p>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p align="center">
${lang("error.text2", config["Mir.Tech-email.address"], config["Mir.Tech-email.name"])}
- <p>
- </td>
- </tr>
+ <p>
+ </td>
+ </tr>
</table>
<include "foot.template">
</body>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//DE">
<html>
<head>
- <title>${lang("posting.htmltitle")}</title>
- <meta name="description" content="${lang("posting.meta.description")}">
- <meta name="author" content="${lang("posting.meta.author")}">
- <meta name="keywords" content="${lang("posting.meta.keywords")}">
- <!--<meta name="date" content="### Date ###Time">-->
- <meta http-equiv="Content-Type" content="text/html; charset=${config["Mir.DefaultHTMLCharset"]}">
- <meta name="robots" content="index">
- <meta name="robots" content="follow">
-
- <link rel=stylesheet type="text/css" href="${config["Producer.ProductionHost"]}/style/formate.css">
+ <title>${lang("posting.htmltitle")}</title>
+ <meta name="description" content="${lang("posting.meta.description")}">
+ <meta name="author" content="${lang("posting.meta.author")}">
+ <meta name="keywords" content="${lang("posting.meta.keywords")}">
+ <!--<meta name="date" content="### Date ###Time">-->
+ <meta http-equiv="Content-Type" content="text/html; charset=${config["Mir.DefaultHTMLCharset"]}">
+ <meta name="robots" content="index">
+ <meta name="robots" content="follow">
+
+ <link rel=stylesheet type="text/css" href="${config["Producer.ProductionHost"]}/style/formate.css">
</head>
<body bgcolor="White" text="Black" link="#006600" vlink="#006600" alink="Red">
<table width="99%" border="0" cellspacing="0" cellpadding="8" bgcolor="silver">
- <tr>
- <td align="left" bgcolor="#663399" colspan="3">
- <a href="#form"><font face="Verdana, Arial, Helvetica, sans-serif" size="-2" color="white"><b>>> ${lang("posting.jump_to_form")}</b></font></a>
- <br>
- </td>
- </tr>
- <tr>
- <td align="center" colspan="3">
- <font size="+1" face="Verdana, Arial, Helvetica, sans-serif"><b>${lang("posting.title")}</b></font><br>
- </td>
- </tr>
- <tr>
- <td colspan="3" bgcolor="white">
+ <tr>
+ <td align="left" bgcolor="#663399" colspan="3">
+ <a href="#form"><font face="Verdana, Arial, Helvetica, sans-serif" size="-2" color="white"><b>>> ${lang("posting.jump_to_form")}</b></font></a>
+ <br>
+ </td>
+ </tr>
+ <tr>
+ <td align="center" colspan="3">
+ <font size="+1" face="Verdana, Arial, Helvetica, sans-serif"><b>${lang("posting.title")}</b></font><br>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" bgcolor="white">
<include "open/disclaimer.inc.de">
-<if data.passwd>
+<if data.passwd>
<br>${data.passwd}
</if>
<br><br>
<a name="form"></a>
- </td>
- </tr>
+ </td>
+ </tr>
<form action="${config["Producer.OpenAction"]}?do=addposting" method="post">
- <tr>
- <td><b>${lang("posting.nr_of_media")}</b> <br>
- ${lang("posting.nr_of_media.info")}</td>
- <td colspan="2"><input type="text" name="medianum" value="${data.medianum}"> <input type="submit" value="${lang("posting.nr_of_media.submit")}">
- </tr>
+ <tr>
+ <td><b>${lang("posting.nr_of_media")}</b> <br>
+ ${lang("posting.nr_of_media.info")}</td>
+ <td colspan="2"><input type="text" name="medianum" value="${data.medianum}"> <input type="submit" value="${lang("posting.nr_of_media.submit")}">
+ </tr>
</form>
<form enctype="multipart/form-data" action="${config["Producer.OpenAction"]}?do=insposting" method="post">
- <tr>
- <td bgcolor="#663399" colspan="3">
- <center><font size="+2" face="Helvetica, Arial,sans-serif" color="white"><b>${lang("posting.form.title")}</b></font></center>
- </td>
- </tr>
-<if data.passwd>
+ <tr>
+ <td bgcolor="#663399" colspan="3">
+ <center><font size="+2" face="Helvetica, Arial,sans-serif" color="white"><b>${lang("posting.form.title")}</b></font></center>
+ </td>
+ </tr>
+<if data.passwd>
<tr>
- <td>${lang("posting.password")}</td>
- <td><input type="text" name="passwd" size="10"></td>
- </tr>
+ <td>${lang("posting.password")}</td>
+ <td><input type="text" name="passwd" size="10"></td>
+ </tr>
</if>
- <tr>
- <td valign="top">
- ${lang("posting.title")}:<br>
- <font size="-2">${lang("posting.title.info")}</font>
- </td>
- <td colspan="2" bgcolor="#003300">
- <input type="text" name="title" size="45" maxlength="45" value=""> <font size="-1" color="white"><br>(${lang("required")})</font>
- </td>
- </tr>
+ <tr>
+ <td valign="top">
+ ${lang("posting.title")}:<br>
+ <font size="-2">${lang("posting.title.info")}</font>
+ </td>
+ <td colspan="2" bgcolor="#003300">
+ <input type="text" name="title" size="45" maxlength="45" value=""> <font size="-1" color="white"><br>(${lang("required")})</font>
+ </td>
+ </tr>
<tr>
<td valign="top">
${lang("posting.topic")}:<br>
- <font size="-2">${lang("posting.topic.info")}</font>
+ <font size="-2">${lang("posting.topic.info")}</font>
</td>
<td colspan="2">
<select name="to_topic" size="3" multiple>
<font size="-1">(<i>${lang("optional")}</i>)</font>
</td>
</tr>
- <tr>
- <td valign="top">
- ${lang("posting.author")}:
- </td>
- <td colspan="2" bgcolor="#003300">
- <input type="text" name="creator" size="45" maxlength="45"> <font size="-1" color="white"><br>${lang("required")}</font>
- </td>
- </tr>
- <tr>
- <td valign="top">
- ${lang("posting.abstract")}:</b> <br>
- <font size="-2">${lang("posting.abstract.info")}</font>
- </td>
- <td colspan="2" bgcolor="#003300">
- <textarea name="description" rows="6" cols="55" wrap=virtual></textarea>
- <font size="-1" color="white"><br>${lang("posting.abstract.constraint")}</font>
- </td>
- </tr>
- <tr>
- <td colspan="3" bgcolor="#FFFFFF">
- <font face="Helvetica, Arial, sans-serif" size=-1 color="#222222">
- ${lang("posting.contact.info")}
- </font>
- </td>
- </tr>
-
- <tr>
- <td>
- ${lang("posting.email")}:
- </td>
- <td colspan="2">
- <input type="text" name="creator_email" size="55" maxlength="80" value=""><br>
- <font size="-1">(<i>${lang("optional")}</i>)</font>
- </td>
- </tr>
- <tr>
- <td>
- ${lang("posting.url")}:
- </td>
- <td colspan="2">
- <input type="text" name="creator_main_url" size="55" maxlength="160" value="http://"><br>
- <font size="-1">(<i>${lang("optional")}</i>)</font>
- </td>
- </tr>
- <tr>
- <td>
- ${lang("posting.address")}:
- </td>
- <td colspan="2">
- <input type="text" name="creator_address" size="55" maxlength="160" value=""><br>
- <font size="-1"> <i>(${lang("optional")})</i></font>
- </td>
- </tr>
- <tr>
- <td>
- ${lang("posting.phone")}:
- </td>
- <td colspan="2">
- <input type="text" name="creator_phone" size="20" maxlength="20" value=""><br>
- <font size="-1">(<i>${lang("optional")}</i>)</font>
- </td>
- </tr>
-
- <tr>
- <td colspan="3" bgcolor="#FFFFFF"> </td>
- </tr>
-
- <tr>
- <td>
- ${lang("posting.language")}:
- </td>
- <td colspan="2">
- <select name="to_language">
- <list extra.languagePopUpData as l>
- <option value="${l.key}">${l.value}</option>
- </list>
- </select>
- <font size="-1"><i>(${lang("optional")})</i></font>
- </td>
- </tr>
- <tr>
- <td valign="top">
- ${lang("posting.text")}:<br>
- <font size="-2">${lang("posting.text.info")}</font>
- </td>
- <td bgcolor="#003300" colspan="2">
- <textarea name="content_data" rows="20" cols="55" wrap="soft"></textarea>
- <br><br>
- </td>
- </tr>
-
- <tr>
- <td>
- <b>${lang("posting.media")}:</b>
- </td>
- <td colspan="2">
- ${lang("posting.media.info")}<br>
- <font size="-2">${lang("posting.media.howto")}</font>
- </td>
- </tr>
+ <tr>
+ <td valign="top">
+ ${lang("posting.author")}:
+ </td>
+ <td colspan="2" bgcolor="#003300">
+ <input type="text" name="creator" size="45" maxlength="45"> <font size="-1" color="white"><br>${lang("required")}</font>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ ${lang("posting.abstract")}:</b> <br>
+ <font size="-2">${lang("posting.abstract.info")}</font>
+ </td>
+ <td colspan="2" bgcolor="#003300">
+ <textarea name="description" rows="6" cols="55" wrap=virtual></textarea>
+ <font size="-1" color="white"><br>${lang("posting.abstract.constraint")}</font>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" bgcolor="#FFFFFF">
+ <font face="Helvetica, Arial, sans-serif" size=-1 color="#222222">
+ ${lang("posting.contact.info")}
+ </font>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ ${lang("posting.email")}:
+ </td>
+ <td colspan="2">
+ <input type="text" name="creator_email" size="55" maxlength="80" value=""><br>
+ <font size="-1">(<i>${lang("optional")}</i>)</font>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ${lang("posting.url")}:
+ </td>
+ <td colspan="2">
+ <input type="text" name="creator_main_url" size="55" maxlength="160" value="http://"><br>
+ <font size="-1">(<i>${lang("optional")}</i>)</font>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ${lang("posting.address")}:
+ </td>
+ <td colspan="2">
+ <input type="text" name="creator_address" size="55" maxlength="160" value=""><br>
+ <font size="-1"> <i>(${lang("optional")})</i></font>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ${lang("posting.phone")}:
+ </td>
+ <td colspan="2">
+ <input type="text" name="creator_phone" size="20" maxlength="20" value=""><br>
+ <font size="-1">(<i>${lang("optional")}</i>)</font>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="3" bgcolor="#FFFFFF"> </td>
+ </tr>
+
+ <tr>
+ <td>
+ ${lang("posting.language")}:
+ </td>
+ <td colspan="2">
+ <select name="to_language">
+ <list extra.languagePopUpData as l>
+ <option value="${l.key}">${l.value}</option>
+ </list>
+ </select>
+ <font size="-1"><i>(${lang("optional")})</i></font>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
+ ${lang("posting.text")}:<br>
+ <font size="-2">${lang("posting.text.info")}</font>
+ </td>
+ <td bgcolor="#003300" colspan="2">
+ <textarea name="content_data" rows="20" cols="55" wrap="soft"></textarea>
+ <br><br>
+ </td>
+ </tr>
+
+ <tr>
+ <td>
+ <b>${lang("posting.media")}:</b>
+ </td>
+ <td colspan="2">
+ ${lang("posting.media.info")}<br>
+ <font size="-2">${lang("posting.media.howto")}</font>
+ </td>
+ </tr>
<list data.mediafields as m>
- <tr>
- <td>
- ${lang("posting.media.title")} ${m}:
- </td>
- <td colspan="2">
- <input type="text" name="media_title${m}" size="40" maxlength="80" value=""><br>
- </td>
- </tr>
- <tr>
- <td>${lang("posting.media.media")} ${m}</td>
- <td colspan="2">
- <INPUT TYPE="file" NAME="media${m}">
- <br><font size="-1">(<i>${lang("optional")}</i>)</font>
- </td>
- </tr>
+ <tr>
+ <td>
+ ${lang("posting.media.title")} ${m}:
+ </td>
+ <td colspan="2">
+ <input type="text" name="media_title${m}" size="40" maxlength="80" value=""><br>
+ </td>
+ </tr>
+ <tr>
+ <td>${lang("posting.media.media")} ${m}</td>
+ <td colspan="2">
+ <INPUT TYPE="file" NAME="media${m}">
+ <br><font size="-1">(<i>${lang("optional")}</i>)</font>
+ </td>
+ </tr>
</list>
- <tr>
- <td colspan="3" bgcolor="#FFFFFF"> </td>
- </tr>
+ <tr>
+ <td colspan="3" bgcolor="#FFFFFF"> </td>
+ </tr>
- <tr>
- <td align="left" valign="center">
+ <tr>
+ <td align="left" valign="center">
<!-- text -->
${lang("posting.submit.info")}
- <br>
- ${lang("posting.criteria")}<br>
+ <br>
+ ${lang("posting.criteria")}<br>
- </td>
- <td bgcolor="#663399" valign="center" align="center">
- <input type="submit" value="${lang("posting.submit")}">
+ </td>
+ <td bgcolor="#663399" valign="center" align="center">
+ <input type="submit" value="${lang("posting.submit")}">
- </td>
- <td bgcolor="#003300" valign="center" align="center">
- <input type="reset" value="${lang("posting.reset")}">
- </td>
- </tr>
+ </td>
+ <td bgcolor="#003300" valign="center" align="center">
+ <input type="reset" value="${lang("posting.reset")}">
+ </td>
+ </tr>
</form>
</table>
<html>
<head>
- <title>${lang("postingdisabled.htmltitle")}</title>
+ <title>${lang("postingdisabled.htmltitle")}</title>
</head>
<body bgcolor="White" text="Black" link="#006600" vlink="#666666" alink="Red">
<table width="100%" border="0" cellspacing="0" cellpadding="4" bgcolor="#cccccc">
- <tr>
- <td align="center" bgcolor="#666666">
- <font color="White">${lang("postingdisabled.title")}</font></td>
- </tr>
- <tr>
- <td bgcolor="#eeeeee">
- <font color="#000000">
- <center>
+ <tr>
+ <td align="center" bgcolor="#666666">
+ <font color="White">${lang("postingdisabled.title")}</font></td>
+ </tr>
+ <tr>
+ <td bgcolor="#eeeeee">
+ <font color="#000000">
+ <center>
${lang("postingdisabled.info")}
<center>
- </font>
- </td>
+ </font>
+ </td>
</tr>
<tr>
- <td valign="top" align="center" bgcolor="#666666">
- <a href="javascript:history.go(-1)"><font color="White"><b>>> ${lang("postingdisabled.back")}</b></font></a>
- </td>
- </tr>
+ <td valign="top" align="center" bgcolor="#666666">
+ <a href="javascript:history.go(-1)"><font color="White"><b>>> ${lang("postingdisabled.back")}</b></font></a>
+ </td>
+ </tr>
</table>
</body>
</html>
<html>
<head>
- <title>${lang("postingdone.htmltitle")}</title>
+ <title>${lang("postingdone.htmltitle")}</title>
</head>
<body bgcolor="White" text="Black" link="#006600" vlink="#666666" alink="Red">
<table width="100%" border="0" cellspacing="0" cellpadding="4" bgcolor="#cccccc">
- <tr>
- <td align="center" bgcolor="#666666">
- <font color="White">${lang("postingdone.title")}</font></td>
- </tr>
- <tr>
- <td bgcolor="#eeeeee"><font color="#000000">
+ <tr>
+ <td align="center" bgcolor="#666666">
+ <font color="White">${lang("postingdone.title")}</font></td>
+ </tr>
+ <tr>
+ <td bgcolor="#eeeeee"><font color="#000000">
<br>
<br><br>
<center><EM>${lang("postingdone.stay_calm")}</EM></center><br><br>
- </font>
- </td>
+ </font>
+ </td>
</tr>
<tr>
- <td valign="top" align="center" bgcolor="#666666">
- <a href="javascript:history.go(-2)"><font color="White"><b>>> ${lang("postingdone.back")}</b></font></a>
- </td>
- </tr>
+ <td valign="top" align="center" bgcolor="#666666">
+ <a href="javascript:history.go(-2)"><font color="White"><b>>> ${lang("postingdone.back")}</b></font></a>
+ </td>
+ </tr>
</table>
</body>
</html>
<html>
<head>
- <title>${lang("postingdupe.htmltitle")}</title>
+ <title>${lang("postingdupe.htmltitle")}</title>
</head>
<body bgcolor="White" text="Black" link="white" vlink="#009900" alink="Red">
<table width="100%" border="0" cellspacing="0" cellpadding="10">
- <tr>
- <td valign="top" align="center" bgcolor="#663399">
- <font color="White"><b>
- ${lang("postingdupe.title")}
- </b></font
- </td>
- </tr>
- <tr>
- <td bgcolor="003300" width=70%>
- <font color="White">
- <br>
+ <tr>
+ <td valign="top" align="center" bgcolor="#663399">
+ <font color="White"><b>
+ ${lang("postingdupe.title")}
+ </b></font
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="003300" width=70%>
+ <font color="White">
+ <br>
${lang("postingdupe.explanation")}
- <br>
- <center><em>${lang("postingdupe.no_panic")}</em></center><br>
- <br>
- </font>
- </td>
- </tr>
- <tr>
- <td valign="top" align="center" bgcolor="#663399">
- <a href="javascript:history.go(-2)"><font color="White"><b>>> ${lang("postingdupe.back")}</b></font></a>
- </td>
- </tr>
+ <br>
+ <center><em>${lang("postingdupe.no_panic")}</em></center><br>
+ <br>
+ </font>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top" align="center" bgcolor="#663399">
+ <a href="javascript:history.go(-2)"><font color="White"><b>>> ${lang("postingdupe.back")}</b></font></a>
+ </td>
+ </tr>
</table>
</body>
<html>
<head>
- <title>${lang("email.prepare.htmltitle")}</title>
+ <title>${lang("email.prepare.htmltitle")}</title>
</head>
<body bgcolor="White" text="Black" link="#006600" vlink="#666666" alink="Red">
<table width="100%" border="0" cellspacing="0" cellpadding="4" bgcolor="#cccccc">
- <tr>
- <td align="center" bgcolor="#666666">
- <font color="White">${lang("email.prepare.title")}</font></td>
- </tr>
- <tr>
- <td bgcolor="#eeeeee"><font color="#000000">
+ <tr>
+ <td align="center" bgcolor="#666666">
+ <font color="White">${lang("email.prepare.title")}</font></td>
+ </tr>
+ <tr>
+ <td bgcolor="#eeeeee"><font color="#000000">
${lang("email.prepare.description")}<BR>
<FORM method="post" action="${config["Producer.OpenAction"]}">
<input type="hidden" name="do" value="mail">
${lang("email.prepare.comment")} <textarea name="mail_comment" rows="5" cols="40">${data.mail_comment}</textarea><BR>
${lang("email.prepare.chooselanguage")}
<select name="mail_language">
- <option value="en" <if data.mail_language=="en">selected</if>>english</option>
- <option value="de" <if data.mail_language=="de">selected</if>>deutsch</option>
+ <option value="en" <if data.mail_language=="en">selected</if>>english</option>
+ <option value="de" <if data.mail_language=="de">selected</if>>deutsch</option>
</select>
<input type="submit" value='${lang("email.prepare.send")}'>
</FORM>
- </td>
+ </td>
</tr>
<tr>
- <td valign="top" align="center" bgcolor="#666666">
- <a href="javascript:history.go(-1)"><font color="White"><b>>> ${lang("postingdone.back")}</b></font></a>
- </td>
- </tr>
+ <td valign="top" align="center" bgcolor="#666666">
+ <a href="javascript:history.go(-1)"><font color="White"><b>>> ${lang("postingdone.back")}</b></font></a>
+ </td>
+ </tr>
</table>
</body>
</html>
<input type="hidden" name="do" value="search" />
<table width="100%" border="0" cellspacing="2" cellpadding="4" bgcolor="#cccccc">
- <tr>
- <td align="left" class="table-head" colspan="2">
- <b> ${lang("search.title")}</b>
- </td>
- </tr>
-
- <tr>
- <td class="table-right" colspan="2">
-
- </td>
- </tr>
-
- <tr>
- <td class="table-left" width="30%">
- ${lang("search.mainsearchfield")}
- </td>
- <td class="listrow2" valign="top">
- <input type="text" size="40" name="search_content" value="${data.search_content}" />
- </td>
- </tr>
- <tr>
- <td class="table-foot" align="left">
- <spann style='color:#000000; font-size:1.2em;'><b>${lang("search.refine")}</b></spann>
- </td>
- <td class="table-foot" align="right">
- <input type="submit" name="search_submit" value="${lang("search.searchbutton")}" />
- </td>
- </tr>
- <tr>
- <td class="table-left">
- ${lang("search.all_or_any")}
- </td>
- <td class="listrow2">
- <if data.search_boolean == "and">
- <input type="radio" name="search_boolean" value="and" checked="true">${lang("search.all")}
- <input type="radio" name="search_boolean" value="or">${lang("search.any")}
- <else>
- <input type="radio" name="search_boolean" value="and">${lang("search.all")}
- <input type="radio" name="search_boolean" value="or" checked="true">${lang("search.any")}
- </if>
- </td>
- </tr>
- <tr>
- <td class="table-left">
- ${lang("search.by_author")}
- </td>
- <td class="listrow2">
- <input type="text" name="search_creator" value="${data.search_creator}" />
- </td>
- </tr>
- <tr>
- <td class="table-left">${lang("search.by_topic")}</td>
- <td class="listrow2">
- <select name="search_topic">
- <if (!data.search_topic) || (data.search_topic == "") >
- <option value="" selected>${lang("search.all_topics")}
- <else>
- <option value="">${lang("search.all_topics")}
- </if>
- <list data.topics as topic>
- <if topic.value != "--" >
- <if data.search_topic == topic.value>
- <option selected>${topic.value}
- <else>
- <option>${topic.value}
- </if>
- </if>
- </list>
- </select>
- </td>
- </tr>
+ <tr>
+ <td align="left" class="table-head" colspan="2">
+ <b> ${lang("search.title")}</b>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="table-right" colspan="2">
+
+ </td>
+ </tr>
+
+ <tr>
+ <td class="table-left" width="30%">
+ ${lang("search.mainsearchfield")}
+ </td>
+ <td class="listrow2" valign="top">
+ <input type="text" size="40" name="search_content" value="${data.search_content}" />
+ </td>
+ </tr>
+ <tr>
+ <td class="table-foot" align="left">
+ <spann style='color:#000000; font-size:1.2em;'><b>${lang("search.refine")}</b></spann>
+ </td>
+ <td class="table-foot" align="right">
+ <input type="submit" name="search_submit" value="${lang("search.searchbutton")}" />
+ </td>
+ </tr>
+ <tr>
+ <td class="table-left">
+ ${lang("search.all_or_any")}
+ </td>
+ <td class="listrow2">
+ <if data.search_boolean == "and">
+ <input type="radio" name="search_boolean" value="and" checked="true">${lang("search.all")}
+ <input type="radio" name="search_boolean" value="or">${lang("search.any")}
+ <else>
+ <input type="radio" name="search_boolean" value="and">${lang("search.all")}
+ <input type="radio" name="search_boolean" value="or" checked="true">${lang("search.any")}
+ </if>
+ </td>
+ </tr>
+ <tr>
+ <td class="table-left">
+ ${lang("search.by_author")}
+ </td>
+ <td class="listrow2">
+ <input type="text" name="search_creator" value="${data.search_creator}" />
+ </td>
+ </tr>
+ <tr>
+ <td class="table-left">${lang("search.by_topic")}</td>
+ <td class="listrow2">
+ <select name="search_topic">
+ <if (!data.search_topic) || (data.search_topic == "") >
+ <option value="" selected>${lang("search.all_topics")}
+ <else>
+ <option value="">${lang("search.all_topics")}
+ </if>
+ <list data.topics as topic>
+ <if topic.value != "--" >
+ <if data.search_topic == topic.value>
+ <option selected>${topic.value}
+ <else>
+ <option>${topic.value}
+ </if>
+ </if>
+ </list>
+ </select>
+ </td>
+ </tr>
<tr>
<html>
<head>
- <title>${lang("email.sent.htmltitle")}</title>
+ <title>${lang("email.sent.htmltitle")}</title>
</head>
<body bgcolor="White" text="Black" link="#006600" vlink="#666666" alink="Red">
<table width="100%" border="0" cellspacing="0" cellpadding="4" bgcolor="#cccccc">
- <tr>
- <td align="center" bgcolor="#666666">
- <font color="White">${lang("email.sent.title")}</font></td>
- </tr>
- <tr>
- <td bgcolor="#eeeeee"><font color="#000000">
+ <tr>
+ <td align="center" bgcolor="#666666">
+ <font color="White">${lang("email.sent.title")}</font></td>
+ </tr>
+ <tr>
+ <td bgcolor="#eeeeee"><font color="#000000">
${lang("email.sent.text")}
- </td>
+ </td>
</tr>
<tr>
- <td valign="top" align="center" bgcolor="#666666">
+ <td valign="top" align="center" bgcolor="#666666">
<a href="javascript:history.go(-2)"><font color="White"><b>>> ${lang("postingdone.back")}</b></font></a>
- </td>
- </tr>
+ </td>
+ </tr>
</table>
</body>
</html>
<body>
<include "head.template">
<table width="100%" border="0" align="center">
- <tr class="grey">
- <td>
- <div align="center"><h2><font class="specialtext">${lang("error.title")}</font></h2>
- </div>
- </td>
- </tr>
- <tr>
- <td>
- <p>${lang("error.text", config["Mir.Tech-email.address"], config["Mir.Tech-email.name"])}
- </td>
- </tr>
- <tr>
- <td>
- <p>
- <p align="center"><font color="red">${data.date} -- ${data.errorstring}</font>
- <p>
- </td>
- </tr>
- <tr>
- <td>
- <p align="center">
+ <tr class="grey">
+ <td>
+ <div align="center"><h2><font class="specialtext">${lang("error.title")}</font></h2>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p>${lang("error.text", config["Mir.Tech-email.address"], config["Mir.Tech-email.name"])}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p>
+ <p align="center"><font color="red">${data.date} -- ${data.errorstring}</font>
+ <p>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p align="center">
${lang("error.text2", config["Mir.Tech-email.address"], config["Mir.Tech-email.name"])}
- <p>
- </td>
- </tr>
+ <p>
+ </td>
+ </tr>
</table>
<include "foot.template">
</body>
<body>
<include "head.template">
<table width="100%" border="0" align="center">
- <tr class="grey">
- <td>
- <div align="center"><h2><font class="specialtext">${lang("error.title")}</font></h2>
- </div>
- </td>
- </tr>
- <tr>
- <td>
- <p>${lang("error.text", config["Mir.Tech-email.address"], config["Mir.Tech-email.name"])}
- </td>
- </tr>
- <tr>
- <td>
- <p>
- <p align="center"><font color="red">${data.date} -- ${data.errorstring}</font>
- <p>
- </td>
- </tr>
- <tr>
- <td>
- <p align="center">
+ <tr class="grey">
+ <td>
+ <div align="center"><h2><font class="specialtext">${lang("error.title")}</font></h2>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p>${lang("error.text", config["Mir.Tech-email.address"], config["Mir.Tech-email.name"])}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p>
+ <p align="center"><font color="red">${data.date} -- ${data.errorstring}</font>
+ <p>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p align="center">
${lang("error.text2", config["Mir.Tech-email.address"], config["Mir.Tech-email.name"])}
- <p>
- </td>
- </tr>
+ <p>
+ </td>
+ </tr>
</table>
<include "foot.template">
</body>
<body>
<include "templates/admin/head_nonavi.template">
<table width="100%" border="0" align="center">
- <tr bgcolor="#006600">
- <td>
- <div align="center"><h2><font color="Pink">${lang("usererror.title")}</font></h2>
- </div>
- </td>
- </tr>
- <tr>
- <td>
- <p>${lang("usererror.text")}
- </td>
- </tr>
- <tr>
- <td>
- <p>
- <p align="center"><font size="5" color="Red"><b> ${data.errorstring}</b></font>
+ <tr bgcolor="#006600">
+ <td>
+ <div align="center"><h2><font color="Pink">${lang("usererror.title")}</font></h2>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p>${lang("usererror.text")}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p>
+ <p align="center"><font size="5" color="Red"><b> ${data.errorstring}</b></font>
<p>
- <p>
- </td>
- </tr>
- <tr>
- <td>
- <p align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">${lang("usererror.what_to_do")}
- </a></font>
- <p>
- </td>
- </tr>
+ <p>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <p align="center"><font face="Verdana, Arial, Helvetica, sans-serif" size="-1">${lang("usererror.what_to_do")}
+ </a></font>
+ <p>
+ </td>
+ </tr>
</table>
<include "foot.template">
</body>
import mir.util.StringRoutines;
import mircoders.entity.EntityUsers;
import mircoders.global.MirGlobal;
-import mircoders.module.ModuleMessage;
import mircoders.module.ModuleUsers;
import mircoders.servlet.ServletHelper;
import mircoders.storage.DatabaseUsers;
* Mir.java - main servlet, that dispatches to servletmodules
*
* @author $Author: zapata $
- * @version $Id: Mir.java,v 1.49.2.9 2003/12/21 13:32:02 zapata Exp $
+ * @version $Id: Mir.java,v 1.49.2.10 2004/01/11 20:35:51 zapata 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;
HttpSession session = aRequest.getSession(true);
setNoCaching(aResponse);
- Locale locale = new Locale(getDefaultLanguage(aRequest), "");
aResponse.setContentType("text/html; charset=" +
configuration.
getString("Mir.DefaultHTMLCharset", "UTF-8"));
import mir.generator.tal.MirExpressionParser;
import mir.generator.tal.TALTemplate;
import mir.generator.tal.TALTemplateEngine;
+import mir.generator.tal.interfaces.TALLogger;
import mir.log.LoggerWrapper;
public class TALGenerator implements Generator {
library = aLibrary;
}
- public void generate(Object anOutputWriter, Map aValues, LoggerWrapper aLogger) throws GeneratorExc, GeneratorFailure {
+ public void generate(Object anOutputWriter, Map aValues, final LoggerWrapper aLogger) throws GeneratorExc, GeneratorFailure {
TALTemplate template;
try {
template = library.engine.loadTemplate(templateIdentifier);
+
if (template == null) {
throw new GeneratorExc("TALGeneratorLibrary: Can't find template " + templateIdentifier);
}
- template.processTemplate(aValues, (PrintWriter) anOutputWriter);
+
+ template.processTemplate(aValues, (PrintWriter) anOutputWriter,
+ new TALLogger() {
+ public void debug(String anObject, String aMessage) {
+ aLogger.debug(anObject + ": " + aMessage);
+ }
+
+ public void info(String anObject, String aMessage) {
+ aLogger.info(anObject + ": " + aMessage);
+ }
+
+ public void warning(String anObject, String aMessage) {
+ aLogger.warn(anObject + ": " + aMessage);
+ }
+
+ public void error(String anObject, String aMessage) {
+ aLogger.error(anObject + ": " + aMessage);
+ }
+
+ public void fatal(String anObject, String aMessage) {
+ aLogger.fatal(anObject + ": " + aMessage);
+ }
+ });
}
catch (Throwable t) {
throw new GeneratorFailure(t);
* exception to your version of the file, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your version.
*/
+
package mir.generator.tal;
import java.io.BufferedInputStream;
-/*
- * Copyright (C) 2001, 2002 The Mir-coders group
- *
- * This file is part of Mir.
- *
- * Mir is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Mir is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Mir; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with any library licensed under the Apache Software License,
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
- * (or with modified versions of the above that use the same license as the above),
- * and distribute linked combinations including the two. You must obey the
- * GNU General Public License in all respects for all of the code used other than
- * the above mentioned libraries. If you modify this file, you may extend this
- * exception to your version of the file, but you are not obligated to do so.
- * If you do not wish to do so, delete this exception statement from your version.
- */
-package mir.generator.tal;
-
-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.generator.tal.interfaces.TALExpressionParser;
-import mir.util.HTMLRoutines;
-
-/**
- * {@link http://dev.zope.org/Wikis/DevSite/Projects/ZPT/TAL%20Specification%201.4}
- *
- * <p>Title: </p>
- * <p>Description: </p>
- * <p>Copyright: Copyright (c) 2003</p>
- * <p>Company: </p>
- * @author not attributable
- * @version 1.0
- */
-
-public class TALTemplate {
- private TemplateNode rootNode;
- private TALExpressionParser parser;
-
- public TALTemplate(TALExpressionParser aParser, TemplateNode aRootNode) {
- rootNode = aRootNode;
- parser = aParser;
- }
-
- public void processTemplate(Object aContext, PrintWriter aDestination) {
- StringBuffer output = new StringBuffer();
-
- rootNode.process(parser, aContext, output);
- aDestination.print(output);
- }
-
- public interface TemplateNode {
- public void process(TALExpressionParser aParser, Object aContext, StringBuffer aDestination);
- }
-
- public static class CompositeTemplateNode
- implements TemplateNode {
- private List parts;
-
- public CompositeTemplateNode() {
- parts = new Vector();
- }
-
- public void process(TALExpressionParser aParser, Object aContext, StringBuffer aDestination) {
- Iterator i = parts.iterator();
-
- while (i.hasNext()) {
- ((TemplateNode) i.next()).process(aParser, aContext, aDestination);
- }
- }
-
- public void appendSubNode(TemplateNode aNode) {
- if (aNode instanceof CompositeTemplateNode) {
- Iterator i = ((CompositeTemplateNode) aNode).parts.iterator();
- while (i.hasNext()) {
- appendSubNode((TemplateNode) i.next());
- }
- }
- else if (aNode instanceof PlainTextTemplateNode && parts.size()>0 &&
- (parts.get(parts.size()-1) instanceof PlainTextTemplateNode)) {
-
- ((PlainTextTemplateNode) parts.get(parts.size()-1)).appendText(((PlainTextTemplateNode) aNode).getText());
- }
- else {
- parts.add(aNode);
- }
- }
- }
-
- public static class PlainTextTemplateNode
- implements TemplateNode {
- private String text;
-
- public PlainTextTemplateNode() {
- this("");
- }
-
- public PlainTextTemplateNode(String aText) {
- text = aText;
- }
-
- public void appendText(String aText) {
- text = text + aText;
- }
-
- protected String getText() {
- return text;
- }
-
- public void process(TALExpressionParser aParser, Object aContext, StringBuffer aDestination) {
- aDestination.append(text);
- }
- }
-
- public static class SmartTemplateNode implements TemplateNode {
- private String tag;
- private Map fixedAttributes;
- private Map attributeModifiers;
-
- private List definitions;
- private Object condition;
-
- private Object repeatVariable;
- private Object repeatExpression;
- private Object contentExpression;
- private Object omitTagExpression;
- private Object errorExpression;
-
- private TemplateNode body;
-
- public SmartTemplateNode(String aTag) {
- tag = aTag;
-
- fixedAttributes = new HashMap();
- attributeModifiers = new HashMap();
-
- definitions = new Vector();
- condition = null;
-
- repeatVariable = null;
- repeatExpression = null;
- contentExpression = null;
- omitTagExpression = null;
-
- body = null;
- }
-
- public void setBody(TemplateNode aBody) {
- body = aBody;
- }
-
- public void addFixedAttribute(String aKey, String aValue) {
- fixedAttributes.put(aKey, aValue);
- }
-
- public void addModifiedAttribute(String aKey, Object aValue) {
- attributeModifiers.put(aKey, aValue);
- }
-
- public void addDefinition(Object aKey, Object aValue) {
- definitions.add(new Definition(aKey, aValue));
- }
-
- public void setCondition(Object aCondition) {
- condition = aCondition;
- }
-
- public void setRepeat(Object aRepeatVariable, Object aRepeatExpression) {
- repeatVariable = aRepeatVariable;
- repeatExpression = aRepeatExpression;
- }
-
- public void setContent(Object aContentExpression) {
- contentExpression = aContentExpression;
- }
-
- public void setOmitTag(Object anOmitTagExpression) {
- omitTagExpression = anOmitTagExpression;
- }
-
- public void setError(Object anErrorExpression) {
- errorExpression = anErrorExpression;
- }
-
- public static class Definition {
- private Object variable;
- private Object expression;
-
- public Definition(Object aVariable, Object anExpression) {
- variable = aVariable;
- expression = anExpression;
- }
-
- public Object getVariable() {
- return variable;
- }
-
- public Object getExpression() {
- return expression;
- }
- }
-
- public void process(TALExpressionParser aParser, Object aContext, StringBuffer aDestination) {
- Iterator i;
-
- i = definitions.iterator();
- while (i.hasNext()) {
- Definition d = (Definition) i.next();
- aParser.processAssignment(aContext, d.getVariable(), d.getExpression());
- }
-
- if (condition == null || aParser.evaluateBooleanExpression(aContext, condition)) {
- if (repeatExpression != null) {
- i = aParser.evaluateListExpression(aContext, repeatExpression);
-
- while (i.hasNext()) {
- aParser.processDirectAssignment(aContext, repeatVariable, i.next());
- innerProcess(aParser, aContext, aDestination);
- }
- }
- else {
- innerProcess(aParser, aContext, aDestination);
- }
- }
- };
-
- private void innerProcess(TALExpressionParser aParser, Object aContext, StringBuffer aDestination) {
- boolean omitTag = false;
- if (omitTagExpression != null)
- omitTag = aParser.evaluateBooleanExpression(aContext, omitTagExpression);
-
- if (!omitTag) {
- Map generatedAttributes = new HashMap(fixedAttributes);
-
- Iterator i = attributeModifiers.keySet().iterator();
- while (i.hasNext()) {
- Map.Entry entry = (Map.Entry) i.next();
-
- generatedAttributes.put(entry.getKey(), aParser.evaluateStringExpression(aContext, entry.getValue()));
- }
-
- aDestination.append("<");
- aDestination.append(tag);
-
- i = generatedAttributes.entrySet().iterator();
- while (i.hasNext()) {
- Map.Entry entry = (Map.Entry) i.next();
- aDestination.append(" ");
- aDestination.append(entry.getKey());
- aDestination.append("=");
- aDestination.append("\"");
- aDestination.append(HTMLRoutines.encodeHTML( (String) entry.getValue()));
- aDestination.append("\"");
- }
- aDestination.append(">");
- }
-
- StringBuffer destination = aDestination;
- if (errorExpression != null) {
- destination = new StringBuffer();
- }
- try {
- if (contentExpression != null) {
- destination.append(aParser.evaluateStringExpression(aContext, contentExpression));
- }
- else {
- if (body != null)
- body.process(aParser, aContext, destination);
- }
- }
- catch (RuntimeException t) {
- if (errorExpression != null) {
- try {
- destination.delete(0, destination.length());
-
- aParser.processPseudoAssignment(aContext, "exception", t);
- destination.append(aParser.evaluateStringExpression(aContext, errorExpression));
- }
- catch (Throwable s) {
- }
- }
- else
- throw t;
- }
- finally {
- if (errorExpression != null) {
- aDestination.append(destination);
- }
- }
- if (!omitTag) {
- aDestination.append("</");
- aDestination.append(tag);
- aDestination.append(">");
- }
- }
- }
+/*\r
+ * Copyright (C) 2001, 2002 The Mir-coders group\r
+ *\r
+ * This file is part of Mir.\r
+ *\r
+ * Mir is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Mir is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with Mir; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+ *\r
+ * In addition, as a special exception, The Mir-coders gives permission to link\r
+ * the code of this program with any library licensed under the Apache Software License,\r
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library\r
+ * (or with modified versions of the above that use the same license as the above),\r
+ * and distribute linked combinations including the two. You must obey the\r
+ * GNU General Public License in all respects for all of the code used other than\r
+ * the above mentioned libraries. If you modify this file, you may extend this\r
+ * exception to your version of the file, but you are not obligated to do so.\r
+ * If you do not wish to do so, delete this exception statement from your version.\r
+ */\r
+package mir.generator.tal;\r
+\r
+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 mir.generator.tal.interfaces.TALExpressionParser;\r
+import mir.generator.tal.interfaces.TALLogger;\r
+import mir.util.HTMLRoutines;\r
+\r
+/**\r
+ *\r
+ *\r
+ *\r
+ * @see <a href="http://dev.zope.org/Wikis/DevSite/Projects/ZPT/TAL%20Specification%201.4">TAL Spec</a>\r
+ */\r
+\r
+public class TALTemplate {\r
+ private TemplateNode rootNode;\r
+ private TALExpressionParser parser;\r
+\r
+ public TALTemplate(TALExpressionParser aParser, TemplateNode aRootNode) {\r
+ rootNode = aRootNode;\r
+ parser = aParser;\r
+ }\r
+\r
+ public void processTemplate(Object aContext, PrintWriter aDestination, TALLogger aLogger) throws TemplateProcessingException {\r
+ StringBuffer output = new StringBuffer();\r
+\r
+ aLogger.debug("TALTemplate", "processing rootnode");\r
+ rootNode.process(parser, aContext, output, aLogger);\r
+ aLogger.debug("TALTemplate", "done processing rootnode");\r
+ aDestination.print(output);\r
+ }\r
+\r
+ public interface TemplateNode {\r
+ public void process(TALExpressionParser aParser, Object aContext, StringBuffer aDestination, TALLogger aLogger) throws TemplateProcessingException;\r
+ }\r
+\r
+ public static class CompositeTemplateNode\r
+ implements TemplateNode {\r
+ private List parts;\r
+\r
+ public CompositeTemplateNode() {\r
+ parts = new Vector();\r
+ }\r
+\r
+ public void process(TALExpressionParser aParser, Object aContext, StringBuffer aDestination, TALLogger aLogger) throws TemplateProcessingException {\r
+ Iterator i = parts.iterator();\r
+\r
+ while (i.hasNext()) {\r
+ ((TemplateNode) i.next()).process(aParser, aContext, aDestination, aLogger);\r
+ }\r
+ }\r
+\r
+ public void appendSubNode(TemplateNode aNode) {\r
+ if (aNode instanceof CompositeTemplateNode) {\r
+ Iterator i = ((CompositeTemplateNode) aNode).parts.iterator();\r
+ while (i.hasNext()) {\r
+ appendSubNode((TemplateNode) i.next());\r
+ }\r
+ }\r
+ else if (aNode instanceof PlainTextTemplateNode && parts.size()>0 &&\r
+ (parts.get(parts.size()-1) instanceof PlainTextTemplateNode)) {\r
+\r
+ ((PlainTextTemplateNode) parts.get(parts.size()-1)).appendText(((PlainTextTemplateNode) aNode).getText());\r
+ }\r
+ else {\r
+ parts.add(aNode);\r
+ }\r
+ }\r
+ }\r
+\r
+ public static class PlainTextTemplateNode\r
+ implements TemplateNode {\r
+ private String text;\r
+\r
+ public PlainTextTemplateNode() {\r
+ this("");\r
+ }\r
+\r
+ public PlainTextTemplateNode(String aText) {\r
+ text = aText;\r
+ }\r
+\r
+ public void appendText(String aText) {\r
+ text = text + aText;\r
+ }\r
+\r
+ protected String getText() {\r
+ return text;\r
+ }\r
+\r
+ public void process(TALExpressionParser aParser, Object aContext, StringBuffer aDestination, TALLogger aLogger) throws TemplateProcessingException {\r
+ aDestination.append(text);\r
+ }\r
+ }\r
+\r
+ public static class SmartTemplateNode implements TemplateNode {\r
+ private String tag;\r
+ private Map fixedAttributes;\r
+ private Map attributeModifiers;\r
+\r
+ private List definitions;\r
+ private Object condition;\r
+\r
+ private Object repeatVariable;\r
+ private Object repeatExpression;\r
+ private Object contentExpression;\r
+ private Object omitTagExpression;\r
+ private Object errorExpression;\r
+\r
+ private TemplateNode body;\r
+\r
+ public SmartTemplateNode(String aTag) {\r
+ tag = aTag;\r
+\r
+ fixedAttributes = new HashMap();\r
+ attributeModifiers = new HashMap();\r
+\r
+ definitions = new Vector();\r
+ condition = null;\r
+\r
+ repeatVariable = null;\r
+ repeatExpression = null;\r
+ contentExpression = null;\r
+ omitTagExpression = null;\r
+\r
+ body = null;\r
+ }\r
+\r
+ public void setBody(TemplateNode aBody) {\r
+ body = aBody;\r
+ }\r
+\r
+ public void addFixedAttribute(String aKey, String aValue) {\r
+ fixedAttributes.put(aKey, aValue);\r
+ }\r
+\r
+ public void addModifiedAttribute(String aKey, Object aValue) {\r
+ attributeModifiers.put(aKey, aValue);\r
+ }\r
+\r
+ public void addDefinition(Object aKey, Object aValue) {\r
+ definitions.add(new Definition(aKey, aValue));\r
+ }\r
+\r
+ public void setCondition(Object aCondition) {\r
+ condition = aCondition;\r
+ }\r
+\r
+ public void setRepeat(Object aRepeatVariable, Object aRepeatExpression) {\r
+ repeatVariable = aRepeatVariable;\r
+ repeatExpression = aRepeatExpression;\r
+ }\r
+\r
+ public void setContent(Object aContentExpression) {\r
+ contentExpression = aContentExpression;\r
+ }\r
+\r
+ public void setOmitTag(Object anOmitTagExpression) {\r
+ omitTagExpression = anOmitTagExpression;\r
+ }\r
+\r
+ public void setError(Object anErrorExpression) {\r
+ errorExpression = anErrorExpression;\r
+ }\r
+\r
+ public static class Definition {\r
+ private Object variable;\r
+ private Object expression;\r
+\r
+ public Definition(Object aVariable, Object anExpression) {\r
+ variable = aVariable;\r
+ expression = anExpression;\r
+ }\r
+\r
+ public Object getVariable() {\r
+ return variable;\r
+ }\r
+\r
+ public Object getExpression() {\r
+ return expression;\r
+ }\r
+ }\r
+\r
+ public void process(TALExpressionParser aParser, Object aContext, StringBuffer aDestination, TALLogger aLogger) throws TemplateProcessingException {\r
+ Iterator i;\r
+\r
+ i = definitions.iterator();\r
+ while (i.hasNext()) {\r
+ Definition d = (Definition) i.next();\r
+ aParser.processAssignment(aContext, d.getVariable(), d.getExpression());\r
+ }\r
+\r
+ if (condition == null || aParser.evaluateBooleanExpression(aContext, condition)) {\r
+ if (repeatExpression != null) {\r
+ i = aParser.evaluateListExpression(aContext, repeatExpression);\r
+\r
+ while (i.hasNext()) {\r
+ aParser.processDirectAssignment(aContext, repeatVariable, i.next());\r
+ innerProcess(aParser, aContext, aDestination, aLogger);\r
+ }\r
+ }\r
+ else {\r
+ innerProcess(aParser, aContext, aDestination, aLogger);\r
+ }\r
+ }\r
+ };\r
+\r
+ private void innerProcess(TALExpressionParser aParser, Object aContext, StringBuffer aDestination, TALLogger aLogger)\r
+ throws TemplateProcessingException\r
+ {\r
+ boolean omitTag = false;\r
+ if (omitTagExpression != null)\r
+ omitTag = aParser.evaluateBooleanExpression(aContext, omitTagExpression);\r
+\r
+ if (!omitTag) {\r
+ Map generatedAttributes = new HashMap(fixedAttributes);\r
+\r
+ Iterator i = attributeModifiers.keySet().iterator();\r
+ while (i.hasNext()) {\r
+ Map.Entry entry = (Map.Entry) i.next();\r
+\r
+ generatedAttributes.put(entry.getKey(), aParser.evaluateStringExpression(aContext, entry.getValue()));\r
+ }\r
+\r
+ aDestination.append("<");\r
+ aDestination.append(tag);\r
+\r
+ i = generatedAttributes.entrySet().iterator();\r
+ while (i.hasNext()) {\r
+ Map.Entry entry = (Map.Entry) i.next();\r
+ aDestination.append(" ");\r
+ aDestination.append(entry.getKey());\r
+ aDestination.append("=");\r
+ aDestination.append("\"");\r
+ aDestination.append(HTMLRoutines.encodeHTML( (String) entry.getValue()));\r
+ aDestination.append("\"");\r
+ }\r
+ aDestination.append(">");\r
+ }\r
+\r
+ StringBuffer destination = aDestination;\r
+ if (errorExpression != null) {\r
+ destination = new StringBuffer();\r
+ }\r
+ try {\r
+ if (contentExpression != null) {\r
+ destination.append(aParser.evaluateStringExpression(aContext, contentExpression));\r
+ }\r
+ else {\r
+ if (body != null)\r
+ body.process(aParser, aContext, destination, aLogger);\r
+ }\r
+ }\r
+ catch (Throwable t) {\r
+ if (!(t instanceof TemplateProcessingException))\r
+ aLogger.error("TALTemplate.SmartTemplateNode.processs", "exception occurred: " + t.toString());\r
+ if (errorExpression != null) {\r
+ try {\r
+ destination.delete(0, destination.length());\r
+\r
+ aParser.processPseudoAssignment(aContext, "exception", t);\r
+ destination.append(aParser.evaluateStringExpression(aContext, errorExpression));\r
+ }\r
+ catch (Throwable s) {\r
+ }\r
+ }\r
+ else {\r
+ throw new TemplateProcessingException(t);\r
+ }\r
+ }\r
+ finally {\r
+ if (errorExpression != null) {\r
+ aDestination.append(destination);\r
+ }\r
+ }\r
+ if (!omitTag) {\r
+ aDestination.append("</");\r
+ aDestination.append(tag);\r
+ aDestination.append(">");\r
+ }\r
+ }\r
+ }\r
+\r
+ public static class TemplateProcessingException extends Exception {\r
+ private Throwable cause;\r
+\r
+ public TemplateProcessingException(Throwable aCause) {\r
+ this (aCause.getMessage(), aCause);\r
+ }\r
+\r
+ public TemplateProcessingException(String aMessage, Throwable aCause) {\r
+ super(aMessage);\r
+\r
+ cause = aCause;\r
+ }\r
+\r
+ public TemplateProcessingException(String aMessage) {\r
+ this(aMessage, null);\r
+ }\r
+ }\r
}
\ No newline at end of file
private class TemplateFactory implements CachingFileLoader.CachedFileObjectFactory {
public Object constructObject(InputStream aStream) {
try {
- return TALTemplateParser.parseInputStream(aStream, expressionParser);
+ return TALTemplateParser.parse(aStream, expressionParser);
}
catch (Throwable t) {
throw new TALFailure(t);
package mir.generator.tal;
import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringReader;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import mir.generator.tal.interfaces.TALExpressionParser;
import mir.util.HTMLRoutines;
import mir.util.StringRoutines;
-import mir.util.XMLReader;
-import mir.util.XMLReader.AbstractSectionHandler;
+import mir.util.xml.XMLParserExc;
+import mir.util.xml.XMLParserEngine;
+import mir.util.xml.XMLParserFailure;
+import mir.util.xml.SectionHandler;
+import mir.util.xml.XMLName;
public class TALTemplateParser {
- private int bal;
private static final String TAL_PREFIX = "tal";
- public static TALTemplate parseString(String aData, TALExpressionParser aParser) throws TALExc, TALFailure {
- try {
- TALHandler handler = new TALHandler(aParser);
- XMLReader reader = new XMLReader(false);
-
- reader.parseString(true, aData, handler);
-
- return new TALTemplate(aParser, handler.getNode());
- }
- catch (Throwable t) {
- throw new TALFailure(t);
- }
+ public static TALTemplate parse(String aData, TALExpressionParser aParser) throws TALExc, TALFailure {
+ return parse(new StringReader(aData), aParser);
}
- public static TALTemplate parseInputStream(InputStream anInputStream, TALExpressionParser aParser) throws TALExc, TALFailure {
- try {
- TALHandler handler = new TALHandler(aParser);
- XMLReader reader = new XMLReader(false);
+ public static TALTemplate parse(InputStream anInputStream, TALExpressionParser aParser) throws TALExc, TALFailure {
+ return parse(new InputStreamReader(anInputStream), aParser);
+ }
- reader.parseInputStream(true, anInputStream, handler);
+ public static TALTemplate parse(Reader aReader, TALExpressionParser aParser) throws TALExc, TALFailure {
+ TALHandler handler = new TALHandler(aParser);
- return new TALTemplate(aParser, handler.getNode());
+ try {
+ XMLParserEngine.getInstance().parse("html", aReader, handler);
}
- catch (Throwable t) {
- throw new TALFailure(t);
+ catch (XMLParserExc e) {
+ throw new TALFailure(e);
}
+
+ return new TALTemplate(aParser, handler.getNode());
}
- private static String normalizeXMLName(XMLReader.XMLName aName) {
+ private static String normalizeXMLName(mir.util.xml.XMLName aName) {
String result = aName.getLocalName();
if (aName.getPrefix().length() > 0)
result = aName.getPrefix() + ":" + result;
return result;
}
-
-
private static final String CONDITION_ATTRIBUTE = "condition";
private static final String REPEAT_ATTRIBUTE = "repeat";
private static final String CONTENT_ATTRIBUTE = "content";
private static final String ERROR_ATTRIBUTE = "on-error";
private static final String REPLACE_ATTRIBUTE = "replace";
private static final String DEFINITION_ATTRIBUTE = "define";
- private static final String ONERROR_ATTRIBUTE = "onerror";
private static final String OMITTAG_ATTRIBUTE = "omit-tag";
private static final String ATTRIBUTE_ATTRIBUTE = "attributes";
-
- protected static class TALHandler extends XMLReader.AbstractSectionHandler {
+ protected static class TALHandler implements SectionHandler {
private TALTemplate.CompositeTemplateNode compositeNode;
private StringBuffer data;
private TALExpressionParser parser;
}
}
- public XMLReader.SectionHandler startElement(XMLReader.XMLName aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ public void extra(String anExtraData) throws XMLParserExc, XMLParserFailure {
+ appendCode(anExtraData);
+ }
+
+ public SectionHandler startElement(mir.util.xml.XMLName aTag, Map anAttributes) throws XMLParserExc {
smartTag = false;
currentTag = normalizeXMLName(aTag);
-
smartTag = (aTag.getPrefix().equals(TAL_PREFIX));
Iterator i = anAttributes.keySet().iterator();
-
while (!smartTag && i.hasNext()) {
- String name = (String) i.next();
- smartTag = smartTag || (name.startsWith(TAL_PREFIX+":"));
+ XMLName name = (XMLName) i.next();
+ smartTag = smartTag || (name.getPrefix().equals(TAL_PREFIX));
}
if (!smartTag) {
while (i.hasNext()) {
Map.Entry entry = (Map.Entry) i.next();
- appendCode(" "+ entry.getKey());
+ appendCode(" "+ normalizeXMLName((XMLName) entry.getKey()));
appendCode("=\"");
appendText((String) entry.getValue());
appendCode("\"");
i = anAttributes.entrySet().iterator();
while (i.hasNext()) {
Map.Entry entry = (Map.Entry) i.next();
- String fullAttributeName = (String) entry.getKey();
- List attributeParts = StringRoutines.separateString(fullAttributeName, ":");
- String prefix = "";
- String name = "";
- if (attributeParts.size()==2) {
- name = (String) attributeParts.get(1);
- prefix = (String) attributeParts.get(0);
- }
- else {
- name = (String) attributeParts.get(0);
- }
+ XMLName name = (XMLName) entry.getKey();
- if (!prefix.equals(TAL_PREFIX)) {
- smartNode.addFixedAttribute(fullAttributeName, (String) entry.getValue());
+ if (!name.getPrefix().equals(TAL_PREFIX)) {
+ smartNode.addFixedAttribute(normalizeXMLName(name), (String) entry.getValue());
}
else {
- if (name.equalsIgnoreCase(DEFINITION_ATTRIBUTE)) {
+ if (name.getLocalName().equalsIgnoreCase(DEFINITION_ATTRIBUTE)) {
List definitions = StringRoutines.splitStringWithEscape((String) entry.getValue(), ';', '\\');
- Iterator j = definitions.iterator(); {
- List parts = StringRoutines.separateString((String) i.next(), " ");
+ Iterator j = definitions.iterator();
+ while (j.hasNext())
+ {
+ List parts = StringRoutines.separateString((String) j.next(), " ");
if (parts.size()==2) {
smartNode.addDefinition(parser.preparseReferenceExpression((String) parts.get(0)), parser.preparseExpression((String) parts.get(1)));
}
}
}
- else if (name.equalsIgnoreCase(CONDITION_ATTRIBUTE)) {
+ else if (name.getLocalName().equalsIgnoreCase(CONDITION_ATTRIBUTE)) {
smartNode.setCondition(parser.preparseBooleanExpression((String) entry.getValue()));
}
- else if (name.equalsIgnoreCase(CONTENT_ATTRIBUTE)) {
+ else if (name.getLocalName().equalsIgnoreCase(CONTENT_ATTRIBUTE)) {
smartNode.setContent(parser.preparseStringExpression((String) entry.getValue()));
}
- else if (name.equalsIgnoreCase(ERROR_ATTRIBUTE)) {
+ else if (name.getLocalName().equalsIgnoreCase(ERROR_ATTRIBUTE)) {
smartNode.setError(parser.preparseStringExpression((String) entry.getValue()));
}
- else if (name.equalsIgnoreCase(OMITTAG_ATTRIBUTE)) {
+ else if (name.getLocalName().equalsIgnoreCase(OMITTAG_ATTRIBUTE)) {
if (((String) entry.getValue()).trim().length()==0)
smartNode.setOmitTag(parser.preparseTRUE());
else
smartNode.setOmitTag(parser.preparseBooleanExpression((String) entry.getValue()));
}
- else if (name.equalsIgnoreCase(REPLACE_ATTRIBUTE)) {
+ else if (name.getLocalName().equalsIgnoreCase(REPLACE_ATTRIBUTE)) {
smartNode.setOmitTag(parser.preparseTRUE());
smartNode.setContent(parser.preparseStringExpression((String) entry.getValue()));
}
- else if (name.equalsIgnoreCase(REPEAT_ATTRIBUTE)) {
+ else if (name.getLocalName().equalsIgnoreCase(REPEAT_ATTRIBUTE)) {
List parts = StringRoutines.separateString((String) entry.getValue(), " ");
if (parts.size()==2) {
smartNode.setRepeat(parser.preparseReferenceExpression((String) parts.get(0)), parser.preparseExpression((String) parts.get(1)));
}
}
- else if (name.equalsIgnoreCase(ATTRIBUTE_ATTRIBUTE)) {
+ else if (name.getLocalName().equalsIgnoreCase(ATTRIBUTE_ATTRIBUTE)) {
List attributes = StringRoutines.splitStringWithEscape((String) entry.getValue(), ';', '\\');
- Iterator j = attributes.iterator(); {
- List parts = StringRoutines.separateString((String) i.next(), " ");
+ Iterator j = attributes.iterator();
+ while (j.hasNext()) {
+ String value = (String) j.next();
+ List parts = StringRoutines.separateString(value, " ");
if (parts.size()==2) {
smartNode.addModifiedAttribute((String) parts.get(0), parser.preparseExpression((String) parts.get(1)));
}
+ else {
+ throw new XMLParserExc(ATTRIBUTE_ATTRIBUTE + " tag should have exactly 2 parts ("+value+")");
+ }
}
}
}
return new TALHandler(parser);
};
- public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+ public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
if (!smartTag) {
appendSubNode(((TALHandler) aHandler).getNode());
appendCode("</"+currentTag+">");
data.append(HTMLRoutines.encodeHTML(aText));
}
- public void finishSection() throws XMLReader.XMLReaderExc {
+ public void finishSection() throws XMLParserExc {
flushData();
}
return compositeNode;
}
- public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+ public void characters(String aCharacters) throws XMLParserExc {
appendText(aCharacters);
}
+
+ public void startSection() throws XMLParserExc, XMLParserFailure {
+ }
}
}
* exception to your version of the file, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your version.
*/
+
package mir.generator.tal;
-import java.io.PrintWriter;
+import java.io.*;
import java.util.HashMap;
-import java.util.Map;
+import java.util.*;
+import mir.generator.tal.interfaces.*;
+import mir.util.xml.html.*;
public class TALTest {
public static void main(String args[]) {
try {
- int b=4;
- int c=6;
- int a = b = c;
-
TALTemplateParser parser = new TALTemplateParser();
MirExpressionParser expressionParser = new MirExpressionParser();
Map test = new HashMap();
test.put("name", "zapata");
- TALTemplate template = parser.parseString("<td tal:on-error='exception.message'><tal:test tal:content='name.bla'></tal:test><h1 tal:content=\"name\">test</h1></TD>", expressionParser);
+ HTMLParser parser2 = new HTMLParser();
+/*
+ parser2.parse(new StringReader("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"> <div><b><a href=bla>blaat</div>"),
+ new HTMLParser.ParserReceiver() {
+
+ public void dtd(String aDTD) {
+ System.out.println(aDTD);
+ }
+
+ public void openTag(String aTag, Map anAttributes) {
+
+ System.out.print("<"+aTag);
+ Iterator i = anAttributes.entrySet().iterator();
+ while (i.hasNext()) {
+ Map.Entry entry = (Map.Entry) i.next();
+
+ System.out.print(" " + entry.getKey() + "=\"" + entry.getValue()+"\"");
+ }
+ System.out.print(">");
+ }
+
+ public void closeTag(String aTag) {
+ System.out.print("</"+aTag+">");
+ }
+
+ public void comment(String aData) {
+ }
+
+ public void cdata(String aData) {
+ System.out.print(aData);
+ }
+ }
+ );
+*/
+String doc =
+" <!DOCTYPE some doc type>" +
+" <head tal:on-error=\"exception.message\">"+
+" <title tal:content=\"lang('posting.htmltitle')\"/>"+
+" <meta name=\"description\" tal:attributes=\"content lang('posting.meta.description')\">"+
+" <meta name=\"author\" content=\"${lang(\"posting.meta.author\")}\">"+
+" <meta name=\"keywords\" content=\"${lang(\"posting.meta.keywords\")}\">"+
+" <meta http-equiv=\"Content-Type\" content=\"text/html; charset=${config['Mir.DefaultHTMLCharset']}\">"+
+" <meta name=\"robots\" content=\"index\">"+
+" <meta name=\"robots\" content=\"follow\">"+
+" <link rel=stylesheet type=\"text/css\" href=\"${config['Producer.ProductionHost']}/style/formate.css\">"+
+" </head>"+
+" <body bgcolor=\"white\" text=\"black\" link=\"#006600\" vlink=\"#006600\" alink=\"Red\" tal:on-error='exception.message'>"+
+" </body>"+
+"</html>";
+ System.out.println(doc);
+ TALTemplate template = parser.parse(doc, expressionParser);
+
+
+// <td tal:on-error='exception.message'><tal:test tal:content='name.bla'></tal:test><h1 tal:content=\"name\">test</h1></TD>", expressionParser);
PrintWriter o = new PrintWriter(System.out);
- template.processTemplate(test, o);
+ template.processTemplate(test, o, new TALLogger.TALSystemOutLogger());
o.close();
+
}
catch (Throwable t) {
System.out.println("Exception: " + t.toString());
t.printStackTrace(System.out);
}
-
}
}
\ No newline at end of file
* exception to your version of the file, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your version.
*/
+
package mir.generator.tal.interfaces;
import java.util.Iterator;
--- /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 any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, but you are not obligated to do so.
+ * If you do not wish to do so, delete this exception statement from your version.
+ */
+
+package mir.generator.tal.interfaces;
+
+public interface TALLogger {
+ public void debug(String anObject, String aMessage);
+ public void info(String anObject, String aMessage);
+ public void warning(String anObject, String aMessage);
+ public void error(String anObject, String aMessage);
+ public void fatal(String anObject, String aMessage);
+
+ /**
+ * Simple logging class that logs everything to System.out
+ */
+ public class TALSystemOutLogger implements TALLogger {
+ public TALSystemOutLogger() {
+ }
+
+ public void debug(String anObject, String aMessage) {
+ System.out.println("DEBUG: " + anObject + " " + aMessage);
+
+ }
+
+ public void info(String anObject, String aMessage) {
+ System.out.println("INFO: " + anObject + " " + aMessage);
+ }
+
+ public void warning(String anObject, String aMessage) {
+ System.out.println("WARNING: " + anObject + " " + aMessage);
+ }
+
+ public void error(String anObject, String aMessage) {
+ System.out.println("ERROR: " + anObject + " " + aMessage);
+ }
+
+ public void fatal(String anObject, String aMessage) {
+ System.out.println("FATAL: " + anObject + " " + aMessage);
+ }
+ }
+
+ /**
+ * Simple logging class that discards all logging information.
+ */
+ public class TALVoidLogger implements TALLogger {
+ public void debug(String anObject, String aMessage) {
+ }
+
+ public void info(String anObject, String aMessage) {
+ }
+
+ public void warning(String anObject, String aMessage) {
+ }
+
+ public void error(String anObject, String aMessage) {
+ }
+
+ public void fatal(String anObject, String aMessage) {
+ }
+ }
+}
\ No newline at end of file
-/*
- * Copyright (C) 2001, 2002 The Mir-coders group
- *
- * This file is part of Mir.
- *
- * Mir is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Mir is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Mir; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with any library licensed under the Apache Software License,
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
- * (or with modified versions of the above that use the same license as the above),
- * and distribute linked combinations including the two. You must obey the
- * GNU General Public License in all respects for all of the code used other than
- * the above mentioned libraries. If you modify this file, you may extend this
- * exception to your version of the file, but you are not obligated to do so.
- * If you do not wish to do so, delete this exception statement from your version.
- */
-package mir.producer;
-
-import java.util.Map;
-
-import mir.log.LoggerWrapper;
-import mir.util.ParameterExpander;
-
-public class ScriptCallingProducerNode implements ProducerNode {
- String scriptExpression;
-
- public ScriptCallingProducerNode(String aScriptExpression) {
- scriptExpression = aScriptExpression;
- }
-
- public void produce(Map aValueMap, String aVerb, LoggerWrapper aLogger) throws ProducerFailure {
- String script;
- Process process;
- int returnValue;
-
- try {
- script = ParameterExpander.expandExpression( aValueMap, scriptExpression );
- process = Runtime.getRuntime().exec(script);
- returnValue = process.waitFor();
- aLogger.info(script + " terminated successfully, return value = " + returnValue + ".");
- }
- catch (Throwable e) {
- aLogger.error(scriptExpression + " failed to execute: " + e.getMessage());
- }
- }
-}
+/*\r
+ * Copyright (C) 2001, 2002 The Mir-coders group\r
+ *\r
+ * This file is part of Mir.\r
+ *\r
+ * Mir is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Mir is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with Mir; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+ *\r
+ * In addition, as a special exception, The Mir-coders gives permission to link\r
+ * the code of this program with any library licensed under the Apache Software License,\r
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library\r
+ * (or with modified versions of the above that use the same license as the above),\r
+ * and distribute linked combinations including the two. You must obey the\r
+ * GNU General Public License in all respects for all of the code used other than\r
+ * the above mentioned libraries. If you modify this file, you may extend this\r
+ * exception to your version of the file, but you are not obligated to do so.\r
+ * If you do not wish to do so, delete this exception statement from your version.\r
+ */\r
+package mir.producer;\r
+\r
+import java.util.Map;\r
+\r
+import mir.log.LoggerWrapper;\r
+import mir.util.ParameterExpander;\r
+\r
+public class ScriptCallingProducerNode implements ProducerNode {\r
+ private String scriptExpression;\r
+ private String maxDurationExpression;\r
+\r
+ public ScriptCallingProducerNode(String aScriptExpression, String aMaxDurationExpression) {\r
+ scriptExpression = aScriptExpression;\r
+ maxDurationExpression = aMaxDurationExpression;\r
+ }\r
+\r
+ public void produce(Map aValueMap, String aVerb, LoggerWrapper aLogger) throws ProducerFailure {\r
+ String script;\r
+ long maxDuration;\r
+ Process process;\r
+ int returnValue;\r
+\r
+ try {\r
+ script = ParameterExpander.expandExpression(aValueMap, scriptExpression);\r
+ maxDuration = ParameterExpander.evaluateIntegerExpressionWithDefault(aValueMap, maxDurationExpression, 0);\r
+\r
+ ProcessRunner runner = new ProcessRunner(Runtime.getRuntime().exec(script));\r
+ runner.start();\r
+ synchronized (runner) {\r
+ runner.wait(maxDuration);\r
+ }\r
+ runner.interrupt();\r
+\r
+ if (runner.getFinished()) {\r
+ aLogger.info(script + " terminated successfully, return value = " + runner.getReturnValue() + ".");\r
+ }\r
+ else {\r
+ aLogger.info(script + " interrupted prematurely after " + maxDuration + "ms.");\r
+ }\r
+ }\r
+ catch (Throwable e) {\r
+ aLogger.error(scriptExpression + " failed to execute: " + e.getMessage());\r
+ }\r
+ }\r
+\r
+ private static class ProcessRunner extends Thread {\r
+ private Process process;\r
+ private boolean finished = false;\r
+ private int returnValue = 0;\r
+\r
+ public ProcessRunner(Process aProcess) {\r
+ process = aProcess;\r
+ }\r
+\r
+ public boolean getFinished() {\r
+ return finished;\r
+ }\r
+\r
+ public int getReturnValue() {\r
+ return returnValue;\r
+ }\r
+\r
+ public void run() {\r
+ try {\r
+ returnValue = process.waitFor();\r
+ finished = true;\r
+ synchronized (this) {\r
+ this.notify();\r
+ }\r
+ }\r
+ catch (InterruptedException e) {\r
+ process.destroy();\r
+ }\r
+ }\r
+ }\r
+\r
+}\r
import mir.producer.ResourceBundleProducerNode;
import mir.producer.ScriptCallingProducerNode;
import mir.util.StringRoutines;
-import mir.util.XMLReader;
-import mir.util.XMLReaderTool;
+import mir.util.xml.*;
+import mir.util.xml.XMLReaderTool;
public class DefaultProducerNodeBuilders {
}
public static abstract class AbstractProducerNodeBuilder implements ProducerNodeBuilder {
- private Map attributes;
private Map subNodes;
private Set availableSubnodes;
public AbstractProducerNodeBuilder(String anAvailableSubNodes[]) {
- attributes = new HashMap();
subNodes = new HashMap();
availableSubnodes = new HashSet(Arrays.asList(anAvailableSubNodes));
}
super(ASSIGNMENT_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributes(anAttributes, ASSIGNMENT_REQUIRED_ATTRIBUTES, ASSIGNMENT_OPTIONAL_ATTRIBUTES);
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, ASSIGNMENT_REQUIRED_ATTRIBUTES, ASSIGNMENT_OPTIONAL_ATTRIBUTES);
key = (String) anAttributes.get(ASSIGNMENT_KEY_ATTRIBUTE);
value = (String) anAttributes.get(ASSIGNMENT_VALUE_ATTRIBUTE);
super(ASSIGNMENT_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributes(anAttributes, ASSIGNMENT_REQUIRED_ATTRIBUTES, ASSIGNMENT_OPTIONAL_ATTRIBUTES);
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, ASSIGNMENT_REQUIRED_ATTRIBUTES, ASSIGNMENT_OPTIONAL_ATTRIBUTES);
key = (String) anAttributes.get(ASSIGNMENT_KEY_ATTRIBUTE);
value = (String) anAttributes.get(ASSIGNMENT_VALUE_ATTRIBUTE);
model = aModel;
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
definition = (String) anAttributes.get(ENUMERATION_DEFINITION_ATTRIBUTE);
list = (String) anAttributes.get(ENUMERATION_LIST_ATTRIBUTE);
if (list!=null)
- XMLReaderTool.checkAttributes(anAttributes, ENUMERATION_LIST_REQUIRED_ATTRIBUTES, ENUMERATION_LIST_OPTIONAL_ATTRIBUTES);
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, ENUMERATION_LIST_REQUIRED_ATTRIBUTES, ENUMERATION_LIST_OPTIONAL_ATTRIBUTES);
if (definition!=null)
- XMLReaderTool.checkAttributes(anAttributes, ENUMERATION_QUERY_REQUIRED_ATTRIBUTES, ENUMERATION_QUERY_OPTIONAL_ATTRIBUTES);
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, ENUMERATION_QUERY_REQUIRED_ATTRIBUTES, ENUMERATION_QUERY_OPTIONAL_ATTRIBUTES);
key = (String) anAttributes.get(ENUMERATION_KEY_ATTRIBUTE);
- selection = (String) XMLReaderTool.getStringAttributeWithDefault(anAttributes, ENUMERATION_SELECTION_ATTRIBUTE, "");
- order = (String) XMLReaderTool.getStringAttributeWithDefault(anAttributes, ENUMERATION_ORDER_ATTRIBUTE, "");
+ selection = mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, ENUMERATION_SELECTION_ATTRIBUTE, "");
+ order = mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, ENUMERATION_ORDER_ATTRIBUTE, "");
limit = (String) anAttributes.get(ENUMERATION_LIMIT_ATTRIBUTE);
skip = (String) anAttributes.get(ENUMERATION_SKIP_ATTRIBUTE);
- extraTables = StringRoutines.splitString(XMLReaderTool.getStringAttributeWithDefault(anAttributes, ENUMERATION_EXTRATABLES_ATTRIBUTE,"").trim(), ",");
+ extraTables = StringRoutines.splitString(mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, ENUMERATION_EXTRATABLES_ATTRIBUTE,"").trim(), ",");
if (definition!=null) {
List parts = StringRoutines.splitString(definition.trim(), " ");
if (parts.size() > 0)
fieldValues = new HashMap();
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
key = (String) anAttributes.get(UPDATE_KEY_ATTRIBUTE);
if (key == null)
- throw new XMLReader.XMLReaderExc("missing required attribute '" + UPDATE_KEY_ATTRIBUTE + "'" );
+ throw new XMLParserExc("missing required attribute '" + UPDATE_KEY_ATTRIBUTE + "'" );
definition = (String) anAttributes.get(UPDATE_DEFINITION_ATTRIBUTE);
fieldValues.putAll(anAttributes);
fieldValues = new HashMap();
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
key = (String) anAttributes.get(CREATEENTITY_KEY_ATTRIBUTE);
definition = (String) anAttributes.get(CREATEENTITY_DEFINITION_ATTRIBUTE);
if (key == null)
- throw new XMLReader.XMLReaderExc("missing required attribute '" + CREATEENTITY_KEY_ATTRIBUTE + "'" );
+ throw new XMLParserExc("missing required attribute '" + CREATEENTITY_KEY_ATTRIBUTE + "'" );
if (definition == null)
- throw new XMLReader.XMLReaderExc("missing required attribute '" + CREATEENTITY_DEFINITION_ATTRIBUTE + "'" );
+ throw new XMLParserExc("missing required attribute '" + CREATEENTITY_DEFINITION_ATTRIBUTE + "'" );
fieldValues.putAll(anAttributes);
fieldValues.remove(CREATEENTITY_KEY_ATTRIBUTE);
super(LOOP_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributes(anAttributes, LOOP_REQUIRED_ATTRIBUTES, LOOP_OPTIONAL_ATTRIBUTES);
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, LOOP_REQUIRED_ATTRIBUTES, LOOP_OPTIONAL_ATTRIBUTES);
condition = (String) anAttributes.get(LOOP_CONDITION_ATTRIBUTE);
- limit = (String) XMLReaderTool.getStringAttributeWithDefault(anAttributes, LOOP_LIMIT_ATTRIBUTE, "");
+ limit = mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, LOOP_LIMIT_ATTRIBUTE, "");
};
public ProducerNode constructNode() {
private final static String LIST_SELECTION_ATTRIBUTE = SELECTION_ATTRIBUTE;
private final static String LIST_EXTRATABLES_ATTRIBUTE = "extratables";
private final static String LIST_ORDER_ATTRIBUTE = ORDER_ATTRIBUTE;
- private final static String LIST_DEFAULT_SUBNODE = "default";
private final static String LIST_LIMIT_ATTRIBUTE = LIMIT_ATTRIBUTE;
private final static String LIST_SKIP_ATTRIBUTE = SKIP_ATTRIBUTE;
private final static String[] LIST_REQUIRED_ATTRIBUTES = { LIST_KEY_ATTRIBUTE, LIST_DEFINITION_ATTRIBUTE };
model = aModel;
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributes(anAttributes, LIST_REQUIRED_ATTRIBUTES, LIST_OPTIONAL_ATTRIBUTES);
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, LIST_REQUIRED_ATTRIBUTES, LIST_OPTIONAL_ATTRIBUTES);
key = (String) anAttributes.get(LIST_KEY_ATTRIBUTE);
definition = (String) anAttributes.get(LIST_DEFINITION_ATTRIBUTE);
- selection = (String) XMLReaderTool.getStringAttributeWithDefault(anAttributes, LIST_SELECTION_ATTRIBUTE, "");
- order = (String) XMLReaderTool.getStringAttributeWithDefault(anAttributes, LIST_ORDER_ATTRIBUTE, "");
+ selection = mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, LIST_SELECTION_ATTRIBUTE, "");
+ order = mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, LIST_ORDER_ATTRIBUTE, "");
limit = (String) anAttributes.get(LIST_LIMIT_ATTRIBUTE);
skip = (String) anAttributes.get(LIST_SKIP_ATTRIBUTE);
- extraTables = StringRoutines.splitString(XMLReaderTool.getStringAttributeWithDefault(anAttributes, LIST_EXTRATABLES_ATTRIBUTE,"").trim(), ",");
+ extraTables = StringRoutines.splitString(mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, LIST_EXTRATABLES_ATTRIBUTE,"").trim(), ",");
List parts = StringRoutines.splitString(definition.trim()," ");
if (parts.size()>0) definition=(String)parts.get(0);
if (parts.size()>1) mainTablePrefix=(String)parts.get(1);
model = aModel;
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributes(anAttributes, DELETEENTITY_REQUIRED_ATTRIBUTES, DELETEENTITY_OPTIONAL_ATTRIBUTES);
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, DELETEENTITY_REQUIRED_ATTRIBUTES, DELETEENTITY_OPTIONAL_ATTRIBUTES);
definition = (String) anAttributes.get(DELETEENTITY_DEFINITION_ATTRIBUTE);
- selection = (String) XMLReaderTool.getStringAttributeWithDefault(anAttributes, DELETEENTITY_SELECTION_ATTRIBUTE, "");
+ selection = mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, DELETEENTITY_SELECTION_ATTRIBUTE, "");
};
public ProducerNode constructNode() {
super(LOG_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
String typeString;
- XMLReaderTool.checkAttributes(anAttributes, LOG_REQUIRED_ATTRIBUTES, LOG_OPTIONAL_ATTRIBUTES);
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, LOG_REQUIRED_ATTRIBUTES, LOG_OPTIONAL_ATTRIBUTES);
message = (String) anAttributes.get(LOG_MESSAGE_ATTRIBUTE);
if (anAttributes.containsKey(LOG_TYPE_ATTRIBUTE)) {
super(FREEQUERY_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
String typeString;
- XMLReaderTool.checkAttributes(anAttributes, FREEQUERY_REQUIRED_ATTRIBUTES, FREEQUERY_OPTIONAL_ATTRIBUTES);
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, FREEQUERY_REQUIRED_ATTRIBUTES, FREEQUERY_OPTIONAL_ATTRIBUTES);
key = (String) anAttributes.get(FREEQUERY_KEY_ATTRIBUTE);
query = (String) anAttributes.get(FREEQUERY_QUERY_ATTRIBUTE);
private final static String RESOURCEBUNDLE_KEY_ATTRIBUTE = KEY_ATTRIBUTE;
private final static String RESOURCEBUNDLE_BUNDLE_ATTRIBUTE = "bundle";
private final static String RESOURCEBUNDLE_LANGUAGE_ATTRIBUTE = "language";
- private final static String RESOURCEBUNDLE_DEFAULT_SUBNODE = "default";
private final static String[] RESOURCEBUNDLE_REQUIRED_ATTRIBUTES = { RESOURCEBUNDLE_KEY_ATTRIBUTE, RESOURCEBUNDLE_BUNDLE_ATTRIBUTE };
private final static String[] RESOURCEBUNDLE_OPTIONAL_ATTRIBUTES = { RESOURCEBUNDLE_LANGUAGE_ATTRIBUTE};
private final static String[] RESOURCEBUNDLE_SUBNODES = {};
super(RESOURCEBUNDLE_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributes(anAttributes, RESOURCEBUNDLE_REQUIRED_ATTRIBUTES, RESOURCEBUNDLE_OPTIONAL_ATTRIBUTES);
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, RESOURCEBUNDLE_REQUIRED_ATTRIBUTES, RESOURCEBUNDLE_OPTIONAL_ATTRIBUTES);
key = (String) anAttributes.get(RESOURCEBUNDLE_KEY_ATTRIBUTE);
bundle = (String) anAttributes.get(RESOURCEBUNDLE_BUNDLE_ATTRIBUTE);
super(FILEDATESETTING_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributes(anAttributes, FILEDATESETTING_REQUIRED_ATTRIBUTES, FILEDATESETTING_OPTIONAL_ATTRIBUTES);
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, FILEDATESETTING_REQUIRED_ATTRIBUTES, FILEDATESETTING_OPTIONAL_ATTRIBUTES);
fileNameKey = (String) anAttributes.get(FILEDATESETTING_FILE_ATTRIBUTE);
dateKey = (String) anAttributes.get(FILEDATESETTING_DATE_ATTRIBUTE);
super(FILEDELETING_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributes(anAttributes, FILEDELETING_REQUIRED_ATTRIBUTES, FILEDELETING_OPTIONAL_ATTRIBUTES);
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, FILEDELETING_REQUIRED_ATTRIBUTES, FILEDELETING_OPTIONAL_ATTRIBUTES);
fileNameKey = (String) anAttributes.get(FILEDELETING_FILE_ATTRIBUTE);
};
public static class ScriptCallingProducerNodeBuilder extends AbstractProducerNodeBuilder {
private final static String SCRIPT_COMMAND_ATTRIBUTE = "command";
+ private final static String SCRIPT_TIME_ATTRIBUTE = "time";
private final static String[] SCRIPT_REQUIRED_ATTRIBUTES = { SCRIPT_COMMAND_ATTRIBUTE };
private final static String[] SCRIPT_OPTIONAL_ATTRIBUTES = {};
private final static String[] SCRIPT_SUBNODES = {};
private String command;
+ private String time;
public ScriptCallingProducerNodeBuilder() {
super(SCRIPT_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributes(anAttributes, SCRIPT_REQUIRED_ATTRIBUTES, SCRIPT_OPTIONAL_ATTRIBUTES);
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, SCRIPT_REQUIRED_ATTRIBUTES, SCRIPT_OPTIONAL_ATTRIBUTES);
command = (String) anAttributes.get(SCRIPT_COMMAND_ATTRIBUTE);
+ time = mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, SCRIPT_TIME_ATTRIBUTE, "0");
};
public ProducerNode constructNode() {
- return new ScriptCallingProducerNode(command);
+ return new
+ ScriptCallingProducerNode(command, time);
};
}
destinationBasePath = aDestinationBasePath;
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributes(anAttributes, DIRCOPY_REQUIRED_ATTRIBUTES, DIRCOPY_OPTIONAL_ATTRIBUTES);
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, DIRCOPY_REQUIRED_ATTRIBUTES, DIRCOPY_OPTIONAL_ATTRIBUTES);
source = (String) anAttributes.get(DIRCOPY_SOURCE_ATTRIBUTE);
destination = (String) anAttributes.get(DIRCOPY_DESTINATION_ATTRIBUTE);
generatorLibrary = aGeneratorLibrary;
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributes(anAttributes, GENERATION_REQUIRED_ATTRIBUTES, GENERATION_OPTIONAL_ATTRIBUTES);
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, GENERATION_REQUIRED_ATTRIBUTES, GENERATION_OPTIONAL_ATTRIBUTES);
generator = (String) anAttributes.get(GENERATION_GENERATOR_ATTRIBUTE);
destination = (String) anAttributes.get(GENERATION_DESTINATION_ATTRIBUTE);
- parameters = XMLReaderTool.getStringAttributeWithDefault(anAttributes, GENERATION_PARAMETERS_ATTRIBUTE, "" );
+ parameters = mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, GENERATION_PARAMETERS_ATTRIBUTE, "" );
};
public ProducerNode constructNode() {
model = aModel;
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributes(anAttributes, BATCHER_REQUIRED_ATTRIBUTES, BATCHER_OPTIONAL_ATTRIBUTES);
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, BATCHER_REQUIRED_ATTRIBUTES, BATCHER_OPTIONAL_ATTRIBUTES);
- batchDataKey = XMLReaderTool.getStringAttributeWithDefault(anAttributes, BATCHER_DATAKEY_ATTRIBUTE, "data" );
- batchInfoKey = XMLReaderTool.getStringAttributeWithDefault(anAttributes, BATCHER_INFOKEY_ATTRIBUTE, "info" );
- definition = XMLReaderTool.getStringAttributeWithDefault(anAttributes, BATCHER_DEFINITION_ATTRIBUTE, "" );
- selection = XMLReaderTool.getStringAttributeWithDefault(anAttributes, BATCHER_SELECTION_ATTRIBUTE, "" );
- order = XMLReaderTool.getStringAttributeWithDefault(anAttributes, BATCHER_ORDER_ATTRIBUTE, "" );
+ batchDataKey = mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, BATCHER_DATAKEY_ATTRIBUTE, "data" );
+ batchInfoKey = mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, BATCHER_INFOKEY_ATTRIBUTE, "info" );
+ definition = mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, BATCHER_DEFINITION_ATTRIBUTE, "" );
+ selection = mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, BATCHER_SELECTION_ATTRIBUTE, "" );
+ order = mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, BATCHER_ORDER_ATTRIBUTE, "" );
- batchSize = XMLReaderTool.getStringAttributeWithDefault(anAttributes, BATCHER_BATCHSIZE_ATTRIBUTE, "20" );
- minBatchSize = XMLReaderTool.getStringAttributeWithDefault(anAttributes, BATCHER_MINBATCHSIZE_ATTRIBUTE, "0" );
- skip = XMLReaderTool.getStringAttributeWithDefault(anAttributes, BATCHER_SKIP_ATTRIBUTE, "0" );
- process = XMLReaderTool.getStringAttributeWithDefault(anAttributes, BATCHER_PROCESS_ATTRIBUTE, "-1" );
- extraTables = StringRoutines.splitString(XMLReaderTool.getStringAttributeWithDefault(anAttributes, BATCHER_EXTRATABLES_ATTRIBUTE,"").trim(), ",");
+ batchSize = mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, BATCHER_BATCHSIZE_ATTRIBUTE, "20" );
+ minBatchSize = mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, BATCHER_MINBATCHSIZE_ATTRIBUTE, "0" );
+ skip = mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, BATCHER_SKIP_ATTRIBUTE, "0" );
+ process = mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, BATCHER_PROCESS_ATTRIBUTE, "-1" );
+ extraTables = StringRoutines.splitString(mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, BATCHER_EXTRATABLES_ATTRIBUTE,"").trim(), ",");
List parts = StringRoutines.splitString(definition.trim()," ");
if (parts.size()>0) definition=(String)parts.get(0);
if (parts.size()>1) mainTablePrefix=(String)parts.get(1);
super(IF_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributes(anAttributes, IF_REQUIRED_ATTRIBUTES, IF_OPTIONAL_ATTRIBUTES);
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, IF_REQUIRED_ATTRIBUTES, IF_OPTIONAL_ATTRIBUTES);
condition = (String) anAttributes.get( IF_CONDITION_ATTRIBUTE );
};
super(RSS_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributes(anAttributes, RSS_REQUIRED_ATTRIBUTES, RSS_OPTIONAL_ATTRIBUTES);
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, RSS_REQUIRED_ATTRIBUTES, RSS_OPTIONAL_ATTRIBUTES);
key = (String) anAttributes.get( RSS_KEY_ATTRIBUTE );
url = (String) anAttributes.get( RSS_URL_ATTRIBUTE );
- version = XMLReaderTool.getStringAttributeWithDefault(anAttributes, RSS_VERSION_ATTRIBUTE, "1.0");
+ version = mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, RSS_VERSION_ATTRIBUTE, "1.0");
};
public ProducerNode constructNode() {
super(RDF_AGGREGATOR_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributes(anAttributes, RDF_AGGREGATOR_REQUIRED_ATTRIBUTES, RDF_AGGREGATOR_OPTIONAL_ATTRIBUTES);
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, RDF_AGGREGATOR_REQUIRED_ATTRIBUTES, RDF_AGGREGATOR_OPTIONAL_ATTRIBUTES);
key = (String) anAttributes.get( RDF_AGGREGATOR_KEY_ATTRIBUTE );
source = (String) anAttributes.get( RDF_AGGREGATOR_SOURCE_ATTRIBUTE );
- order = XMLReaderTool.getStringAttributeWithDefault(anAttributes, RDF_AGGREGATOR_SOURCE_ATTRIBUTE, "");
- filter = XMLReaderTool.getStringAttributeWithDefault(anAttributes, RDF_AGGREGATOR_FILTER_ATTRIBUTE, "");
+ order = mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, RDF_AGGREGATOR_SOURCE_ATTRIBUTE, "");
+ filter = mir.util.xml.XMLReaderTool.getStringAttributeWithDefault(anAttributes, RDF_AGGREGATOR_FILTER_ATTRIBUTE, "");
};
public ProducerNode constructNode() {
return definition.getNodeParameters();
};
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributeSet(anAttributes.keySet(), definition.getRequiredAttributes(), definition.getOptionalAttributes());
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributeSet(anAttributes.keySet(), definition.getRequiredAttributes(), definition.getOptionalAttributes());
Iterator i = anAttributes.entrySet().iterator();
while (i.hasNext()) {
*/
package mir.producer.reader;
-import java.io.File;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.Vector;
+import java.io.File;
import mir.producer.CompositeProducerNode;
import mir.producer.ProducerFactory;
import mir.producer.ProducerNode;
import mir.producer.SimpleProducerVerb;
import mir.util.ExceptionFunctions;
-import mir.util.XMLReader;
-import mir.util.XMLReaderTool;
+import mir.util.xml.XMLParserEngine;
+import mir.util.xml.XMLParserExc;
+import mir.util.xml.XMLParserFailure;
public class ProducerConfigReader {
private ProducerNodeBuilderLibrary builderLibrary;
super();
};
- public void parseFile(String aFileName, ProducerNodeBuilderLibrary aBuilderLibrary, List aProducerFactories) throws ProducerConfigFailure {
- parseFile(aFileName, aBuilderLibrary, aProducerFactories, new Vector());
- }
-
- public void parseFile(String aFileName, ProducerNodeBuilderLibrary aBuilderLibrary, List aProducerFactories, List aUsedFiles) throws ProducerConfigFailure {
+ public void parse(File aFile, ProducerNodeBuilderLibrary aBuilderLibrary, List aProducerFactories) throws ProducerConfigFailure {
try {
- XMLReader reader = new XMLReader();
- aUsedFiles.add(new File(aFileName));
-
builderLibrary = aBuilderLibrary;
scriptedNodeBuilderLibrary = new ProducerNodeBuilderLibrary();
- reader.parseFile(aFileName, new RootSectionHandler(aProducerFactories));
+ XMLParserEngine.getInstance().parse("", aFile, new RootSectionHandler(aProducerFactories));
}
catch (Throwable e) {
Throwable root = ExceptionFunctions.traceCauseException(e);
- if ((root instanceof XMLReader.XMLReaderExc) && ((XMLReader.XMLReaderExc) root).getHasLocation()) {
- XMLReader.XMLReaderExc f = (XMLReader.XMLReaderExc) root;
- throw new ProducerConfigFailure("'" + f.getMessage()+"' in " + f.getFilename()+"(line " + f.getLineNr()+", column " + f.getColumnNr() + ")", e);
+ if ((root instanceof XMLParserExc) && ((XMLParserExc) root).getHasLocation()) {
+ XMLParserExc f = (XMLParserExc) root;
+ throw new ProducerConfigFailure(f.getMessage()+" on line " + f.getLineNr()+", column " + f.getColumnNr(), e);
}
throw new ProducerConfigFailure(root);
}
}
-
- public class RootSectionHandler extends XMLReader.AbstractSectionHandler {
+ public class RootSectionHandler extends mir.util.xml.AbstractSectionHandler {
private List producers;
public RootSectionHandler(List aProducers) {
producers = aProducers;
}
- public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
if (aTag.equals("producers")) {
return new ProducersSectionHandler(producers);
}
else
- throw new XMLReader.XMLReaderExc("Tag 'producers' expected, tag '"+aTag+"' found");
+ throw new XMLParserExc("Tag 'producers' expected, tag '"+aTag+"' found");
}
- public void endElement(XMLReader.SectionHandler aHandler) {
+ public void endElement(mir.util.xml.SectionHandler aHandler) {
}
public void finishSection() {
}
}
-
private final static String PRODUCER_NAME_ATTRIBUTE = "name";
private final static String[] PRODUCER_REQUIRED_ATTRIBUTES = { PRODUCER_NAME_ATTRIBUTE };
private final static String[] PRODUCER_OPTIONAL_ATTRIBUTES = { };
private final static String[] NODE_DEFINITION_REQUIRED_ATTRIBUTES = { NODE_DEFINITION_NAME_ATTRIBUTE };
private final static String[] NODE_DEFINITION_OPTIONAL_ATTRIBUTES = { };
- public class ProducersSectionHandler extends XMLReader.AbstractSectionHandler {
+ public class ProducersSectionHandler extends mir.util.xml.AbstractSectionHandler {
private List producers;
private Set producerNames;
private String name;
producerNames = new HashSet();
}
- public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
if (aTag.equals("producer")) {
- XMLReaderTool.checkAttributes(anAttributes,
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes,
PRODUCER_REQUIRED_ATTRIBUTES,
PRODUCER_OPTIONAL_ATTRIBUTES);
name = (String) anAttributes.get(PRODUCER_NAME_ATTRIBUTE);
- XMLReaderTool.checkValidIdentifier(name);
+ mir.util.xml.XMLReaderTool.checkValidIdentifier(name);
if (producerNames.contains(name))
- throw new XMLReader.XMLReaderExc("Duplicate producer name: '" +
+ throw new XMLParserExc("Duplicate producer name: '" +
name + "'");
name = (String) anAttributes.get(PRODUCER_NAME_ATTRIBUTE);
return new ProducerSectionHandler(name);
}
else if (aTag.equals("nodedefinition")) {
- XMLReaderTool.checkAttributes(anAttributes,
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes,
NODE_DEFINITION_REQUIRED_ATTRIBUTES,
NODE_DEFINITION_OPTIONAL_ATTRIBUTES);
name = (String) anAttributes.get(NODE_DEFINITION_NAME_ATTRIBUTE);
- XMLReaderTool.checkValidIdentifier(name);
+ mir.util.xml.XMLReaderTool.checkValidIdentifier(name);
name = (String) anAttributes.get(NODE_DEFINITION_NAME_ATTRIBUTE);
return new NodeDefinitionSectionHandler(name);
}
- throw new XMLReader.XMLReaderExc("Unexpected tag: " + aTag);
+ throw new XMLParserExc("Unexpected tag: " + aTag);
}
- public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+ public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
if (aHandler instanceof ProducerSectionHandler) {
producers.add(((ProducerSectionHandler) aHandler).getProducerFactory());
producerNames.add(((ProducerSectionHandler) aHandler).getProducerFactory().getName());
new DefaultProducerNodeBuilders.ScriptedProducerNodeBuilder.factory(
((NodeDefinitionSectionHandler) aHandler).getDefinition()));
}
- else throw new XMLReader.XMLReaderExc("ProducersSectionHandler.endElement Internal error: Unexpected handler: " + aHandler.getClass().getName());
+ else throw new XMLParserExc("ProducersSectionHandler.endElement Internal error: Unexpected handler: " + aHandler.getClass().getName());
}
public void finishSection() {
}
}
- public class ProducerSectionHandler extends XMLReader.AbstractSectionHandler {
+ public class ProducerSectionHandler extends mir.util.xml.AbstractSectionHandler {
private ProducerFactory producerFactory;
private String factoryName;
factoryName = aName;
}
- public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
if (aTag.equals("verbs")) {
if (verbs!=null)
- throw new XMLReader.XMLReaderExc("Verbs already processed");
+ throw new XMLParserExc("Verbs already processed");
if (body!=null)
- throw new XMLReader.XMLReaderExc("Verbs should come before body");
+ throw new XMLParserExc("Verbs should come before body");
else
return new ProducerVerbsSectionHandler();
}
if (body==null)
return new ProducerNodeSectionHandler();
else
- throw new XMLReader.XMLReaderExc("Body already processed");
+ throw new XMLParserExc("Body already processed");
}
- throw new XMLReader.XMLReaderExc("Unexpected tag: '"+aTag+"'");
+ throw new XMLParserExc("Unexpected tag: '"+aTag+"'");
}
- public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+ public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
if (aHandler instanceof ProducerNodeSectionHandler) {
body = ((ProducerNodeSectionHandler) aHandler).getProducerNode();
}
verbNodes = ((ProducerVerbsSectionHandler) aHandler).getVerbNodes();
defaultVerb = ((ProducerVerbsSectionHandler) aHandler).getDefaultVerb();
}
- else throw new XMLReader.XMLReaderExc("ProducerSectionHandler.endElement Internal error: Unexpected handler: " + aHandler.getClass().getName());
+ else throw new XMLParserExc("ProducerSectionHandler.endElement Internal error: Unexpected handler: " + aHandler.getClass().getName());
}
- public void finishSection() throws XMLReader.XMLReaderExc {
+ public void finishSection() throws XMLParserExc {
if (verbs==null)
- throw new XMLReader.XMLReaderExc("No verbs defined");
+ throw new XMLParserExc("No verbs defined");
if (body==null)
- throw new XMLReader.XMLReaderExc("No body defined");
+ throw new XMLParserExc("No body defined");
producerFactory = new ScriptedProducerFactory(factoryName, verbs, verbNodes, body, defaultVerb);
}
private final static String[] PRODUCER_VERB_REQUIRED_ATTRIBUTES = { PRODUCER_VERB_NAME_ATTRIBUTE };
private final static String[] PRODUCER_VERB_OPTIONAL_ATTRIBUTES = { PRODUCER_VERB_DEFAULT_ATTRIBUTE, PRODUCER_VERB_DESCRIPTION_ATTRIBUTE };
- public class ProducerVerbsSectionHandler extends XMLReader.AbstractSectionHandler {
+ public class ProducerVerbsSectionHandler extends mir.util.xml.AbstractSectionHandler {
private Map verbNodes;
private List verbs;
private String defaultVerb;
defaultVerb = null;
}
- public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
if (aTag.equals("verb")) {
- XMLReaderTool.checkAttributes(anAttributes,
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes,
PRODUCER_VERB_REQUIRED_ATTRIBUTES,
PRODUCER_VERB_OPTIONAL_ATTRIBUTES);
currentVerb = (String) anAttributes.get(PRODUCER_VERB_NAME_ATTRIBUTE);
- XMLReaderTool.checkValidIdentifier(currentVerb);
+ mir.util.xml.XMLReaderTool.checkValidIdentifier(currentVerb);
if (verbNodes.containsKey(currentVerb))
- throw new XMLReader.XMLReaderExc("Duplicate definition of verb '" +
+ throw new XMLParserExc("Duplicate definition of verb '" +
currentVerb + "'");
if (anAttributes.containsKey(PRODUCER_VERB_DEFAULT_ATTRIBUTE)) {
if (defaultVerb != null)
- throw new XMLReader.XMLReaderExc("Default verb already declared");
+ throw new XMLParserExc("Default verb already declared");
defaultVerb = currentVerb;
}
return new ProducerNodeSectionHandler();
}
else
- throw new XMLReader.XMLReaderExc("Only 'verb' tags allowed here, '" + aTag + "' encountered.");
+ throw new XMLParserExc("Only 'verb' tags allowed here, '" + aTag + "' encountered.");
}
- public void endElement(XMLReader.SectionHandler aHandler) {
+ public void endElement(mir.util.xml.SectionHandler aHandler) {
verbNodes.put(currentVerb, ((ProducerNodeSectionHandler) aHandler).getProducerNode());
verbs.add(new SimpleProducerVerb(currentVerb, currentVerbDescription));
}
}
}
- public class EmptySectionHandler extends XMLReader.AbstractSectionHandler {
- public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
- throw new XMLReader.XMLReaderExc("No tags are allowed here");
+ public class EmptySectionHandler extends mir.util.xml.AbstractSectionHandler {
+ public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
+ throw new XMLParserExc("No tags are allowed here");
}
- public void endElement(XMLReader.SectionHandler aHandler) {
+ public void endElement(mir.util.xml.SectionHandler aHandler) {
}
public void finishSection() {
}
}
- public class MultiProducerNodeSectionHandler extends XMLReader.AbstractSectionHandler {
+ public class MultiProducerNodeSectionHandler extends mir.util.xml.AbstractSectionHandler {
private Map nodeParameters;
private Set validNodeParameters;
private String currentNodeParameter;
this("", new HashSet(), aValidNodeParameters);
}
- public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
if (!validNodeParameters.contains(aTag))
- throw new XMLReader.XMLReaderExc("Invalid node parameter: '" + aTag + "'");
+ throw new XMLParserExc("Invalid node parameter: '" + aTag + "'");
else if (nodeParameters.containsKey(aTag))
- throw new XMLReader.XMLReaderExc("Node parameter: '" + aTag + "' already specified");
+ throw new XMLParserExc("Node parameter: '" + aTag + "' already specified");
else if (anAttributes.size()>0)
- throw new XMLReader.XMLReaderExc("No parameters are allowed here");
+ throw new XMLParserExc("No parameters are allowed here");
currentNodeParameter = aTag;
return new ProducerNodeSectionHandler(scriptedNodeName, allowedNodeParameterReferences);
}
- public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+ public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
if (aHandler instanceof ProducerNodeSectionHandler) {
nodeParameters.put(currentNodeParameter, ((ProducerNodeSectionHandler) aHandler).getProducerNode());
}
else {
- throw new XMLReader.XMLReaderExc("Internal error: unknown section handler '" + aHandler.getClass().getName() + "'" );
+ throw new XMLParserExc("Internal error: unknown section handler '" + aHandler.getClass().getName() + "'" );
}
}
}
}
- public class ProducerNodeSectionHandler extends XMLReader.AbstractSectionHandler {
+ public class ProducerNodeSectionHandler extends mir.util.xml.AbstractSectionHandler {
private CompositeProducerNode producerNode;
private ProducerNodeBuilder currentBuilder;
private String scriptedNodeName;
this("", new HashSet());
}
- public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
try {
if (allowedNodeParameterReferences.contains( (aTag))) {
if (!anAttributes.isEmpty()) {
- throw new XMLReader.XMLReaderExc("No attributes allowed");
+ throw new XMLParserExc("No attributes allowed");
}
currentBuilder = new DefaultProducerNodeBuilders.
}
}
else
- throw new XMLReader.XMLReaderExc("Unknown producer node tag: '" + aTag + "'");
+ throw new XMLParserExc("Unknown producer node tag: '" + aTag + "'");
}
catch (Throwable t) {
- throw new XMLReader.XMLReaderFailure(t);
+ throw new XMLParserFailure(t);
}
}
- public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+ public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
try {
if (aHandler instanceof ProducerNodeSectionHandler) {
currentBuilder.setSubNode(
// deliberately empty: nothing expected, so nothing to process
}
else {
- throw new XMLReader.XMLReaderExc(
+ throw new XMLParserExc(
"Internal error: unknown section handler '" +
aHandler.getClass().getName() + "'");
}
currentBuilder = null;
}
catch (Throwable t) {
- throw new XMLReader.XMLReaderFailure(t);
+ throw new XMLParserFailure(t);
}
}
}
}
- public class NodeDefinitionSectionHandler extends XMLReader.AbstractSectionHandler {
+ public class NodeDefinitionSectionHandler extends mir.util.xml.AbstractSectionHandler {
private ScriptedProducerNodeDefinition nodeDefinition;
private ProducerNode body;
private Map stringParameters;
name = aName;
}
- public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
if (aTag.equals("parameters")) {
if (!anAttributes.isEmpty()) {
- throw new XMLReader.XMLReaderExc( "No attributes allowed for tag 'parameters'" );
+ throw new XMLParserExc( "No attributes allowed for tag 'parameters'" );
}
if (nodeParameters!=null) {
- throw new XMLReader.XMLReaderExc( "Parameters have already been declared" );
+ throw new XMLParserExc( "Parameters have already been declared" );
}
if (body!=null) {
- throw new XMLReader.XMLReaderExc( "Parameters should come before definition in nodedefinition '" + name +"'" );
+ throw new XMLParserExc( "Parameters should come before definition in nodedefinition '" + name +"'" );
}
return new NodeDefinitionParametersSectionHandler();
}
else if (aTag.equals("definition")) {
if (nodeParameters==null)
- throw new XMLReader.XMLReaderExc( "Parameters should come before definition in nodedefinition '" + name +"'" );
+ throw new XMLParserExc( "Parameters should come before definition in nodedefinition '" + name +"'" );
return new ProducerNodeSectionHandler(name, nodeParameters.keySet());
}
- else throw new XMLReader.XMLReaderExc("Only 'definition' or 'parameters' tags allowed here, '" + aTag + "' encountered.");
+ else throw new XMLParserExc("Only 'definition' or 'parameters' tags allowed here, '" + aTag + "' encountered.");
}
- public void endElement(XMLReader.SectionHandler aHandler) {
+ public void endElement(mir.util.xml.SectionHandler aHandler) {
if (aHandler instanceof NodeDefinitionParametersSectionHandler) {
stringParameters = ((NodeDefinitionParametersSectionHandler) aHandler).getStringParameters();
integerParameters = ((NodeDefinitionParametersSectionHandler) aHandler).getIntegerParameters();
}
}
- public void finishSection() throws XMLReader.XMLReaderExc {
+ public void finishSection() throws XMLParserExc {
Iterator i;
if (body == null)
- throw new XMLReader.XMLReaderExc( "Definition missing" );
+ throw new XMLParserExc( "Definition missing" );
nodeDefinition = new ScriptedProducerNodeDefinition(name);
private final static String[] NODE_DEFINITION_PARAMETER_OPTIONAL_ATTRIBUTES = { NODE_DEFINITION_PARAMETER_DEFAULTVALUE_ATTRIBUTE };
private final static String[] NODE_DEFINITION_NODE_PARAMETER_OPTIONAL_ATTRIBUTES = { };
- public class NodeDefinitionParametersSectionHandler extends XMLReader.AbstractSectionHandler {
+ public class NodeDefinitionParametersSectionHandler extends mir.util.xml.AbstractSectionHandler {
private Map nodeParameters;
private Map stringParameters;
private Map integerParameters;
integerParameters = new HashMap();
}
- public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
String parameterName;
String defaultValue;
if (aTag.equals("node")) {
- XMLReaderTool.checkAttributes(anAttributes,
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes,
NODE_DEFINITION_PARAMETER_REQUIRED_ATTRIBUTES,
NODE_DEFINITION_NODE_PARAMETER_OPTIONAL_ATTRIBUTES);
parameterName = (String) anAttributes.get(
NODE_DEFINITION_PARAMETER_NAME_ATTRIBUTE);
if (nodeParameters.containsKey(parameterName))
- throw new XMLReader.XMLReaderExc("Duplicate parameter name: '" +
+ throw new XMLParserExc("Duplicate parameter name: '" +
parameterName + "'");
- XMLReaderTool.checkValidIdentifier(parameterName);
+ mir.util.xml.XMLReaderTool.checkValidIdentifier(parameterName);
nodeParameters.put(parameterName, parameterName);
return new EmptySectionHandler();
}
else if (aTag.equals("string") || aTag.equals("integer")) {
- XMLReaderTool.checkAttributes(anAttributes,
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes,
NODE_DEFINITION_PARAMETER_REQUIRED_ATTRIBUTES,
NODE_DEFINITION_PARAMETER_OPTIONAL_ATTRIBUTES);
parameterName = (String) anAttributes.get(
if (stringParameters.containsKey(parameterName) ||
integerParameters.containsKey(parameterName))
- throw new XMLReader.XMLReaderExc("Duplicate parameter name: '" +
+ throw new XMLParserExc("Duplicate parameter name: '" +
parameterName + "'");
- XMLReaderTool.checkValidIdentifier(parameterName);
+ mir.util.xml.XMLReaderTool.checkValidIdentifier(parameterName);
defaultValue = (String) anAttributes.get(
NODE_DEFINITION_PARAMETER_DEFAULTVALUE_ATTRIBUTE);
return new EmptySectionHandler();
}
else
- throw new XMLReader.XMLReaderExc(
+ throw new XMLParserExc(
"Only 'string', 'integer' and 'node' tags allowed here, '" + aTag + "' encountered.");
}
- public void endElement(XMLReader.SectionHandler aHandler) {
+ public void endElement(mir.util.xml.SectionHandler aHandler) {
}
public void finishSection() {
* Foundation, Inc., 59 Temple Place, Suite 330, 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.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, 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.Set;
import mir.producer.ProducerNode;
-import mir.util.XMLReader;
+import mir.util.xml.XMLParserExc;
public interface ProducerNodeBuilder {
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc;
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc;
public void setSubNode(String aName, ProducerNode aNode) throws ProducerConfigExc;
public Set getAvailableSubNodes() throws ProducerConfigExc;
public ProducerNode constructNode() throws ProducerConfigExc;
public class DefaultProducerNodeBuilderFactory implements ProducerNodeBuilderFactory {
private Class producerNodeBuilderClass;
- public DefaultProducerNodeBuilderFactory(Class aProducerNodeBuilderClass) throws ProducerConfigExc, XMLReader.XMLReaderExc {
+ public DefaultProducerNodeBuilderFactory(Class aProducerNodeBuilderClass) throws ProducerConfigExc, XMLParserExc {
if (!ProducerNodeBuilder.class.isAssignableFrom(aProducerNodeBuilderClass))
throw new ProducerConfigExc("supplied class is not a ProducerNodeBuilder class but a " + aProducerNodeBuilderClass.getClass().getName());
import java.util.List;
import java.util.Map;
import java.util.Vector;
+import mir.util.xml.*;
-import mir.util.XMLReader;
+import mir.util.xml.XMLParserEngine;
/**
*
public RSSData parseInputStream(InputStream aStream) throws RSSExc, RSSFailure {
try {
- XMLReader xmlReader = new XMLReader(false);
RSSData result = new RSSData();
- xmlReader.parseInputStream(aStream, new RootSectionHandler(result));
+ XMLParserEngine.getInstance().parse("html", aStream, new RootSectionHandler(result));
return result;
}
}
}
- private class RootSectionHandler extends XMLReader.AbstractSectionHandler {
+ private class RootSectionHandler extends mir.util.xml.AbstractSectionHandler {
private RSSData data;
public RootSectionHandler(RSSData aData) {
data = aData;
}
- public XMLReader.SectionHandler startElement(XMLReader.XMLName aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ public mir.util.xml.SectionHandler startElement(mir.util.xml.XMLName aTag, Map anAttributes) throws XMLParserExc {
if (aTag.getLocalName().equals("rss")) {
return new RSS091SectionHandler(data);
}
else
- throw new XMLReader.XMLReaderFailure(new RSSExc("'rss' tag expected"));
+ throw new XMLParserFailure(new RSSExc("'rss' tag expected"));
};
- public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+ public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
};
- public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+ public void characters(String aCharacters) throws XMLParserExc {
if (aCharacters.trim().length()>0)
- throw new XMLReader.XMLReaderExc("No character data allowed here");
+ throw new XMLParserExc("No character data allowed here");
};
- public void finishSection() throws XMLReader.XMLReaderExc {
+ public void finishSection() throws XMLParserExc {
};
}
- private class RSS091SectionHandler extends XMLReader.AbstractSectionHandler {
+ private class RSS091SectionHandler extends mir.util.xml.AbstractSectionHandler {
private RSSData data;
data = aData;
}
- public XMLReader.SectionHandler startElement(XMLReader.XMLName aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ public mir.util.xml.SectionHandler startElement(mir.util.xml.XMLName aTag, Map anAttributes) throws XMLParserExc {
if (aTag.getLocalName().equals("channel"))
return new RSS091ChannelSectionHandler(data);
else
- throw new XMLReader.XMLReaderExc("channel tag expected, " + aTag.getLocalName() + " found");
+ throw new XMLParserExc("channel tag expected, " + aTag.getLocalName() + " found");
};
- public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+ public void characters(String aCharacters) throws XMLParserExc {
if (aCharacters.trim().length()>0)
- throw new XMLReader.XMLReaderExc("No character data allowed here");
+ throw new XMLParserExc("No character data allowed here");
};
- public void finishSection() throws XMLReader.XMLReaderExc {
+ public void finishSection() throws XMLParserExc {
};
}
- private class RSS091ChannelSectionHandler extends XMLReader.AbstractSectionHandler {
+ private class RSS091ChannelSectionHandler extends mir.util.xml.AbstractSectionHandler {
private String currentTag;
private RSSData data;
attributes = new HashMap();
}
- public XMLReader.SectionHandler startElement(XMLReader.XMLName aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ public mir.util.xml.SectionHandler startElement(mir.util.xml.XMLName aTag, Map anAttributes) throws XMLParserExc {
String tag = aTag.getLocalName();
if (tag.equals("item"))
return new DiscardingSectionHandler();
};
- public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+ public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
if (aHandler instanceof PCDATASectionHandler) {
attributes.put(currentTag, (((PCDATASectionHandler) aHandler).getData()));
}
}
};
- public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+ public void characters(String aCharacters) throws XMLParserExc {
if (aCharacters.trim().length()>0)
- throw new XMLReader.XMLReaderExc("No character data allowed here");
+ throw new XMLParserExc("No character data allowed here");
};
- public void finishSection() throws XMLReader.XMLReaderExc {
+ public void finishSection() throws XMLParserExc {
Iterator i = items.iterator();
while (i.hasNext()) {
};
}
- private class RSS091ItemSectionHandler extends XMLReader.AbstractSectionHandler {
+ private class RSS091ItemSectionHandler extends mir.util.xml.AbstractSectionHandler {
private String currentTag;
private RDFResource item;
attributes = new HashMap();
}
- public XMLReader.SectionHandler startElement(XMLReader.XMLName aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ public mir.util.xml.SectionHandler startElement(mir.util.xml.XMLName aTag, Map anAttributes) throws XMLParserExc {
String tag = aTag.getLocalName();
System.out.println(tag);
return new DiscardingSectionHandler();
};
- public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+ public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
if (aHandler instanceof PCDATASectionHandler) {
attributes.put(currentTag, (((PCDATASectionHandler) aHandler).getData()));
}
};
- public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+ public void characters(String aCharacters) throws XMLParserExc {
if (aCharacters.trim().length()>0)
- throw new XMLReader.XMLReaderExc("No character data allowed here");
+ throw new XMLParserExc("No character data allowed here");
};
- public void finishSection() throws XMLReader.XMLReaderExc {
+ public void finishSection() throws XMLParserExc {
item = new RDFResource("rss:item", (String) attributes.get("rss:link"));
Iterator i = attributes.entrySet().iterator();
}
- private class PCDATASectionHandler extends XMLReader.AbstractSectionHandler {
+ private class PCDATASectionHandler extends mir.util.xml.AbstractSectionHandler {
private StringBuffer data;
public PCDATASectionHandler() {
data = new StringBuffer();
}
- public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
- throw new XMLReader.XMLReaderFailure(new RSSExc("No subtags allowed here"));
+ public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
+ throw new XMLParserFailure(new RSSExc("No subtags allowed here"));
};
- public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+ public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
};
- public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+ public void characters(String aCharacters) throws XMLParserExc {
data.append(aCharacters);
};
- public void finishSection() throws XMLReader.XMLReaderExc {
+ public void finishSection() throws XMLParserExc {
};
public String getData() {
}
- private class RDFSequenceSectionHandler extends XMLReader.AbstractSectionHandler {
+ private class RDFSequenceSectionHandler extends mir.util.xml.AbstractSectionHandler {
private List items;
public RDFSequenceSectionHandler() {
items = new Vector();
}
- public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
if (aTag.equals("rdf:li")) {
String item = (String) anAttributes.get("rdf:resource");
return new DiscardingSectionHandler();
};
- public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+ public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
};
- public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+ public void characters(String aCharacters) throws XMLParserExc {
};
- public void finishSection() throws XMLReader.XMLReaderExc {
+ public void finishSection() throws XMLParserExc {
};
public List getItems() {
}
}
- private class DiscardingSectionHandler extends XMLReader.AbstractSectionHandler {
- public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ private class DiscardingSectionHandler extends mir.util.xml.AbstractSectionHandler {
+ public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
return this;
};
- public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+ public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
};
- public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+ public void characters(String aCharacters) throws XMLParserExc {
};
- public void finishSection() throws XMLReader.XMLReaderExc {
+ public void finishSection() throws XMLParserExc {
};
}
}
import java.util.Vector;
import mir.util.DateTimeFunctions;
-import mir.util.XMLReader;
+import mir.util.xml.XMLParserEngine;
+import mir.util.xml.XMLParserExc;
+import mir.util.xml.XMLParserFailure;
/**
*
// ML: to be localized:
public static final String V2V_NAMESPACE_URI = "http://v2v.cc/rss/";
- private static final XMLReader.XMLName RDF_ABOUT_PARAMETER = new XMLReader.XMLName(RDF_NAMESPACE_URI, "about");
- private static final XMLReader.XMLName RDF_SEQUENCE_TAG = new XMLReader.XMLName(RDF_NAMESPACE_URI, "Seq");
- private static final XMLReader.XMLName RDF_BAG_PARAMETER = new XMLReader.XMLName(RDF_NAMESPACE_URI, "Bag");
+ private static final mir.util.xml.XMLName RDF_ABOUT_PARAMETER = new mir.util.xml.XMLName(RDF_NAMESPACE_URI, "about");
+ private static final mir.util.xml.XMLName RDF_SEQUENCE_TAG = new mir.util.xml.XMLName(RDF_NAMESPACE_URI, "Seq");
+ private static final mir.util.xml.XMLName RDF_BAG_PARAMETER = new mir.util.xml.XMLName(RDF_NAMESPACE_URI, "Bag");
- private static final XMLReader.XMLName RSS_CHANNEL_TAG = new XMLReader.XMLName(RSS_1_0_NAMESPACE_URI, "channel");
- private static final XMLReader.XMLName RSS_ITEM_TAG = new XMLReader.XMLName(RSS_1_0_NAMESPACE_URI, "item");
- private static final XMLReader.XMLName RSS_ITEMS_TAG = new XMLReader.XMLName(RSS_1_0_NAMESPACE_URI, "items");
+ private static final mir.util.xml.XMLName RSS_CHANNEL_TAG = new mir.util.xml.XMLName(RSS_1_0_NAMESPACE_URI, "channel");
+ private static final mir.util.xml.XMLName RSS_ITEM_TAG = new mir.util.xml.XMLName(RSS_1_0_NAMESPACE_URI, "item");
+ private static final mir.util.xml.XMLName RSS_ITEMS_TAG = new mir.util.xml.XMLName(RSS_1_0_NAMESPACE_URI, "items");
private List modules;
private Map namespaceURItoModule;
public RSSData parseInputStream(InputStream aStream) throws RSSExc, RSSFailure {
try {
- XMLReader xmlReader = new XMLReader(true);
RSSData result = new RSSData();
- xmlReader.parseInputStream(aStream, new RootSectionHandler(result));
+ XMLParserEngine.getInstance().parse("xml.namespaceaware", aStream, new RootSectionHandler(result));
return result;
}
}
}
- private class RootSectionHandler extends XMLReader.AbstractSectionHandler {
+ private class RootSectionHandler extends mir.util.xml.AbstractSectionHandler {
private RSSData data;
public RootSectionHandler(RSSData aData) {
data = aData;
}
- public XMLReader.SectionHandler startElement(XMLReader.XMLName aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ public mir.util.xml.SectionHandler startElement(mir.util.xml.XMLName aTag, Map anAttributes) throws XMLParserExc {
if (aTag.getLocalName().equals("RDF")) {
return new RDFSectionHandler(data);
}
else
- throw new XMLReader.XMLReaderFailure(new RSSExc("'RDF' tag expected"));
+ throw new XMLParserFailure(new RSSExc("'RDF' tag expected"));
};
- public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+ public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
};
- public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+ public void characters(String aCharacters) throws XMLParserExc {
if (aCharacters.trim().length()>0)
- throw new XMLReader.XMLReaderExc("No character data allowed here");
+ throw new XMLParserExc("No character data allowed here");
};
- public void finishSection() throws XMLReader.XMLReaderExc {
+ public void finishSection() throws XMLParserExc {
};
}
- private class RDFSectionHandler extends XMLReader.AbstractSectionHandler {
+ private class RDFSectionHandler extends mir.util.xml.AbstractSectionHandler {
private RSSData data;
data = aData;
}
- public XMLReader.SectionHandler startElement(XMLReader.XMLName aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ public mir.util.xml.SectionHandler startElement(mir.util.xml.XMLName aTag, Map anAttributes) throws XMLParserExc {
String identifier = (String) anAttributes.get(RDF_ABOUT_PARAMETER);
String rdfClass = makeQualifiedName(aTag);
return new RDFResourceSectionHandler(rdfClass, identifier);
};
- public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+ public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
if (aHandler instanceof RDFResourceSectionHandler) {
data.addResource(((RDFResourceSectionHandler) aHandler).getResource());
}
};
- public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+ public void characters(String aCharacters) throws XMLParserExc {
if (aCharacters.trim().length()>0)
- throw new XMLReader.XMLReaderExc("No character data allowed here");
+ throw new XMLParserExc("No character data allowed here");
};
- public void finishSection() throws XMLReader.XMLReaderExc {
+ public void finishSection() throws XMLParserExc {
};
}
- private XMLReader.SectionHandler makePropertyValueSectionHandler(XMLReader.XMLName aTag, Map anAttributes) {
+ private mir.util.xml.SectionHandler makePropertyValueSectionHandler(mir.util.xml.XMLName aTag, Map anAttributes) {
RSSModule module = (RSSModule) namespaceURItoModule.get(aTag.getNamespaceURI());
if (module!=null) {
return new FlexiblePropertyValueSectionHandler();
}
- private void usePropertyValueSectionHandler(RDFResource aResource, PropertyValueSectionHandler aHandler, XMLReader.XMLName aTag) {
+ private void usePropertyValueSectionHandler(RDFResource aResource, PropertyValueSectionHandler aHandler, mir.util.xml.XMLName aTag) {
RSSModule module = (RSSModule) namespaceURItoModule.get(aTag.getNamespaceURI());
if (module!=null) {
aResource.set(makeQualifiedName(aTag), aHandler.getValue());
}
- private String makeQualifiedName(XMLReader.XMLName aName) {
+ private String makeQualifiedName(mir.util.xml.XMLName aName) {
String result=aName.getLocalName();
RSSModule module = (RSSModule) namespaceURItoModule.get(aName.getNamespaceURI());
if (module!=null) {
return result;
}
- private class RDFResourceSectionHandler extends XMLReader.AbstractSectionHandler {
+ private class RDFResourceSectionHandler extends mir.util.xml.AbstractSectionHandler {
private String image;
- private XMLReader.XMLName currentTag;
+ private mir.util.xml.XMLName currentTag;
private RDFResource resource;
public RDFResourceSectionHandler(String anRDFClass, String anIdentifier) {
resource = new RDFResource(anRDFClass, anIdentifier);
}
- public XMLReader.SectionHandler startElement(XMLReader.XMLName aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ public mir.util.xml.SectionHandler startElement(mir.util.xml.XMLName aTag, Map anAttributes) throws XMLParserExc {
currentTag = aTag;
return makePropertyValueSectionHandler(aTag, anAttributes);
};
- public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+ public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
if (aHandler instanceof PropertyValueSectionHandler) {
usePropertyValueSectionHandler(resource, (PropertyValueSectionHandler) aHandler, currentTag);
// resource.set(makeQualifiedName(currentTag), ( (PropertyValueSectionHandler) aHandler).getValue());
}
};
- public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+ public void characters(String aCharacters) throws XMLParserExc {
if (aCharacters.trim().length()>0)
- throw new XMLReader.XMLReaderExc("No character data allowed here");
+ throw new XMLParserExc("No character data allowed here");
};
- public void finishSection() throws XMLReader.XMLReaderExc {
+ public void finishSection() throws XMLParserExc {
};
public RDFResource getResource() {
}
}
- private abstract class PropertyValueSectionHandler extends XMLReader.AbstractSectionHandler {
+ private abstract class PropertyValueSectionHandler extends mir.util.xml.AbstractSectionHandler {
public abstract Object getValue();
}
structuredData=null;
}
- public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
if (aTag.equals(RDF_SEQUENCE_TAG))
return new RDFSequenceSectionHandler();
else
return new DiscardingSectionHandler();
};
- public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+ public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
if (aHandler instanceof RDFSequenceSectionHandler) {
structuredData= ((RDFSequenceSectionHandler) aHandler).getItems();
}
};
- public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+ public void characters(String aCharacters) throws XMLParserExc {
stringData.append(aCharacters);
};
- public void finishSection() throws XMLReader.XMLReaderExc {
+ public void finishSection() throws XMLParserExc {
};
public String getData() {
items = new Vector();
}
- public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
if (aTag.equals(RDF_SEQUENCE_TAG))
return new RDFSequenceSectionHandler();
else
return new DiscardingSectionHandler();
};
- public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+ public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
if (aHandler instanceof RDFSequenceSectionHandler) {
items.addAll(((RDFSequenceSectionHandler) aHandler).getItems());
}
};
- public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+ public void characters(String aCharacters) throws XMLParserExc {
if (aCharacters.trim().length()>0)
- throw new XMLReader.XMLReaderExc("No character data allowed here");
+ throw new XMLParserExc("No character data allowed here");
};
- public void finishSection() throws XMLReader.XMLReaderExc {
+ public void finishSection() throws XMLParserExc {
};
public List getItems() {
data = new StringBuffer();
}
- public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
- throw new XMLReader.XMLReaderFailure(new RSSExc("No subtags allowed here"));
+ public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
+ throw new XMLParserFailure(new RSSExc("No subtags allowed here"));
};
- public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+ public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
};
- public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+ public void characters(String aCharacters) throws XMLParserExc {
data.append(aCharacters);
};
- public void finishSection() throws XMLReader.XMLReaderExc {
+ public void finishSection() throws XMLParserExc {
};
public String getData() {
data = new StringBuffer();
}
- public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
- throw new XMLReader.XMLReaderFailure(new RSSExc("No subtags allowed here"));
+ public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
+ throw new XMLParserFailure(new RSSExc("No subtags allowed here"));
};
- public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+ public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
};
- public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+ public void characters(String aCharacters) throws XMLParserExc {
data.append(aCharacters);
};
- public void finishSection() throws XMLReader.XMLReaderExc {
+ public void finishSection() throws XMLParserExc {
};
- private final static String SPACE = "[\t\n\r ]*";
- private final static String NUMBER = "[0-9]*";
- private final static String SIGN = "[-+]";
-
public Object getValue() {
try {
String expression = data.toString().trim();
}
- private class RDFSequenceSectionHandler extends XMLReader.AbstractSectionHandler {
+ private class RDFSequenceSectionHandler extends mir.util.xml.AbstractSectionHandler {
private List items;
public RDFSequenceSectionHandler() {
items = new Vector();
}
- public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
if (aTag.equals("rdf:li")) {
String item = (String) anAttributes.get("rdf:resource");
return new DiscardingSectionHandler();
};
- public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+ public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
};
- public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+ public void characters(String aCharacters) throws XMLParserExc {
};
- public void finishSection() throws XMLReader.XMLReaderExc {
+ public void finishSection() throws XMLParserExc {
};
public List getItems() {
return data;
}
- public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
tag=aTag;
data.append("<"+tag+">");
return new RDFLiteralSectionHandler();
};
- public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+ public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
data.append(((RDFLiteralSectionHandler) aHandler).getData());
data.append("</"+tag+">");
};
- public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+ public void characters(String aCharacters) throws XMLParserExc {
data.append(aCharacters);
};
- public void finishSection() throws XMLReader.XMLReaderExc {
+ public void finishSection() throws XMLParserExc {
};
public Object getValue() {
}
}
- private class DiscardingSectionHandler extends XMLReader.AbstractSectionHandler {
- public XMLReader.SectionHandler startElement(String aTag, Map anAttributes) throws XMLReader.XMLReaderExc {
+ private class DiscardingSectionHandler extends mir.util.xml.AbstractSectionHandler {
+ public mir.util.xml.SectionHandler startElement(String aTag, Map anAttributes) throws XMLParserExc {
return this;
};
- public void endElement(XMLReader.SectionHandler aHandler) throws XMLReader.XMLReaderExc {
+ public void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc {
};
- public void characters(String aCharacters) throws XMLReader.XMLReaderExc {
+ public void characters(String aCharacters) throws XMLParserExc {
};
- public void finishSection() throws XMLReader.XMLReaderExc {
+ public void finishSection() throws XMLParserExc {
};
}
}
package mir.rss;
+import java.util.Iterator;
public class RSSTest {
public static void main(String[] args) {
RSSReader reader = new RSSReader();
-//.. RSS091Reader reader2 = new RSS091Reader();
try {
-// RE test = new RE(".*\\bLB\\b.*", RE.REG_ICASE);
-// System.out.println(" LB II : " + test.isMatch("LB II"));
-// System.out.println(" revised LB: " + test.isMatch("revised LB"));
-// System.out.println(" revised LB II : " + test.isMatch("revised LB II"));
-// System.out.println(" buLB: " + test.isMatch("buLB"));
-
- RSSData arg = reader.parseUrl("http://argentina.indymedia.org/features.rdf");
-// RSSData it = reader.parseUrl("http://g8.mir.dnsalias.net/italynewswire.rss");
-// Object result = StructuredContentParser.parse(" { a = 'b' 'as a' = [ 'asd' asd 'asdas asd as''asd' ] }") ;
-// System.out.println("" + wvl.get("rss:item"));
-// RSSData fr = reader2.parseUrl("http://paris.indymedia.org/backendg8.php3");
-// RSSData be = reader.parseUrl("http://belgium.indymedia.org/features.rdf");
-
-// RSSAggregator agg = new RSSAggregator(10, "dc:date", true, null, null);
-
-// agg.appendItems(wvl.getResourcesForRdfClass("rss:item"));
-// agg.appendItems(be.getResourcesForRdfClass("rss:item"));
-
-// System.out.println(fr);
-
-// Iterator i = fr.getResourcesForRdfClass("rss:item").iterator();
-// while (i.hasNext())
-// System.out.println(ParameterExpander.evaluateExpression((RDFResource) i.next(), "['dc:date']"));
-
-// System.out.println(agg.getItems());
+ RSSData res = reader.parseUrl(args[0]);
+ Iterator i = res.getResourcesForRdfClass("rss:item").iterator();
+ while (i.hasNext())
+ System.out.println(i.next());
}
catch (Throwable t) {
System.out.println("Exception: " + t.toString());
+++ /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 any library licensed under the Apache Software License,
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
- * (or with modified versions of the above that use the same license as the above),
- * and distribute linked combinations including the two. You must obey the
- * GNU General Public License in all respects for all of the code used other than
- * the above mentioned libraries. If you modify this file, you may extend this
- * exception to your version of the file, 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.BufferedInputStream;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.io.StringReader;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Stack;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-import org.ccil.cowan.tagsoup.Parser;
-import org.xml.sax.Attributes;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.helpers.DefaultHandler;
-import multex.Exc;
-import multex.Failure;
-
-public class XMLReader {
- private Locator locator;
- private String filename;
- private boolean namespaceAware;
-
- public XMLReader() {
- this(false);
- }
-
- public XMLReader(boolean aNameSpaceAware) {
- namespaceAware = aNameSpaceAware;
- filename="";
- }
-
- public void parseString(String aString, SectionHandler aRootHandler) throws XMLReaderFailure, XMLReaderExc {
- try {
- parseInputSource(new InputSource(new StringReader(aString)), aRootHandler);
- }
- catch (Throwable t) {
- throw new XMLReaderFailure(t);
- }
- }
-
- public void parseString(boolean aTagSoup, String aString, SectionHandler aRootHandler) throws XMLReaderFailure, XMLReaderExc {
- try {
- parseInputSource(aTagSoup, new InputSource(new StringReader(aString)), aRootHandler);
- }
- catch (Throwable t) {
- throw new XMLReaderFailure(t);
- }
- }
-
- public void parseFile(String aFileName, SectionHandler aRootHandler) throws XMLReaderFailure, XMLReaderExc {
- filename= aFileName;
- try {
- parseInputStream(new BufferedInputStream(new FileInputStream(aFileName),8192), aRootHandler);
- }
- catch (Throwable t) {
- throw new XMLReaderFailure(t);
- }
- }
-
- public void parseInputStream(InputStream anInputStream, SectionHandler aRootHandler) throws XMLReaderFailure, XMLReaderExc {
- parseInputSource(new InputSource(anInputStream), aRootHandler);
- }
-
- public void parseInputStream(boolean aTagSoup, InputStream anInputStream, SectionHandler aRootHandler) throws XMLReaderFailure, XMLReaderExc {
- parseInputSource(aTagSoup, new InputSource(anInputStream), aRootHandler);
- }
-
- public void parseInputSource(InputSource anInputSource, SectionHandler aRootHandler) throws XMLReaderFailure, XMLReaderExc {
- try {
- parseInputSource(false, anInputSource, aRootHandler);
- }
- catch (Throwable e) {
- Throwable t = ExceptionFunctions.traceCauseException(e);
-
- if (t instanceof XMLReaderExc) {
- throw (XMLReaderExc) t;
- }
-
- if (t instanceof XMLReaderFailure) {
- throw (XMLReaderFailure) t;
- }
-
- throw new XMLReaderFailure(t);
- }
- }
-
- public void parseInputSource(boolean aTagSoup, InputSource anInputSource, SectionHandler aRootHandler) throws XMLReaderFailure, XMLReaderExc {
- try {
- XMLReaderHandler handler = new XMLReaderHandler(aRootHandler);
-
- if (aTagSoup) {
- org.ccil.cowan.tagsoup.Parser parser = new Parser();
- parser.setContentHandler(handler);
- parser.setDTDHandler(handler);
- parser.parse(anInputSource);
- }
- else {
- SAXParserFactory parserFactory = SAXParserFactory.newInstance();
-
- parserFactory.setNamespaceAware(true);
- parserFactory.setValidating(true);
- SAXParser parser = parserFactory.newSAXParser();
-
- parser.parse(anInputSource, handler);
- }
- }
- catch (Throwable e) {
- Throwable t = ExceptionFunctions.traceCauseException(e);
-
- if (t instanceof XMLReaderExc) {
- throw (XMLReaderExc) t;
- }
-
- if (t instanceof XMLReaderFailure) {
- throw (XMLReaderFailure) t;
- }
-
- if (t instanceof XMLReaderExc) {
- if (locator!=null && filename!=null)
- ((XMLReaderExc) t).setLocation(filename, locator.getLineNumber(), locator.getColumnNumber());
- throw (XMLReaderExc) t;
- }
-
- if (t instanceof SAXParseException) {
- XMLReaderExc r = new XMLReaderExc(t.getMessage());
-
- if (locator!=null && filename!=null)
- r.setLocation(filename, locator.getLineNumber(), locator.getColumnNumber());
-
- throw r;
- }
-
- if (t instanceof XMLReaderFailure) {
- throw (XMLReaderFailure) t;
- }
-
- if (t instanceof ParserConfigurationException) {
- throw new XMLReaderFailure("Internal exception: "+t.toString(), t);
- }
-
- throw new XMLReaderFailure(t);
- }
- }
- private class XMLReaderHandler extends DefaultHandler {
- private SectionsManager manager;
-
- public XMLReaderHandler(SectionHandler aRootHandler) {
- super();
-
- manager = new SectionsManager();
- manager.pushHandler(aRootHandler);
- }
-
- public void setDocumentLocator(Locator aLocator) {
- locator=aLocator;
- }
-
- public void startElement(String aUri, String aLocalName, String aQualifiedName, Attributes anAttributes) throws SAXException {
- Map attributesMap;
- int i;
-
- try {
- attributesMap = new HashMap();
-
- if (namespaceAware)
- for (i=0; i<anAttributes.getLength(); i++)
- attributesMap.put(new XMLName(anAttributes.getURI(i), XMLReaderTool.getNameSpaceFromQualifiedName(anAttributes.getQName(i)), anAttributes.getLocalName(i)), anAttributes.getValue(i));
- else
- for (i=0; i<anAttributes.getLength(); i++)
- attributesMap.put(anAttributes.getLocalName(i), anAttributes.getValue(i));
-
- SectionHandler handler = manager.currentHandler().startElement(new XMLName(aUri, XMLReaderTool.getNameSpaceFromQualifiedName(aQualifiedName), aLocalName), attributesMap);
-
- manager.pushHandler( handler );
- }
- catch (XMLReaderExc e) {
- throw new SAXParseException(e.getMessage(), null, e);
- }
- catch (Exception e) {
- throw new SAXException(e);
- }
- }
-
- public void endElement(String aUri, String aLocalName, String aQualifiedName) throws SAXException {
- try
- {
- SectionHandler handler = manager.popHandler();
-
- handler.finishSection();
-
- if (!manager.isEmpty()) {
- manager.currentHandler().endElement(handler);
- }
- }
- catch (XMLReaderExc e) {
- throw new SAXParseException(e.getMessage(), null, e);
- }
- catch (Exception e) {
- throw new SAXException(e);
- }
- }
-
- public void endDocument() throws SAXException {
- try
- {
- SectionHandler handler = manager.popHandler();
-
- handler.finishSection();
- }
- catch (XMLReaderExc e) {
- throw new SAXParseException(e.getMessage(), null, e);
- }
- catch (Exception e) {
- throw new SAXException(e);
- }
- }
-
- public void characters(char[] aBuffer, int aStart, int anEnd) throws SAXException {
- try {
- String text = new String(aBuffer, aStart, anEnd);
-
- manager.currentHandler().characters(text);
- }
- catch (XMLReaderExc e) {
- throw new SAXParseException(e.getMessage(), null, e);
- }
- catch (Exception e) {
- throw new SAXException(e);
- }
- }
- }
-
- private class SectionsManager {
- Stack handlerStack;
-
- public SectionsManager() {
- handlerStack = new Stack();
- }
-
- public void pushHandler(SectionHandler aSectionHandler) {
- handlerStack.push(aSectionHandler);
- }
-
- public SectionHandler popHandler() {
- return (SectionHandler) handlerStack.pop();
- }
-
- public SectionHandler currentHandler() {
- return (SectionHandler) handlerStack.peek();
- }
-
- public boolean isEmpty() {
- return handlerStack.isEmpty();
- }
- }
-
- public static interface SectionHandler {
- public abstract SectionHandler startElement(XMLName aTag, Map anAttributes) throws XMLReaderExc;
-
- public abstract void endElement(SectionHandler aHandler) throws XMLReaderExc;
-
- public void characters(String aCharacters) throws XMLReaderExc;
-
- public void finishSection() throws XMLReaderExc;
- }
-
- public static abstract class AbstractSectionHandler implements SectionHandler {
- public SectionHandler startElement(XMLName aTag, Map anAttributes) throws XMLReaderExc {
- return startElement(aTag.getLocalName(), anAttributes);
- };
-
- public SectionHandler startElement(String aLocalName, Map anAttributes) throws XMLReaderExc {
- return null;
- };
-
- public void endElement(SectionHandler aHandler) throws XMLReaderExc {
- };
-
- public void finishSection() throws XMLReaderExc {
- }
-
- public void characters(String aCharacters) throws XMLReaderExc {
- if ( aCharacters.trim().length() > 0) {
- throw new XMLReaderExc("Text not allowed");
- }
- }
- }
-
- public static class XMLReaderExc extends Exc {
- private boolean hasLocation;
- private String filename;
- private int lineNr;
- private int columnNr;
-
- public XMLReaderExc(String aMessage) {
- super(aMessage);
- hasLocation = false;
- }
-
- protected void setLocation(String aFilename, int aLineNr, int aColumnNr) {
- filename = aFilename;
- lineNr = aLineNr;
- columnNr = aColumnNr;
- hasLocation = true;
- }
-
- public boolean getHasLocation() {
- return hasLocation;
- }
-
- public int getLineNr() {
- return lineNr;
- }
-
- public int getColumnNr() {
- return columnNr;
- }
-
- public String getFilename() {
- return filename;
- }
- }
-
- public static class XMLReaderFailure extends Failure {
- public XMLReaderFailure(String aMessage, Throwable aCause) {
- super(aMessage, aCause);
- }
-
- public XMLReaderFailure(Throwable aCause) {
- super(aCause.getMessage(), aCause);
- }
- }
-
- public static class XMLName {
- private String namespaceURI;
- private String localName;
- private String prefix;
-
- public XMLName(String aLocalName) {
- this(null, null, aLocalName);
- }
-
- public XMLName(String aNamespaceURI, String aPrefix, String aLocalName) {
- localName="";
- prefix="";
- namespaceURI="";
-
- if (aLocalName!=null)
- localName = aLocalName;
- if (aPrefix!=null)
- prefix = aPrefix;
- if (aNamespaceURI!=null)
- namespaceURI = aNamespaceURI;
- }
-
- public XMLName(String aNamespaceURI, String aLocalName) {
- this (aNamespaceURI, null, aLocalName);
- }
-
- public String getNamespaceURI() {
- return namespaceURI;
- }
-
- public String getLocalName() {
- return localName;
- }
-
- public String getPrefix() {
- return prefix;
- }
-
- public int hashCode() {
- if (namespaceURI == null)
- return localName.hashCode() + 3*prefix.hashCode();
- else
- return localName.hashCode() + 3*namespaceURI.hashCode();
- }
-
- public String toString() {
- return ((namespaceURI.length()>0)? "["+namespaceURI+"]":"")+((prefix.length()>0)?prefix+":":"")+localName;
- }
-
- public boolean equals(Object anObject) {
- if (anObject instanceof XMLName) {
- if (namespaceURI==null)
- return (((XMLName) anObject).namespaceURI == null) &&
- prefix.equals(((XMLName) anObject).prefix) &&
- localName.equals(((XMLName) anObject).localName);
- else
- return namespaceURI.equals(((XMLName) anObject).namespaceURI) &&
- localName.equals(((XMLName) anObject).localName);
- }
- else
- return false;
- }
- }
-
-}
\ No newline at end of file
+++ /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 any library licensed under the Apache Software License,
- * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
- * (or with modified versions of the above that use the same license as the above),
- * and distribute linked combinations including the two. You must obey the
- * GNU General Public License in all respects for all of the code used other than
- * the above mentioned libraries. If you modify this file, you may extend this
- * exception to your version of the file, 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;
-
-public class XMLReaderTool {
-
- public static void checkValidIdentifier(String anIdentifier) throws XMLReader.XMLReaderExc {
- }
-
- public static String getStringAttributeWithDefault(Map anAttributes, String aKey, String aDefault) {
- if (anAttributes.containsKey(aKey))
- return (String) anAttributes.get(aKey);
- else
- return aDefault;
- }
-
- public static void checkIntegerAttribute(Map anAttributes, String aKey) throws XMLReader.XMLReaderExc {
- try {
- Integer.parseInt((String) anAttributes.get(aKey));
- }
- catch (Throwable t) {
- throw new XMLReader.XMLReaderExc("attribute '"+aKey+"' is not an integer" );
- }
- }
-
- public static int getIntegerAttributeWithDefault(Map anAttributes, String aKey, int aDefault) throws XMLReader.XMLReaderExc {
- String value;
-
- if (anAttributes.containsKey(aKey)) {
- checkIntegerAttribute(anAttributes, aKey);
- return Integer.parseInt((String) anAttributes.get(aKey));
- }
- else
- return aDefault;
- }
-
- public static void checkAttributes(Map anAttributes, String[] aRequiredAttributes, String[] anOptionalAttributes) throws XMLReader.XMLReaderExc {
- checkAttributeSet(anAttributes.keySet(),
- new HashSet(Arrays.asList(aRequiredAttributes)),
- new HashSet(Arrays.asList(anOptionalAttributes)));
- }
-
- public static void checkAttributeSet(Set aSet, Set aRequiredElements, Set anOptionalElements) throws XMLReader.XMLReaderExc{
- Iterator i;
-
- i = aSet.iterator();
- while (i.hasNext()) {
- Object item = i.next();
-
- if (!(aRequiredElements.contains(item) || anOptionalElements.contains(item)))
- throw new XMLReader.XMLReaderExc("unknown attribute '" + item + "'" );
- }
-
- i = aRequiredElements.iterator();
- while (i.hasNext()) {
- Object item = i.next();
-
- if (!(aSet.contains(item)))
- throw new XMLReader.XMLReaderExc("missing required attribute '" + item + "'" );
- }
-
- }
-
- /**
- * Returns the namespace part of a qualified XML Tag name <br>
- * Example:<br>
- * <code>getNameSpaceFromQualifiedName("dc:creator");</code> <br>
- * will return <code>"dc"</code>
- *
- * @param aQualifiedName
- * @return
- */
-
- public static String getNameSpaceFromQualifiedName(String aQualifiedName) {
- List parts = StringRoutines.splitString(aQualifiedName, ":");
-
- if (parts.size()<=1)
- return null;
- else
- return (String) parts.get(0);
- }
-
- /**
- * Returns the localname part of a qualified XML Tag name <br>
- * Example:<br>
- * <code>getLocalNameFromQualifiedName("dc:creator");</code> <br>
- * will return <code>"creator"</code>
- *
- * @param aQualifiedName
- * @return
- */
-
- public static String getLocalNameFromQualifiedName(String aQualifiedName) {
- List parts = StringRoutines.splitString(aQualifiedName, ":");
-
- if (parts.size()<1)
- return null;
- if (parts.size()==1)
- return (String) parts.get(0);
- else
- return (String) parts.get(1);
- }
-
-}
--- /dev/null
+package mir.util.xml;\r
+\r
+/**\r
+ *\r
+ * <p>Title: </p>\r
+ * <p>Description: </p>\r
+ * <p>Copyright: Copyright (c) 2003</p>\r
+ * <p>Company: </p>\r
+ * @author not attributable\r
+ * @version 1.0\r
+ */\r
+\r
+public abstract class AbstractSectionHandler implements SectionHandler {\r
+ public void extra(String anExtraData) throws XMLParserExc, XMLParserFailure {\r
+ }\r
+\r
+ public SectionHandler startElement(XMLName aTag, java.util.Map anAttributes) throws XMLParserExc{\r
+ return startElement(aTag.getLocalName(), XMLReaderTool.convertXMLAttributeMap(anAttributes));\r
+ };\r
+\r
+ public SectionHandler startElement(String aLocalName, java.util.Map anAttributes) throws XMLParserExc{\r
+ return new AbstractSectionHandler() {};\r
+ };\r
+\r
+ public void endElement(SectionHandler aHandler) throws XMLParserExc{\r
+ };\r
+\r
+ public void startSection() throws XMLParserExc{\r
+ }\r
+\r
+ public void finishSection() throws XMLParserExc{\r
+ }\r
+\r
+ public void characters(String aCharacters) throws XMLParserExc{\r
+ if ( aCharacters.trim().length() > 0) {\r
+ throw new XMLParserExc("Text not allowed");\r
+ }\r
+ }\r
+}\r
--- /dev/null
+package mir.util.xml;\r
+\r
+public interface SectionHandler {\r
+ /**\r
+ *\r
+ * @param anExtraData\r
+ * @throws XMLParserExc\r
+ * @throws XMLParserFailure\r
+ */\r
+ public void extra(String anExtraData) throws XMLParserExc, XMLParserFailure;\r
+\r
+ /**\r
+ *\r
+ * @param aTag\r
+ * @param anAttributes\r
+ * @return\r
+ * @throws XMLParserExc\r
+ * @throws XMLParserFailure\r
+ */\r
+ public abstract mir.util.xml.SectionHandler startElement(XMLName aTag, java.util.Map anAttributes) throws XMLParserExc, XMLParserFailure;\r
+\r
+ /**\r
+ *\r
+ * @param aHandler\r
+ * @throws XMLParserExc\r
+ * @throws XMLParserFailure\r
+ */\r
+ public abstract void endElement(mir.util.xml.SectionHandler aHandler) throws XMLParserExc, XMLParserFailure;\r
+\r
+ /**\r
+ *\r
+ * @param aCharacters\r
+ * @throws XMLParserExc\r
+ * @throws XMLParserFailure\r
+ */\r
+ public void characters(String aCharacters) throws XMLParserExc, XMLParserFailure;\r
+\r
+ /**\r
+ *\r
+ * @throws XMLParserExc\r
+ * @throws XMLParserFailure\r
+ */\r
+ public void startSection() throws XMLParserExc, XMLParserFailure;\r
+\r
+ /**\r
+ *\r
+ * @throws XMLParserExc\r
+ * @throws XMLParserFailure\r
+ */\r
+ public void finishSection() throws XMLParserExc, XMLParserFailure;\r
+}\r
--- /dev/null
+package mir.util.xml;\r
+\r
+/**\r
+ * Class to encapsulate an XML-style name (either for tagnames,\r
+ * or attribute names).\r
+ *\r
+ * <p>\r
+ * Usage requirements:\r
+ * <ul>\r
+ * <li> Namespace aware parsers must supply a local name\r
+ * and a namespace URI\r
+ * <li> Non-namespace aware parsers should supply a local name,\r
+ * and, if present and applicable, also a prefix\r
+ * </ul>\r
+ */\r
+\r
+public class XMLName {\r
+ private String namespaceURI;\r
+ private String localName;\r
+ private String prefix;\r
+\r
+ public XMLName(String aLocalName) {\r
+ this(null, null, aLocalName);\r
+ }\r
+\r
+ public XMLName(String aNamespaceURI, String aPrefix, String aLocalName) {\r
+ localName="";\r
+ prefix="";\r
+ namespaceURI="";\r
+\r
+ if (aLocalName!=null)\r
+ localName = aLocalName;\r
+ if (aPrefix!=null)\r
+ prefix = aPrefix;\r
+ if (aNamespaceURI!=null)\r
+ namespaceURI = aNamespaceURI;\r
+ }\r
+\r
+ public XMLName(String aNamespaceURI, String aLocalName) {\r
+ this (aNamespaceURI, null, aLocalName);\r
+ }\r
+\r
+ /**\r
+ * Returns the namespace URI if available\r
+ */\r
+ public String getNamespaceURI() {\r
+ return namespaceURI;\r
+ }\r
+\r
+ /**\r
+ * Returns the name of the tag, stripped from prefix\r
+ */\r
+ public String getLocalName() {\r
+ return localName;\r
+ }\r
+\r
+ /**\r
+ * Returns the prefix of the tag, if present\r
+ */\r
+ public String getPrefix() {\r
+ return prefix;\r
+ }\r
+\r
+ public int hashCode() {\r
+ if (namespaceURI == null)\r
+ return localName.hashCode() + 3*prefix.hashCode();\r
+ else\r
+ return localName.hashCode() + 3*namespaceURI.hashCode();\r
+ }\r
+\r
+ public String toString() {\r
+ return ((namespaceURI.length()>0)? "["+namespaceURI+"]":"")+((prefix.length()>0)?prefix+":":"")+localName;\r
+ }\r
+\r
+ public boolean equals(Object anObject) {\r
+ if (anObject instanceof mir.util.xml.XMLName) {\r
+ if (namespaceURI==null)\r
+ return (((mir.util.xml.XMLName) anObject).namespaceURI == null) &&\r
+ prefix.equals(((mir.util.xml.XMLName) anObject).prefix) &&\r
+ localName.equals(((mir.util.xml.XMLName) anObject).localName);\r
+ else\r
+ return namespaceURI.equals(((mir.util.xml.XMLName) anObject).namespaceURI) &&\r
+ localName.equals(((mir.util.xml.XMLName) anObject).localName);\r
+ }\r
+ else\r
+ return false;\r
+ }\r
+}\r
--- /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 any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, 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.xml;
+
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import java.util.Stack;
+
+import mir.util.ExceptionFunctions;
+import mir.util.xml.html.XMLHTMLParserProvider;
+
+public class XMLParserEngine {
+ private Map providers;
+ private XMLParserProvider defaultProvider;
+
+ private static XMLParserEngine instance = new XMLParserEngine();
+
+ public static XMLParserEngine getInstance() {
+ return instance;
+ }
+
+ private XMLParserEngine() {
+ providers = new HashMap();
+ defaultProvider = new XMLSAXParserProvider(false);
+ providers.put("xml", defaultProvider);
+ providers.put("xml.namespaceaware", new XMLSAXParserProvider(true));
+ providers.put("html", new XMLHTMLParserProvider());
+ }
+
+ /**
+ *
+ * @param aString
+ * @param aRootHandler
+ * @throws XMLParserFailure
+ * @throws XMLParserExc
+ */
+ public void parseString(String aProvider, String aString, SectionHandler aRootHandler) throws XMLParserFailure, XMLParserExc{
+ try {
+ parse(aProvider, new StringReader(aString), aRootHandler);
+ }
+ catch (Throwable t) {
+ throw new XMLParserFailure(t);
+ }
+ }
+
+ /**
+ *
+ * @param aFile
+ * @param aRootHandler
+ */
+ public void parse(String aProvider, File aFile, SectionHandler aRootHandler) throws XMLParserFailure, XMLParserExc {
+// filename = aFileName;
+
+ try {
+ parse(aProvider, new BufferedInputStream(new FileInputStream(aFile), 8192), aRootHandler);
+ }
+ catch (XMLParserExc e) {
+ throw e;
+ }
+ catch (Throwable t) {
+ throw new XMLParserFailure(t);
+ }
+ }
+
+ /**
+ *
+ * @param anInputStream
+ * @param aRootHandler
+ * @throws mir.util.xml.XMLParserFailure
+ * @throws mir.util.xml.XMLParserExc
+ */
+ public void parse(String aProvider, InputStream anInputStream, SectionHandler aRootHandler) throws XMLParserFailure, XMLParserExc{
+ parse(aProvider, new java.io.InputStreamReader(anInputStream), aRootHandler);
+ }
+
+ /**
+ *
+ * @param aRootHandler
+ * @throws mir.util.xml.XMLParserFailure
+ * @throws mir.util.xml.XMLParserExc
+ */
+ public void parse(String aProvider, java.io.Reader aReader, SectionHandler aRootHandler) throws XMLParserFailure, XMLParserExc{
+ XMLParserProvider provider = (XMLParserProvider) providers.get(aProvider);
+
+ if (provider==null)
+ provider = defaultProvider;
+
+ XMLParserRunner runner = new XMLParserRunner(aRootHandler);
+
+ try {
+ provider.parse(aReader, runner);
+ }
+ catch (Throwable e) {
+ Throwable t = ExceptionFunctions.traceCauseException(e);
+
+ if (t instanceof XMLParserExc && runner.getLocator()!=null) {
+ ((XMLParserExc) t).setLocation(runner.getLocator().getLineNr(), runner.getLocator().getColumnNr());
+ }
+
+ if (t instanceof XMLParserExc) {
+ throw (XMLParserExc) t;
+ }
+
+ if (t instanceof XMLParserFailure) {
+ throw (XMLParserFailure) t;
+ }
+
+ throw new XMLParserFailure(t);
+ }
+ }
+
+ public interface XMLLocator {
+ public int getLineNr();
+ public int getColumnNr();
+ }
+
+ public interface XMLParserReceiver {
+ /**
+ * Provides an object with which it's possible to track the parser's
+ * position.
+ */
+ public void setLocator(XMLLocator aLocator);
+
+ /**
+ * Extra document data, outside of tags and CDATA, will be passed verbatim
+ * to this method. This may include comments, DTDs, XML specifications,
+ * etc.
+ */
+ public void extra(String aPreAmble) throws XMLParserExc, XMLParserFailure;
+
+ public void startElement(XMLName anElement, Map anAttributes) throws XMLParserExc, XMLParserFailure;
+ public void endElement(XMLName anElement) throws XMLParserExc, XMLParserFailure;
+ public void startDocument() throws XMLParserExc, XMLParserFailure;
+ public void endDocument() throws XMLParserExc, XMLParserFailure;
+ public void text(String aText) throws XMLParserExc, XMLParserFailure;
+ }
+
+ public interface XMLParserProvider {
+ public void parse(java.io.Reader aReader, XMLParserReceiver aReceiver) throws XMLParserExc, XMLParserFailure;
+ }
+
+ private class XMLParserRunner implements XMLParserReceiver {
+ private SectionsManager manager;
+ private XMLLocator locator;
+ private SectionHandler rootHandler;
+
+ public XMLParserRunner(SectionHandler aRootHandler) {
+ super();
+
+ locator = null;
+ manager = new SectionsManager();
+ rootHandler = aRootHandler;
+ }
+
+ public void setLocator(XMLLocator aLocator) {
+ locator=aLocator;
+ }
+
+ public void extra(String anExtraData) throws XMLParserExc, XMLParserFailure {
+ SectionHandler handler = manager.currentHandler();
+
+ handler.extra(anExtraData);
+ }
+
+ public void startElement(XMLName anElement, Map anAttributes) throws XMLParserExc, XMLParserFailure {
+ SectionHandler handler = manager.currentHandler().startElement(anElement, anAttributes);
+
+ handler.startSection();
+
+ manager.pushHandler(handler);
+ }
+
+ public void endElement(XMLName anElement) throws XMLParserExc, XMLParserFailure {
+ SectionHandler handler = manager.popHandler();
+
+ handler.finishSection();
+
+ manager.currentHandler().endElement(handler);
+ }
+
+ public void startDocument() throws XMLParserExc, XMLParserFailure {
+ rootHandler.startSection();
+ manager.pushHandler(rootHandler);
+ }
+
+ public void endDocument() throws XMLParserExc, XMLParserFailure {
+ SectionHandler handler = manager.popHandler();
+
+ handler.finishSection();
+ }
+
+ public void text(String aText) throws XMLParserExc, XMLParserFailure {
+ manager.currentHandler().characters(aText);
+ }
+
+ public XMLLocator getLocator() {
+ return locator;
+ }
+ }
+
+ /**
+ *
+ * <p>Title: </p>
+ * <p>Description: </p>
+ * <p>Copyright: Copyright (c) 2003</p>
+ * <p>Company: </p>
+ * @author not attributable
+ * @version 1.0
+ */
+ private class SectionsManager {
+ Stack handlerStack;
+
+ public SectionsManager() {
+ handlerStack = new Stack();
+ }
+
+ public void pushHandler(SectionHandler aSectionHandler) {
+ handlerStack.push(aSectionHandler);
+ }
+
+ public SectionHandler popHandler() {
+ return (SectionHandler) handlerStack.pop();
+ }
+
+ public SectionHandler currentHandler() {
+ return (SectionHandler) handlerStack.peek();
+ }
+
+ public boolean isEmpty() {
+ return handlerStack.isEmpty();
+ }
+ }
+
+}
\ No newline at end of file
--- /dev/null
+package mir.util.xml;\r
+\r
+/**\r
+ * Exception during parsing with optional location information.\r
+ */\r
+\r
+public class XMLParserExc extends multex.Exc {\r
+ private boolean hasLocation;\r
+ private int lineNr;\r
+ private int columnNr;\r
+\r
+ public XMLParserExc(String aMessage) {\r
+ super(aMessage);\r
+ hasLocation = false;\r
+ }\r
+\r
+ protected void setLocation(int aLineNr, int aColumnNr) {\r
+ lineNr = aLineNr;\r
+ columnNr = aColumnNr;\r
+ hasLocation = true;\r
+ }\r
+\r
+ public boolean getHasLocation() {\r
+ return hasLocation;\r
+ }\r
+\r
+ public int getLineNr() {\r
+ return lineNr;\r
+ }\r
+\r
+ public int getColumnNr() {\r
+ return columnNr;\r
+ }\r
+}\r
--- /dev/null
+package mir.util.xml;\r
+\r
+/**\r
+ *\r
+ * <p>Title: </p>\r
+ * <p>Description: </p>\r
+ * <p>Copyright: Copyright (c) 2003</p>\r
+ * <p>Company: </p>\r
+ * @author not attributable\r
+ * @version 1.0\r
+ */\r
+public class XMLParserFailure extends multex.Failure {\r
+ public XMLParserFailure(String aMessage, Throwable aCause) {\r
+ super(aMessage, aCause);\r
+ }\r
+\r
+ public XMLParserFailure(Throwable aCause) {\r
+ super(aCause.getMessage(), aCause);\r
+ }\r
+}\r
--- /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 any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, 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.xml;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+public class XMLReaderTool {
+ public static void checkValidIdentifier(String anIdentifier) throws XMLParserExc {
+ }
+
+ public static String getStringAttributeWithDefault(java.util.Map anAttributes, String aKey, String aDefault) {
+ if (anAttributes.containsKey(aKey))
+ return (String) anAttributes.get(aKey);
+ else
+ return aDefault;
+ }
+
+ public static void checkIntegerAttribute(java.util.Map anAttributes, String aKey) throws XMLParserExc {
+ try {
+ Integer.parseInt((String) anAttributes.get(aKey));
+ }
+ catch (Throwable t) {
+ throw new XMLParserExc("attribute '"+aKey+"' is not an integer" );
+ }
+ }
+
+ public static int getIntegerAttributeWithDefault(java.util.Map anAttributes, String aKey, int aDefault) throws XMLParserExc {
+ if (anAttributes.containsKey(aKey)) {
+ checkIntegerAttribute(anAttributes, aKey);
+
+ return Integer.parseInt((String) anAttributes.get(aKey));
+ }
+ else
+ return aDefault;
+ }
+
+ public static void checkAttributes(java.util.Map anAttributes, String[] aRequiredAttributes, String[] anOptionalAttributes) throws XMLParserExc {
+ checkAttributeSet(anAttributes.keySet(),
+ new java.util.HashSet(java.util.Arrays.asList(aRequiredAttributes)),
+ new java.util.HashSet(java.util.Arrays.asList(anOptionalAttributes)));
+ }
+
+ public static void checkAttributeSet(java.util.Set aSet, java.util.Set aRequiredElements, java.util.Set anOptionalElements) throws XMLParserExc{
+ java.util.Iterator i;
+
+ i = aSet.iterator();
+ while (i.hasNext()) {
+ Object item = i.next();
+
+ if (!(aRequiredElements.contains(item) || anOptionalElements.contains(item)))
+ throw new XMLParserExc("unknown attribute '" + item + "'" );
+ }
+
+ i = aRequiredElements.iterator();
+ while (i.hasNext()) {
+ Object item = i.next();
+
+ if (!(aSet.contains(item)))
+ throw new XMLParserExc("missing required attribute '" + item + "'" );
+ }
+
+ }
+
+ /**
+ * Returns the namespace part of a qualified XML Tag name <br>
+ * Example:<br>
+ * <code>getPrefixFromQualifiedName("dc:creator");</code> <br>
+ * will return <code>"dc"</code>
+ */
+
+ public static String getPrefixFromQualifiedName(String aQualifiedName) {
+ java.util.List parts = mir.util.StringRoutines.splitString(aQualifiedName, ":");
+
+ if (parts.size()<=1)
+ return "";
+ else
+ return (String) parts.get(0);
+ }
+
+ /**
+ * Returns the localname part of a qualified XML Tag name <br>
+ * Example:<br>
+ * <code>getLocalNameFromQualifiedName("dc:creator");</code> <br>
+ * will return <code>"creator"</code>
+ */
+ public static String getLocalNameFromQualifiedName(String aQualifiedName) {
+ java.util.List parts = mir.util.StringRoutines.separateString(aQualifiedName, ":");
+
+ if (parts.size()<1)
+ return null;
+
+ if (parts.size()==1)
+ return (String) parts.get(0);
+ else
+ return (String) parts.get(1);
+ }
+
+ /**
+ * Creates an {@link XMLName} out of qualified name by splitting on the
+ * <code>:</code>.
+ */
+ public static XMLName getXMLNameForQualifiedName(String aQualifiedName) {
+ return new XMLName(
+ null,
+ getPrefixFromQualifiedName(aQualifiedName),
+ getLocalNameFromQualifiedName(aQualifiedName));
+ }
+
+ /**
+ * Turns a Map with {@link XMLName} keys into a map with {@link String} keys,
+ * by taking the <code>XMLName</code>'s local name
+ */
+ public static Map convertXMLAttributeMap(Map anXMLAttributeMap) {
+ Map result = new HashMap();
+
+ Iterator i = anXMLAttributeMap.entrySet().iterator();
+
+ while (i.hasNext()) {
+ Map.Entry entry = (Map.Entry) i.next();
+
+ result.put(
+ ((XMLName) entry.getKey()).getLocalName(),
+ entry.getValue());
+ }
+
+ return result;
+ }
+
+
+}
--- /dev/null
+package mir.util.xml;\r
+\r
+import java.util.*;\r
+\r
+import org.xml.sax.InputSource;\r
+import org.xml.sax.SAXException;\r
+import org.xml.sax.Locator;\r
+import mir.util.ExceptionFunctions;\r
+\r
+/**\r
+ *\r
+ * <p>Title: </p>\r
+ * <p>Description: </p>\r
+ * <p>Copyright: Copyright (c) 2003</p>\r
+ * <p>Company: </p>\r
+ * @author not attributable\r
+ * @version 1.0\r
+ */\r
+class XMLSAXParserProvider implements XMLParserEngine.XMLParserProvider {\r
+ private boolean nameSpaceAware;\r
+\r
+ public XMLSAXParserProvider(boolean aNameSpaceAware) {\r
+ nameSpaceAware = aNameSpaceAware;\r
+ }\r
+\r
+ public void parse(java.io.Reader aReader, XMLParserEngine.XMLParserReceiver aReceiver) throws XMLParserExc, XMLParserFailure {\r
+ try {\r
+ javax.xml.parsers.SAXParserFactory parserFactory = javax.xml.parsers.SAXParserFactory.newInstance();\r
+\r
+ parserFactory.setNamespaceAware(true);\r
+ parserFactory.setValidating(true);\r
+ javax.xml.parsers.SAXParser parser = parserFactory.newSAXParser();\r
+\r
+ parser.parse(new InputSource(aReader), new SAXHandler(aReceiver));\r
+ }\r
+ catch (org.xml.sax.SAXException e) {\r
+ Throwable t = ExceptionFunctions.traceCauseException(e);\r
+\r
+ if (t instanceof XMLParserExc) {\r
+ throw (XMLParserExc) t;\r
+ }\r
+\r
+ if (t instanceof XMLParserFailure) {\r
+ throw (XMLParserFailure) t;\r
+ }\r
+\r
+ throw new XMLParserFailure(t);\r
+ }\r
+ catch (Throwable t) {\r
+ throw new XMLParserFailure(t);\r
+ }\r
+ }\r
+\r
+ private class SAXHandler extends org.xml.sax.helpers.DefaultHandler {\r
+ private XMLParserEngine.XMLParserReceiver receiver;\r
+\r
+ public SAXHandler(XMLParserEngine.XMLParserReceiver aReceiver) throws XMLParserExc, XMLParserFailure {\r
+ super();\r
+\r
+ receiver = aReceiver;\r
+ receiver.startDocument();\r
+ }\r
+\r
+ public void setDocumentLocator(final Locator aLocator) {\r
+ receiver.setLocator(\r
+ new XMLParserEngine.XMLLocator() {\r
+ public int getLineNr() {\r
+ return aLocator.getLineNumber();\r
+ }\r
+\r
+ public int getColumnNr() {\r
+ return aLocator.getColumnNumber();\r
+ }\r
+ }\r
+ );\r
+ }\r
+\r
+ public void startElement(String aUri, String aLocalName, String aQualifiedName, org.xml.sax.Attributes anAttributes) throws org.xml.sax.SAXException {\r
+ try {\r
+ Map attributes = new java.util.HashMap();\r
+\r
+ XMLName tag;\r
+ if (nameSpaceAware) {\r
+ tag = new XMLName(aUri, XMLReaderTool.getPrefixFromQualifiedName(aQualifiedName), aLocalName);\r
+ for (int i=0; i<anAttributes.getLength(); i++)\r
+ attributes.put(\r
+ new XMLName(anAttributes.getURI(i),\r
+ XMLReaderTool.getPrefixFromQualifiedName(anAttributes.getQName(i)),\r
+ anAttributes.getLocalName(i)),\r
+ anAttributes.getValue(i));\r
+ }\r
+ else {\r
+ tag = new XMLName(aUri, XMLReaderTool.getPrefixFromQualifiedName(aQualifiedName),\r
+ XMLReaderTool.getLocalNameFromQualifiedName(aQualifiedName));\r
+ for (int i=0; i<anAttributes.getLength(); i++)\r
+ attributes.put(\r
+ new XMLName(anAttributes.getURI(i),\r
+ XMLReaderTool.getPrefixFromQualifiedName(anAttributes.getQName(i)),\r
+ XMLReaderTool.getLocalNameFromQualifiedName(anAttributes.getQName(i))),\r
+ anAttributes.getValue(i));\r
+ }\r
+\r
+ receiver.startElement(tag, attributes);\r
+ }\r
+ catch (XMLParserExc e) {\r
+ throw new org.xml.sax.SAXParseException(e.getMessage(), null, e);\r
+ }\r
+ catch (Exception e) {\r
+ throw new SAXException(e);\r
+ }\r
+ }\r
+\r
+ public void endElement(String aUri, String aLocalName, String aQualifiedName) throws org.xml.sax.SAXException {\r
+ try\r
+ {\r
+ XMLName element = new XMLName(aUri, XMLReaderTool.getPrefixFromQualifiedName(aQualifiedName), aLocalName);\r
+\r
+ receiver.endElement(element);\r
+ }\r
+ catch (XMLParserExc e) {\r
+ throw new org.xml.sax.SAXParseException(e.getMessage(), null, e);\r
+ }\r
+ catch (Exception e) {\r
+ throw new org.xml.sax.SAXException(e);\r
+ }\r
+ }\r
+\r
+ public void endDocument() throws org.xml.sax.SAXException {\r
+ try\r
+ {\r
+ receiver.endDocument();\r
+ }\r
+ catch (XMLParserExc e) {\r
+ throw new org.xml.sax.SAXParseException(e.getMessage(), null, e);\r
+ }\r
+ catch (Exception e) {\r
+ throw new org.xml.sax.SAXException(e);\r
+ }\r
+ }\r
+\r
+ public void characters(char[] aBuffer, int aStart, int anEnd) throws org.xml.sax.SAXException {\r
+ try {\r
+ String text = new String(aBuffer, aStart, anEnd);\r
+\r
+ receiver.text(text);\r
+ }\r
+ catch (XMLParserExc e) {\r
+ throw new org.xml.sax.SAXParseException(e.getMessage(), null, e);\r
+ }\r
+ catch (Exception e) {\r
+ throw new org.xml.sax.SAXException(e);\r
+ }\r
+ }\r
+ }\r
+}\r
--- /dev/null
+package mir.util.xml.html;
+
+import java.io.*;
+import java.util.*;
+
+/**
+ *
+ * TODO
+ * [x] selfclosing <br/> tags
+ * [ ] de-html-escaping of cdata, parameter values etc
+ * [ ] Smarter corrections
+ * [ ]
+ * [ ] case sensitivity optional
+ */
+
+public class HTMLParser {
+ private HTMLSchemaInformation schemaInformation;
+
+ public HTMLParser() {
+ schemaInformation = new HTMLSchemaInformation();
+ }
+
+ public void parse(Reader aReader, ParserReceiver aReceiver) throws HTMLParserExc, HTMLParserFailure, IOException {
+ HTMLScanner scanner;
+ CoreParser parser;
+ parser = new CoreParser(aReceiver);
+ scanner = new HTMLScanner(parser, aReader);
+ scanner.run();
+ }
+
+ private class CoreParser implements HTMLScanner.ScannerReceiver {
+ private ParserReceiver receiver;
+ private Stack tagStack;
+
+ public CoreParser(ParserReceiver aReceiver) {
+ receiver = aReceiver;
+ tagStack = new Stack();
+ }
+
+ public void handleDTD(String aDTD) throws HTMLParserExc {
+ receiver.dtd(aDTD);
+ }
+
+ public void handleOpenTag(String aTag, Map anAttributes) throws HTMLParserExc {
+ String lowercaseTag = aTag.toLowerCase();
+
+ HTMLSchemaInformation.HTMLTagInformation tagInformation =
+ schemaInformation.lookupTag(lowercaseTag);
+
+ if (tagInformation!=null) {
+ if (tagInformation.getIsBlock()) {
+ closeAllInlineTags();
+ }
+
+ closeAllAutoclosingTags(tagInformation);
+
+ Map attributes = new HashMap();
+
+ Iterator i = anAttributes.entrySet().iterator();
+ while (i.hasNext()) {
+ Map.Entry entry = (Map.Entry) i.next();
+
+ attributes.put(((String) entry.getKey()).toLowerCase(), entry.getValue());
+ }
+
+ receiver.openTag(lowercaseTag, attributes);
+ if (tagInformation.getHasBody()) {
+ tagStack.push(lowercaseTag);
+ }
+ else {
+ receiver.closeTag(lowercaseTag);
+ }
+ }
+ else {
+ tagStack.push(aTag);
+ }
+ }
+
+ public void handleClosingTag(String aTag) throws HTMLParserExc {
+ String lowercaseTag = aTag.toLowerCase();
+ String tag = aTag;
+
+ HTMLSchemaInformation.HTMLTagInformation tagInformation =
+ schemaInformation.lookupTag(lowercaseTag);
+
+ if (tagInformation!=null) {
+ tag = lowercaseTag;
+ if (tagInformation.getIsBlock()) {
+ closeAllInlineTags();
+ }
+ }
+
+ int index = tagStack.search(tag);
+
+ if (index>-1 && index<4) {
+ for (int i=0; i<index; i++) {
+ closeUpmostTag();
+ }
+ }
+ }
+
+ public void handleCData(String aData) throws HTMLParserExc {
+ receiver.cdata(aData);
+ }
+
+ public void handleComment(String aTag) throws HTMLParserExc {
+ receiver.comment(aTag);
+ }
+
+ public void handleEndOfStream() throws HTMLParserExc {
+ while (!tagStack.empty())
+ closeUpmostTag();
+ }
+
+ private void closeAllAutoclosingTags(HTMLSchemaInformation.HTMLTagInformation aTagInformation) throws HTMLParserExc {
+ while (!tagStack.empty()) {
+ String tag = (String) tagStack.peek();
+
+ if (aTagInformation.autoClose(tag)) {
+ closeUpmostTag();
+ }
+ else {
+ break;
+ }
+ }
+ }
+
+ private void closeAllInlineTags() throws HTMLParserExc {
+ while (!tagStack.empty()) {
+ HTMLSchemaInformation.HTMLTagInformation tagInformation =
+ schemaInformation.lookupTag((String) tagStack.peek());
+
+ if (tagInformation!=null && !tagInformation.getIsBlock()) {
+ closeUpmostTag();
+ }
+ else {
+ break;
+ }
+ }
+ }
+
+ private void closeUpmostTag() throws HTMLParserExc {
+ receiver.closeTag((String) tagStack.peek());
+ tagStack.pop();
+ }
+ }
+
+ public interface ParserReceiver {
+ public void dtd(String aDTD) throws HTMLParserExc;
+ public void openTag(String aTag, Map anAttributes) throws HTMLParserExc;
+ public void closeTag(String aTag) throws HTMLParserExc;
+ public void comment(String aData) throws HTMLParserExc;
+ public void cdata(String aData) throws HTMLParserExc;
+ }
+}
\ No newline at end of file
--- /dev/null
+package mir.util.xml.html;\r
+\r
+/**\r
+ * Exception during parsing with optional location information.\r
+ */\r
+\r
+public class HTMLParserExc extends multex.Exc {\r
+ private boolean hasLocation;\r
+ private int lineNr;\r
+ private int columnNr;\r
+\r
+ public HTMLParserExc(String aMessage) {\r
+ super(aMessage);\r
+ hasLocation = false;\r
+ }\r
+\r
+ protected void setLocation(int aLineNr, int aColumnNr) {\r
+ lineNr = aLineNr;\r
+ columnNr = aColumnNr;\r
+ hasLocation = true;\r
+ }\r
+\r
+ public boolean getHasLocation() {\r
+ return hasLocation;\r
+ }\r
+\r
+ public int getLineNr() {\r
+ return lineNr;\r
+ }\r
+\r
+ public int getColumnNr() {\r
+ return columnNr;\r
+ }\r
+}\r
--- /dev/null
+package mir.util.xml.html;\r
+\r
+/**\r
+ *\r
+ * <p>Title: </p>\r
+ * <p>Description: </p>\r
+ * <p>Copyright: Copyright (c) 2003</p>\r
+ * <p>Company: </p>\r
+ * @author not attributable\r
+ * @version 1.0\r
+ */\r
+public class HTMLParserFailure extends multex.Failure {\r
+ public HTMLParserFailure(String aMessage, Throwable aCause) {\r
+ super(aMessage, aCause);\r
+ }\r
+\r
+ public HTMLParserFailure(Throwable aCause) {\r
+ super(aCause.getMessage(), aCause);\r
+ }\r
+}\r
--- /dev/null
+package mir.util.xml.html;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.util.HashMap;
+import java.util.Map;
+
+public class HTMLScanner {
+ private ReaderWrapper reader;
+ private ScannerReceiver receiver;
+
+ public HTMLScanner(ScannerReceiver aReceiver, Reader aReader) {
+ reader = new ReaderWrapper(aReader);
+ receiver = aReceiver;
+ }
+
+ public interface ScannerReceiver {
+ public void handleDTD(String aDTD) throws HTMLParserExc;
+ public void handleOpenTag(String aTag, Map anAttributes) throws HTMLParserExc;
+ public void handleClosingTag(String aTag) throws HTMLParserExc;
+ public void handleCData(String aData) throws HTMLParserExc;
+ public void handleComment(String aTag) throws HTMLParserExc;
+ public void handleEndOfStream() throws HTMLParserExc;
+ }
+
+ public void run() throws IOException, HTMLParserExc {
+
+ while (!reader.isAtEnd()) {
+ char c = reader.peek();
+
+ if (c != '<')
+ readCData();
+ else {
+ reader.get();
+ c = reader.peek();
+
+ switch (c) {
+ case '!':
+ reader.get();
+ readSpecial();
+ break;
+ case '/':
+ reader.get();
+ readEndTag();
+ break;
+ default:
+ readTag();
+ }
+ }
+ }
+
+ receiver.handleEndOfStream();
+ }
+
+ private boolean isValidTagNameCharacter(char aCharacter) {
+ int type = Character.getType(aCharacter);
+
+ return
+ (type == Character.UPPERCASE_LETTER) ||
+ (type == Character.LOWERCASE_LETTER) ||
+ (type == Character.DECIMAL_DIGIT_NUMBER) ||
+ (aCharacter == '-') ||
+ (aCharacter == '_') ||
+ (aCharacter == ':');
+ }
+
+ private void skipWhiteSpace() throws IOException {
+ while (!reader.isAtEnd() && Character.isWhitespace(reader.peek())) {
+ reader.get();
+ }
+ }
+
+ private void readEndTag() throws IOException, HTMLParserExc {
+ StringBuffer result = new StringBuffer();
+
+ skipWhiteSpace();
+
+ while (!reader.isAtEnd() && isValidTagNameCharacter(reader.peek())) {
+ result.append(reader.get());
+ }
+
+ skipWhiteSpace();
+
+ if (!reader.isAtEnd() && reader.peek()=='>')
+ reader.get();
+
+ receiver.handleClosingTag(result.toString());
+ }
+
+ private String getName() throws IOException {
+ StringBuffer result = new StringBuffer();
+
+ skipWhiteSpace();
+
+ while (!reader.isAtEnd() && isValidTagNameCharacter(reader.peek())) {
+ result.append(reader.get());
+ }
+
+ if (result.length()==0)
+ return null;
+ else
+ return result.toString();
+ }
+
+ private String getAttributeValue() throws IOException {
+ StringBuffer result = new StringBuffer();
+
+ skipWhiteSpace();
+
+ if (!reader.isAtEnd()) {
+ if (reader.peek() == '\'' || reader.peek() == '\"') {
+ char boundary = reader.get();
+
+ while (!reader.isAtEnd() && reader.peek()!=boundary) {
+ result.append(reader.get());
+ }
+
+ if (!reader.isAtEnd() && reader.peek()==boundary)
+ reader.get();
+ }
+ else {
+ while (!reader.isAtEnd() && isValidTagNameCharacter(reader.peek())) {
+ result.append(reader.get());
+ }
+ }
+ }
+
+ return result.toString();
+ }
+
+ private void readTag() throws IOException, HTMLParserExc {
+ String tagName = getName();
+
+ Map attributes = new HashMap();
+
+ String attributeName = getName();
+ String attributeValue = null;
+
+ while (attributeName!=null) {
+ skipWhiteSpace();
+
+ if (!reader.isAtEnd() && reader.peek()=='=') {
+ reader.get();
+ attributeValue = getAttributeValue();
+ }
+
+ attributes.put(attributeName, attributeValue);
+
+ attributeName = getName();
+ }
+
+ boolean isClosed=false;
+
+ skipWhiteSpace();
+ if (!reader.isAtEnd() && reader.peek()=='/') {
+ isClosed = true;
+ reader.get();
+ }
+
+ skipWhiteSpace();
+ if (!reader.isAtEnd() && reader.peek()=='>') {
+ reader.get();
+ }
+
+ receiver.handleOpenTag(tagName, attributes);
+ if (isClosed)
+ receiver.handleClosingTag(tagName);
+ }
+
+ private void readSpecial() throws IOException, HTMLParserExc {
+ StringBuffer result = new StringBuffer();
+
+ if (!reader.isAtEnd() && reader.peek()=='-') {
+ reader.get();
+ if (!reader.isAtEnd() && reader.peek()=='-') {
+ reader.get();
+
+ while (!reader.isAtEnd()) {
+ if (reader.peek()=='-') {
+ reader.get();
+ if (!reader.isAtEnd() && reader.peek()=='-') {
+ reader.get();
+ break;
+ }
+ result.append('-');
+ }
+ if (!reader.isAtEnd())
+ result.append(reader.get());
+ }
+
+ skipWhiteSpace();
+
+ if (!reader.isAtEnd() && reader.peek()=='>')
+ reader.get();
+
+ receiver.handleComment(result.toString());
+
+ return;
+ }
+ else {
+ result.append('-');
+ }
+ }
+
+ while (!reader.isAtEnd() && reader.peek()!='>') {
+ result.append(reader.get());
+ }
+
+ if (!reader.isAtEnd() && reader.peek()=='>')
+ reader.get();
+
+ receiver.handleDTD("<!"+result.toString()+">");
+ }
+
+ private void readCData() throws IOException, HTMLParserExc {
+ StringBuffer result = new StringBuffer();
+
+ while (!reader.isAtEnd() && reader.peek()!='<') {
+ result.append(reader.get());
+ }
+
+ receiver.handleCData(result.toString());
+ }
+
+ /**
+ * Class to provide for a 1 character look-ahead on a reader
+ */
+ public static class ReaderWrapper {
+ private Reader reader;
+ private char buffer;
+ private boolean haveBuffer;
+
+ public ReaderWrapper(Reader aReader) {
+ reader = aReader;
+ haveBuffer = false;
+ }
+
+ /**
+ * Returns <code>true</code> if the stream contains no more characters.
+ */
+ public boolean isAtEnd() throws IOException {
+ fillBuffer();
+
+ return !haveBuffer;
+ }
+
+ /**
+ * Gets the next character from the reader but will not remove it from the
+ * stream.
+ * {@link #isAtEnd()} must return <code>false</code> before call this
+ * routine.
+ */
+ public char peek() throws IOException {
+ fillBuffer();
+
+ return buffer;
+ }
+
+ /**
+ * Gets the next character from the reader and removes it from the stream.
+ * {@link #isAtEnd()} must return <code>false</code> before call this
+ * routine.
+ */
+ public char get() throws IOException {
+ fillBuffer();
+ haveBuffer = false;
+
+ return buffer;
+ }
+
+ /**
+ * If the reader is not at it's end, then upon return, the buffer will
+ * be filled. If the buffer was already filled, then this method won't
+ * do anything.
+ */
+ public void fillBuffer() throws IOException {
+ if (!haveBuffer) {
+ int c = reader.read();
+
+ if (c!=-1) {
+ buffer = (char) c;
+ haveBuffer=true;
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+package mir.util.xml.html;
+
+import java.util.*;
+
+public class HTMLSchemaInformation {
+ private Map tags;
+
+ public HTMLSchemaInformation() {
+ tags = new HashMap();
+
+ addInlineTag("a");
+ addInlineTag("abbr");
+ addInlineTag("acronym");
+ addInlineTag("address");
+ addInlineTag("applet");
+ addInlineTag("area");
+ addInlineTag("b");
+ addInlineTag("base");
+ addInlineTag("basefont");
+ addInlineTag("bdo");
+ addInlineTag("big");
+ addInlineTag("blockquote");
+ addBlockTag("body", new String[] {"head"});
+ addBodylessTag("br");
+ addBodylessTag("button");
+ addInlineTag("caption");
+ addInlineTag("center");
+ addInlineTag("cite");
+ addInlineTag("code");
+ addInlineTag("col");
+ addInlineTag("colgroup");
+ addInlineTag("dd");
+ addInlineTag("del");
+ addInlineTag("dfn");
+ addInlineTag("dir");
+ addBlockTag("div");
+ addInlineTag("dl");
+ addInlineTag("dt");
+ addInlineTag("em");
+ addInlineTag("fieldset");
+ addInlineTag("font");
+ addBlockTag("form");
+ addBodylessTag("frame");
+ addInlineTag("frameset");
+ addInlineTag("h1");
+ addInlineTag("h2");
+ addInlineTag("h3");
+ addInlineTag("h4");
+ addInlineTag("h5");
+ addInlineTag("h6");
+ addBlockTag("head");
+ addBodylessTag("hr");
+ addBlockTag("html");
+ addInlineTag("i");
+ addBlockTag("iframe");
+ addBodylessTag("img");
+ addBodylessTag("input");
+ addInlineTag("ins");
+ addInlineTag("isindex");
+ addInlineTag("kbd");
+ addInlineTag("label");
+ addInlineTag("legend");
+ addInlineTag("li");
+ addInlineTag("link");
+ addInlineTag("map");
+ addInlineTag("menu");
+ addBodylessTag("meta");
+ addBlockTag("noframes");
+ addInlineTag("noscript");
+ addBodylessTag("object");
+ addInlineTag("ol");
+ addInlineTag("optgroup");
+ addInlineTag("option");
+ addBlockTag("p", new String[] {"p"});
+ addInlineTag("param");
+ addInlineTag("pre");
+ addInlineTag("q");
+ addInlineTag("s");
+ addInlineTag("samp");
+ addInlineTag("script");
+ addInlineTag("select");
+ addInlineTag("small");
+ addInlineTag("span");
+ addInlineTag("strike");
+ addInlineTag("strong");
+ addInlineTag("style");
+ addInlineTag("sub");
+ addInlineTag("sup");
+ addBlockTag("table");
+ addBlockTag("tbody");
+ addBlockTag("td", new String[] {"td", "th"});
+ addInlineTag("textarea");
+ addInlineTag("tfoot");
+ addBlockTag("th", new String[] {"td", "th"});
+ addInlineTag("thead");
+ addInlineTag("title");
+ addBlockTag("tr", new String[] {"td", "th", "tr"});
+ addInlineTag("tt");
+ addInlineTag("u");
+ addInlineTag("ul");
+ addInlineTag("var");
+ }
+
+ public HTMLTagInformation lookupTag(String aTag) {
+ return (HTMLTagInformation) tags.get(aTag);
+ }
+
+ public void addInlineTag(String aTagName) {
+ addTag(aTagName, false, true, null);
+ }
+
+ public void addBodylessTag(String aTagName) {
+ addTag(aTagName, false, false, null);
+ }
+
+ public void addBlockTag(String aTagName) {
+ addTag(aTagName, true, true, null);
+ }
+
+ public void addBlockTag(String aTagName, String[] anAutoCloseList) {
+ addTag(aTagName, true, true, anAutoCloseList);
+ }
+
+ public void addTag(String aTagName, boolean anIsBlock, boolean aHasBody, String[] anAutoCloseList) {
+ HTMLTagInformation tagInformation = new HTMLTagInformation(aTagName, anIsBlock, aHasBody);
+
+ if (anAutoCloseList!=null) {
+ for (int i = 0; i < anAutoCloseList.length; i++) {
+ tagInformation.addAutoClosedTag(anAutoCloseList[i]);
+ }
+ }
+
+ tags.put(aTagName, tagInformation);
+ }
+
+ public class HTMLTagInformation {
+ private boolean isBlock;
+ private boolean hasBody;
+ private String tagName;
+ private List autoCloseList;
+
+ public HTMLTagInformation(String aTagName, boolean anIsBlock, boolean aHasBody) {
+ hasBody = aHasBody;
+ isBlock = anIsBlock;
+ tagName = aTagName;
+ autoCloseList = new ArrayList();
+ }
+
+ void addAutoClosedTag(String aTag) {
+ autoCloseList.add(aTag);
+ }
+
+ public boolean autoClose(String aTag) {
+ return autoCloseList.contains(aTag);
+ }
+
+ public boolean getIsBlock() {
+ return isBlock;
+ }
+
+ public boolean getHasBody() {
+ return hasBody;
+ }
+
+ public String getTagName() {
+ return tagName;
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+package mir.util.xml.html;\r
+\r
+import java.io.IOException;\r
+import java.util.HashMap;\r
+import java.util.Iterator;\r
+import java.util.Map;\r
+\r
+import mir.util.xml.XMLParserEngine;\r
+import mir.util.xml.XMLParserExc;\r
+import mir.util.xml.XMLParserFailure;\r
+import mir.util.xml.XMLReaderTool;\r
+\r
+/**\r
+ */\r
+\r
+public class XMLHTMLParserProvider implements XMLParserEngine.XMLParserProvider {\r
+ public XMLHTMLParserProvider() {\r
+ }\r
+\r
+ public void parse(java.io.Reader aReader, final XMLParserEngine.XMLParserReceiver aReceiver) throws XMLParserExc, XMLParserFailure {\r
+ HTMLParser parser = new HTMLParser();\r
+\r
+ try {\r
+ aReceiver.startDocument();\r
+\r
+ parser.parse(aReader, new HTMLParser.ParserReceiver() {\r
+ public void dtd(String aDTD) throws HTMLParserExc {\r
+ try {\r
+ aReceiver.extra(aDTD);\r
+ }\r
+ catch (XMLParserExc t) {\r
+ throw new HTMLParserFailure(t);\r
+ }\r
+ }\r
+\r
+ public void openTag(String aTag, Map anAttributes) {\r
+ Map attributes = new HashMap();\r
+ Iterator i = anAttributes.entrySet().iterator();\r
+\r
+ while (i.hasNext()) {\r
+ Map.Entry entry = (Map.Entry) i.next();\r
+ attributes.put(\r
+ XMLReaderTool.getXMLNameForQualifiedName((String) entry.getKey()), entry.getValue());\r
+ }\r
+\r
+ try {\r
+ aReceiver.startElement(XMLReaderTool.getXMLNameForQualifiedName(aTag), attributes);\r
+ }\r
+ catch (XMLParserExc e) {\r
+ throw new HTMLParserFailure(e);\r
+ }\r
+ }\r
+\r
+ public void closeTag(String aTag) {\r
+ try {\r
+ aReceiver.endElement(XMLReaderTool.getXMLNameForQualifiedName(aTag));\r
+ }\r
+ catch (XMLParserExc e) {\r
+ throw new HTMLParserFailure(e);\r
+ }\r
+ }\r
+\r
+ public void comment(String aData) {\r
+ try {\r
+ aReceiver.extra(aData);\r
+ }\r
+ catch (XMLParserExc e) {\r
+ throw new HTMLParserFailure(e);\r
+ }\r
+ }\r
+\r
+ public void cdata(String aData) {\r
+ try {\r
+ aReceiver.text(aData);\r
+ }\r
+ catch (XMLParserExc e) {\r
+ throw new HTMLParserFailure(e);\r
+ }\r
+ }\r
+ });\r
+\r
+ aReceiver.endDocument();\r
+ }\r
+ catch (IOException e) {\r
+ throw new XMLParserFailure(e);\r
+ }\r
+ catch (HTMLParserExc e) {\r
+ throw new XMLParserFailure(e);\r
+ }\r
+ }\r
+}\r
-/*
- * 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.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Vector;
-
-import mir.config.MirPropertiesConfiguration;
-import mir.config.MirPropertiesConfiguration.PropertiesConfigExc;
-import mir.entity.adapter.EntityAdapter;
-import mir.log.LoggerWrapper;
-import mir.misc.ConfigException;
-import mircoders.accesscontrol.AccessControl;
-import mircoders.entity.EntityComment;
-import mircoders.entity.EntityContent;
-import mircoders.entity.EntityUsers;
-import mircoders.localizer.MirAdminInterfaceLocalizer;
-import mircoders.localizer.MirCachingLocalizerDecorator;
-import mircoders.localizer.MirLocalizer;
-
-public class MirGlobal {
- static private MirPropertiesConfiguration configuration;
- static private MirLocalizer localizer;
- static private ProducerEngine producerEngine;
- static private Abuse abuse;
- static private MRUCache mruCache;
- static private AccessControl accessControl;
- static private Map articleOperations;
- static private Map commentOperations;
- static private Map loggedInUsers = new HashMap();
- static private Map loggedInUserIds = new HashMap();
- static private LoggerWrapper logger = new LoggerWrapper("Global");
- static private LoggerWrapper adminUsageLogger = new LoggerWrapper("AdminUsage");
-
- public synchronized static MirLocalizer localizer() {
- String localizerClassName;
- Class localizerClass;
-
- if (localizer == null ) {
- localizerClassName = config().getString("Mir.Localizer", "mirlocal.localizer.basic.MirBasicLocalizer");
-
- try {
- localizerClass = Class.forName(localizerClassName);
- }
- catch (Throwable t) {
- throw new ConfigException("localizer class '" + localizerClassName + "' not found: " + t.toString());
- }
-
- if (!(MirLocalizer.class.isAssignableFrom(localizerClass)))
- throw new ConfigException("localizer class '" + localizerClassName + "' is not assignable from MirLocalizer");
-
- try {
- localizer = new MirCachingLocalizerDecorator((MirLocalizer) localizerClass.newInstance());
- }
- catch (Throwable t) {
- throw new ConfigException("localizer class '" + localizerClassName + "' cannot be instantiated: " + t.toString());
- }
- }
-
- return localizer;
- }
-
- public static Abuse abuse() {
- if (abuse==null) {
- synchronized(MirGlobal.class) {
- if (abuse==null)
- abuse = new Abuse();
- }
- }
-
- return abuse;
- }
-
- public static MirPropertiesConfiguration config() {
- try {
- return MirPropertiesConfiguration.instance();
- }
- catch (PropertiesConfigExc e) {
- throw new RuntimeException(e.getMessage());
- }
- }
-
- public static ProducerEngine producerEngine() {
- if (producerEngine == null) {
- producerEngine = new ProducerEngine();
- }
-
- return producerEngine;
- }
-
- public static MRUCache mruCache() {
- synchronized(MirGlobal.class) {
- if (mruCache == null) {
- mruCache = new MRUCache();
- }
- return mruCache;
- }
- }
-
- public static synchronized AccessControl accessControl() {
- if (accessControl == null) {
- accessControl=new AccessControl();
- }
-
- return accessControl;
- }
-
- public static void performArticleOperation(EntityUsers aUser, EntityContent anArticle, String anOperation) {
- MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = getArticleOperationForName(anOperation);
-
- try {
- EntityAdapter user = null;
- if (aUser!=null)
- user = localizer().dataModel().adapterModel().makeEntityAdapter("user", aUser);
-
- if (operation!=null)
- operation.perform(
- user,
- localizer().dataModel().adapterModel().makeEntityAdapter("content", anArticle));
- }
- catch (Throwable t) {
- t.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));
-
- throw new RuntimeException(t.toString());
- }
- }
-
- public static void performCommentOperation(EntityUsers aUser, EntityComment aComment, String anOperation) {
- MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = getCommentOperationForName(anOperation);
-
- try {
- EntityAdapter user = null;
- if (aUser!=null)
- user = localizer().dataModel().adapterModel().makeEntityAdapter("user", aUser);
-
- if (operation!=null)
- operation.perform(
- user,
- localizer().dataModel().adapterModel().makeEntityAdapter("comment", aComment));
- }
- catch (Throwable t) {
- throw new RuntimeException(t.toString());
- }
- }
-
- private synchronized static MirAdminInterfaceLocalizer.MirSimpleEntityOperation getArticleOperationForName(String aName) {
- try {
- if (articleOperations == null) {
- articleOperations = new HashMap();
- Iterator i = localizer().adminInterface().simpleArticleOperations().iterator();
- while (i.hasNext()) {
- MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next();
- articleOperations.put(operation.getName(), operation);
- }
- }
-
- return (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) articleOperations.get(aName);
- }
- catch (Throwable t) {
- throw new RuntimeException(t.toString());
- }
- }
-
- private synchronized static MirAdminInterfaceLocalizer.MirSimpleEntityOperation getCommentOperationForName(String aName) {
- try {
- if (commentOperations == null) {
- commentOperations = new HashMap();
- Iterator i = localizer().adminInterface().simpleCommentOperations().iterator();
- while (i.hasNext()) {
- MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next();
- commentOperations.put(operation.getName(), operation);
- }
- }
-
- return (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) commentOperations.get(aName);
- }
- catch (Throwable t) {
- throw new RuntimeException(t.toString());
- }
- }
-
- public static boolean isUserLoggedIn(String anId) {
- synchronized (loggedInUserIds) {
- return loggedInUserIds.containsKey(anId);
- }
- }
-
- public static List getLoggedInUsers() {
- List result = new Vector();
-
- synchronized (loggedInUsers) {
- Iterator i = loggedInUsers.entrySet().iterator();
-
- while (i.hasNext()) {
- Map.Entry entry = (Map.Entry) i.next();
-
- Map item = new HashMap();
- item.put("name", entry.getKey());
- item.put("count", entry.getValue());
- result.add(item);
- }
- }
-
- return result;
- }
-
- public static void registerLogin(String aName, String anId) {
- modifyLoggedInCount(aName, anId, 1);
- }
-
- public static void registerLogout(String aName, String anId) {
- modifyLoggedInCount(aName, anId, -1);
- }
-
- private static void modifyLoggedInCount(String aName, String anId, int aModifier) {
- synchronized (loggedInUsers) {
- Integer count = (Integer) loggedInUsers.get(aName);
- if (count==null)
- count = new Integer(0);
-
- if (count.intValue()+aModifier<=0) {
- loggedInUsers.remove(aName);
- }
- else {
- loggedInUsers.put(aName, new Integer(count.intValue() + aModifier));
- }
- }
-
- synchronized (loggedInUserIds) {
- Integer count = (Integer) loggedInUserIds.get(anId);
- if (count==null)
- count = new Integer(0);
-
- if (count.intValue()+aModifier<=0) {
- loggedInUserIds.remove(anId);
- }
- else {
- loggedInUserIds.put(anId, new Integer(count.intValue() + aModifier));
- }
- }
- }
-
- public static void logAdminUsage(EntityUsers aUser, String anObject, String aDescription) {
- try {
- if (config().getString("Mir.Admin.LogAdminActivity", "0").equals("1")) {
- String user = "unknown (" + aUser.toString() + ")";
- if (aUser != null)
- user = aUser.getValue("login");
- adminUsageLogger.info(user + " | " + anObject + " | " + aDescription);
- }
- }
- catch (Throwable t) {
- logger.error("Error while logging admin usage ("+aUser.toString()+", "+aDescription+"): " +t.toString());
- }
- }
-}
-
-
+/*\r
+ * Copyright (C) 2001, 2002 The Mir-coders group\r
+ *\r
+ * This file is part of Mir.\r
+ *\r
+ * Mir is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Mir is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with Mir; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+ *\r
+ * In addition, as a special exception, The Mir-coders gives permission to link\r
+ * the code of this program with any library licensed under the Apache Software License,\r
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library\r
+ * (or with modified versions of the above that use the same license as the above),\r
+ * and distribute linked combinations including the two. You must obey the\r
+ * GNU General Public License in all respects for all of the code used other than\r
+ * the above mentioned libraries. If you modify this file, you may extend this\r
+ * exception to your version of the file, but you are not obligated to do so.\r
+ * If you do not wish to do so, delete this exception statement from your version.\r
+ */\r
+\r
+package mircoders.global;\r
+\r
+import 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.config.MirPropertiesConfiguration.PropertiesConfigExc;\r
+import mir.entity.adapter.EntityAdapter;\r
+import mir.log.LoggerWrapper;\r
+import mir.misc.ConfigException;\r
+import mircoders.accesscontrol.AccessControl;\r
+import mircoders.entity.EntityComment;\r
+import mircoders.entity.EntityContent;\r
+import mircoders.entity.EntityUsers;\r
+import mircoders.localizer.MirAdminInterfaceLocalizer;\r
+import mircoders.localizer.MirCachingLocalizerDecorator;\r
+import mircoders.localizer.MirLocalizer;\r
+\r
+public class MirGlobal {\r
+ static private MirPropertiesConfiguration configuration;\r
+ static private MirLocalizer localizer;\r
+ static private ProducerEngine producerEngine;\r
+ static private Abuse abuse;\r
+ static private MRUCache mruCache;\r
+ static private AccessControl accessControl;\r
+ static private Map articleOperations;\r
+ static private Map commentOperations;\r
+ static private Map loggedInUsers = new HashMap();\r
+ static private Map loggedInUserIds = new HashMap();\r
+ static private LoggerWrapper logger = new LoggerWrapper("Global");\r
+ static private LoggerWrapper adminUsageLogger = new LoggerWrapper("AdminUsage");\r
+\r
+ public synchronized static MirLocalizer localizer() {\r
+ String localizerClassName;\r
+ Class localizerClass;\r
+\r
+ if (localizer == null ) {\r
+ localizerClassName = config().getString("Mir.Localizer", "mirlocal.localizer.basic.MirBasicLocalizer");\r
+\r
+ try {\r
+ localizerClass = Class.forName(localizerClassName);\r
+ }\r
+ catch (Throwable t) {\r
+ throw new ConfigException("localizer class '" + localizerClassName + "' not found: " + t.toString());\r
+ }\r
+\r
+ if (!(MirLocalizer.class.isAssignableFrom(localizerClass)))\r
+ throw new ConfigException("localizer class '" + localizerClassName + "' is not assignable from MirLocalizer");\r
+\r
+ try {\r
+ localizer = new MirCachingLocalizerDecorator((MirLocalizer) localizerClass.newInstance());\r
+ }\r
+ catch (Throwable t) {\r
+ throw new ConfigException("localizer class '" + localizerClassName + "' cannot be instantiated: " + t.toString());\r
+ }\r
+ }\r
+\r
+ return localizer;\r
+ }\r
+\r
+ public static String getStatus() {\r
+ StringBuffer result = new StringBuffer();\r
+\r
+ System.gc();\r
+ result.append(Runtime.getRuntime().freeMemory()).append("/");\r
+ result.append(Runtime.getRuntime().freeMemory()).append(" free memory | ");\r
+ result.append(Thread.currentThread().activeCount()).append(" active threads");\r
+\r
+ return result.toString();\r
+ }\r
+\r
+ public synchronized static Abuse abuse() {\r
+ if (abuse==null)\r
+ abuse = new Abuse();\r
+\r
+ return abuse;\r
+ }\r
+\r
+ public static MirPropertiesConfiguration config() {\r
+ try {\r
+ return MirPropertiesConfiguration.instance();\r
+ }\r
+ catch (PropertiesConfigExc e) {\r
+ throw new RuntimeException(e.getMessage());\r
+ }\r
+ }\r
+\r
+ public static ProducerEngine producerEngine() {\r
+ if (producerEngine == null) {\r
+ producerEngine = new ProducerEngine();\r
+ }\r
+\r
+ return producerEngine;\r
+ }\r
+\r
+ public static MRUCache mruCache() {\r
+ synchronized(MirGlobal.class) {\r
+ if (mruCache == null) {\r
+ mruCache = new MRUCache();\r
+ }\r
+ return mruCache;\r
+ }\r
+ }\r
+\r
+ public static synchronized AccessControl accessControl() {\r
+ if (accessControl == null) {\r
+ accessControl=new AccessControl();\r
+ }\r
+\r
+ return accessControl;\r
+ }\r
+\r
+ public static void performArticleOperation(EntityUsers aUser, EntityContent anArticle, String anOperation) {\r
+ MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = getArticleOperationForName(anOperation);\r
+\r
+ try {\r
+ EntityAdapter user = null;\r
+ if (aUser!=null)\r
+ user = localizer().dataModel().adapterModel().makeEntityAdapter("user", aUser);\r
+\r
+ if (operation!=null)\r
+ operation.perform(\r
+ user,\r
+ localizer().dataModel().adapterModel().makeEntityAdapter("content", anArticle));\r
+ }\r
+ catch (Throwable t) {\r
+ t.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));\r
+\r
+ throw new RuntimeException(t.toString());\r
+ }\r
+ }\r
+\r
+ public static void performCommentOperation(EntityUsers aUser, EntityComment aComment, String anOperation) {\r
+ MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = getCommentOperationForName(anOperation);\r
+\r
+ try {\r
+ EntityAdapter user = null;\r
+ if (aUser!=null)\r
+ user = localizer().dataModel().adapterModel().makeEntityAdapter("user", aUser);\r
+\r
+ if (operation!=null)\r
+ operation.perform(\r
+ user,\r
+ localizer().dataModel().adapterModel().makeEntityAdapter("comment", aComment));\r
+ }\r
+ catch (Throwable t) {\r
+ throw new RuntimeException(t.toString());\r
+ }\r
+ }\r
+\r
+ private synchronized static MirAdminInterfaceLocalizer.MirSimpleEntityOperation getArticleOperationForName(String aName) {\r
+ try {\r
+ if (articleOperations == null) {\r
+ articleOperations = new HashMap();\r
+ Iterator i = localizer().adminInterface().simpleArticleOperations().iterator();\r
+ while (i.hasNext()) {\r
+ MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next();\r
+ articleOperations.put(operation.getName(), operation);\r
+ }\r
+ }\r
+\r
+ return (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) articleOperations.get(aName);\r
+ }\r
+ catch (Throwable t) {\r
+ throw new RuntimeException(t.toString());\r
+ }\r
+ }\r
+\r
+ private synchronized static MirAdminInterfaceLocalizer.MirSimpleEntityOperation getCommentOperationForName(String aName) {\r
+ try {\r
+ if (commentOperations == null) {\r
+ commentOperations = new HashMap();\r
+ Iterator i = localizer().adminInterface().simpleCommentOperations().iterator();\r
+ while (i.hasNext()) {\r
+ MirAdminInterfaceLocalizer.MirSimpleEntityOperation operation = (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) i.next();\r
+ commentOperations.put(operation.getName(), operation);\r
+ }\r
+ }\r
+\r
+ return (MirAdminInterfaceLocalizer.MirSimpleEntityOperation) commentOperations.get(aName);\r
+ }\r
+ catch (Throwable t) {\r
+ throw new RuntimeException(t.toString());\r
+ }\r
+ }\r
+\r
+ public static boolean isUserLoggedIn(String anId) {\r
+ synchronized (loggedInUserIds) {\r
+ return loggedInUserIds.containsKey(anId);\r
+ }\r
+ }\r
+\r
+ public static List getLoggedInUsers() {\r
+ List result = new Vector();\r
+\r
+ synchronized (loggedInUsers) {\r
+ Iterator i = loggedInUsers.entrySet().iterator();\r
+\r
+ while (i.hasNext()) {\r
+ Map.Entry entry = (Map.Entry) i.next();\r
+\r
+ Map item = new HashMap();\r
+ item.put("name", entry.getKey());\r
+ item.put("count", entry.getValue());\r
+ result.add(item);\r
+ }\r
+ }\r
+\r
+ return result;\r
+ }\r
+\r
+ public static void registerLogin(String aName, String anId) {\r
+ modifyLoggedInCount(aName, anId, 1);\r
+ }\r
+\r
+ public static void registerLogout(String aName, String anId) {\r
+ modifyLoggedInCount(aName, anId, -1);\r
+ }\r
+\r
+ private static void modifyLoggedInCount(String aName, String anId, int aModifier) {\r
+ synchronized (loggedInUsers) {\r
+ Integer count = (Integer) loggedInUsers.get(aName);\r
+ if (count==null)\r
+ count = new Integer(0);\r
+\r
+ if (count.intValue()+aModifier<=0) {\r
+ loggedInUsers.remove(aName);\r
+ }\r
+ else {\r
+ loggedInUsers.put(aName, new Integer(count.intValue() + aModifier));\r
+ }\r
+ }\r
+\r
+ synchronized (loggedInUserIds) {\r
+ Integer count = (Integer) loggedInUserIds.get(anId);\r
+ if (count==null)\r
+ count = new Integer(0);\r
+\r
+ if (count.intValue()+aModifier<=0) {\r
+ loggedInUserIds.remove(anId);\r
+ }\r
+ else {\r
+ loggedInUserIds.put(anId, new Integer(count.intValue() + aModifier));\r
+ }\r
+ }\r
+ }\r
+\r
+ public static void logAdminUsage(EntityUsers aUser, String anObject, String aDescription) {\r
+ try {\r
+ if (config().getString("Mir.Admin.LogAdminActivity", "0").equals("1")) {\r
+ String user = "unknown (" + aUser.toString() + ")";\r
+ if (aUser != null)\r
+ user = aUser.getValue("login");\r
+ adminUsageLogger.info(user + " | " + anObject + " | " + aDescription);\r
+ }\r
+ }\r
+ catch (Throwable t) {\r
+ logger.error("Error while logging admin usage ("+aUser.toString()+", "+aDescription+"): " +t.toString());\r
+ }\r
+ }\r
+}\r
+\r
+\r
return producerFactories;
};
+ public ProducerFactory getFactoryForName(String aName) {
+ try {
+ factories();
+ }
+ catch (Throwable t) {
+ }
+
+ return (ProducerFactory) nameToFactory.get(aName);
+ }
+
protected void setupProducerNodeBuilderLibrary(ProducerNodeBuilderLibrary aLibrary) throws MirLocalizerFailure {
try {
DefaultProducerNodeBuilders.registerBuilders(
ProducerConfigReader reader;
ProducerNodeBuilderLibrary library = new ProducerNodeBuilderLibrary();
setupProducerNodeBuilderLibrary(library);
- List usedFiles = new Vector();
- Iterator i;
aFileMonitor.clear();
reader = new ProducerConfigReader();
- reader.parseFile(MirGlobal.config().getString("Home") + File.separatorChar + MirGlobal.config().getString("Mir.Localizer.ProducerConfigFile"), library, aFactories, usedFiles);
- i = usedFiles.iterator();
- while (i.hasNext())
- aFileMonitor.addFile((File) i.next());
- }
-
- public ProducerFactory getFactoryForName(String aName) {
- try {
- factories();
- }
- catch (Throwable t) {
- }
-
- return (ProducerFactory) nameToFactory.get(aName);
+ File inputFile = new File(MirGlobal.config().getString("Home"), MirGlobal.config().getString("Mir.Localizer.ProducerConfigFile"));
+ aFileMonitor.addFile(inputFile);
+ reader.parse(inputFile, library, aFactories);
}
}
* @param password The password
* @return The authenticated user, or <code>null</code> if the user
* doesn't exist, or the supplied password is invalid.
- * @throws ModuleException
+ * @throws ModuleExc
*/
public EntityUsers getUserForLogin(String user, String password) throws ModuleExc, ModuleFailure {
* Foundation, Inc., 59 Temple Place, Suite 330, 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.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, 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 mircoders.entity.EntityContent;
import mircoders.search.IndexUtil;
-
public class UnIndexingProducerNode implements ProducerNode {
private String contentKey;
private String indexPath;
-
public UnIndexingProducerNode(String aContentKey, String pathToIndex) {
contentKey = aContentKey;
indexPath=pathToIndex;
}
aLogger.info("UnIndexing " + (String) entity.getValue("id") + " out of " + index);
- IndexUtil.unindexEntity((EntityContent) entity,index);
-
+ IndexUtil.unindexEntity((EntityContent) entity, index);
}
catch (Throwable t) {
aLogger.error("Error while unindexing content: " + t.getMessage());
* Foundation, Inc., 59 Temple Place, Suite 330, 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.
+ * the code of this program with any library licensed under the Apache Software License,
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library
+ * (or with modified versions of the above that use the same license as the above),
+ * and distribute linked combinations including the two. You must obey the
+ * GNU General Public License in all respects for all of the code used other than
+ * the above mentioned libraries. If you modify this file, you may extend this
+ * exception to your version of the file, 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 mir.producer.reader.DefaultProducerNodeBuilders;
import mir.producer.reader.ProducerConfigExc;
import mir.producer.reader.ProducerNodeBuilderLibrary;
-import mir.util.XMLReader;
-import mir.util.XMLReaderTool;
+import mir.util.xml.XMLParserEngine;
+import mir.util.xml.XMLReaderTool;
+import mir.util.xml.XMLParserExc;
import mircoders.producer.ContentMarkingProducerNode;
import mircoders.producer.ContentModifyingProducerNode;
import mircoders.producer.IndexingProducerNode;
super(MARKER_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributes(anAttributes, MARKER_REQUIRED_ATTRIBUTES, MARKER_OPTIONAL_ATTRIBUTES);
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, MARKER_REQUIRED_ATTRIBUTES, MARKER_OPTIONAL_ATTRIBUTES);
key = (String) anAttributes.get(MARKER_KEY_ATTRIBUTE);
};
super(INDEXER_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributes(anAttributes, INDEXER_REQUIRED_ATTRIBUTES, INDEXER_OPTIONAL_ATTRIBUTES);
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, INDEXER_REQUIRED_ATTRIBUTES, INDEXER_OPTIONAL_ATTRIBUTES);
key = (String) anAttributes.get(INDEXER_KEY_ATTRIBUTE);
pathToIndex = (String) anAttributes.get(INDEXER_INDEX_ATTRIBUTE);
super(UNINDEXER_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributes(anAttributes, UNINDEXER_REQUIRED_ATTRIBUTES, UNINDEXER_OPTIONAL_ATTRIBUTES);
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, UNINDEXER_REQUIRED_ATTRIBUTES, UNINDEXER_OPTIONAL_ATTRIBUTES);
key = (String) anAttributes.get(UNINDEXER_KEY_ATTRIBUTE);
pathToIndex = (String) anAttributes.get(UNINDEXER_INDEX_ATTRIBUTE);
super(CONTENT_MODIFIER_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributes(anAttributes, CONTENT_MODIFIER_REQUIRED_ATTRIBUTES, CONTENT_MODIFIER_OPTIONAL_ATTRIBUTES);
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, CONTENT_MODIFIER_REQUIRED_ATTRIBUTES, CONTENT_MODIFIER_OPTIONAL_ATTRIBUTES);
key = (String) anAttributes.get(CONTENT_MODIFIER_KEY_ATTRIBUTE);
field = (String) anAttributes.get(CONTENT_MODIFIER_FIELD_ATTRIBUTE);
super(MEDIA_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributes(anAttributes, MEDIA_REQUIRED_ATTRIBUTES, MEDIA_OPTIONAL_ATTRIBUTES);
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, MEDIA_REQUIRED_ATTRIBUTES, MEDIA_OPTIONAL_ATTRIBUTES);
key = (String) anAttributes.get(MEDIA_KEY_ATTRIBUTE);
};
super(MARKER_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributes(anAttributes, MARKER_REQUIRED_ATTRIBUTES, MARKER_OPTIONAL_ATTRIBUTES);
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, MARKER_REQUIRED_ATTRIBUTES, MARKER_OPTIONAL_ATTRIBUTES);
key = (String) anAttributes.get(MARKER_KEY_ATTRIBUTE);
numLinesBetweenImages = (String) anAttributes.get(PDF_NUM_LINES_ATTRIBUTE);
super(MARKER_SUBNODES);
}
- public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLReader.XMLReaderExc {
- XMLReaderTool.checkAttributes(anAttributes, MARKER_REQUIRED_ATTRIBUTES, MARKER_OPTIONAL_ATTRIBUTES);
+ public void setAttributes(Map anAttributes) throws ProducerConfigExc, XMLParserExc {
+ mir.util.xml.XMLReaderTool.checkAttributes(anAttributes, MARKER_REQUIRED_ATTRIBUTES, MARKER_OPTIONAL_ATTRIBUTES);
generator = (String) anAttributes.get(PDF_GENERATOR_ATTRIBUTE);
destination = (String) anAttributes.get(PDF_DESTINATION_ATTRIBUTE);
-/*
- * 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.Locale;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import mir.config.MirPropertiesConfiguration;
-import mir.entity.adapter.EntityAdapter;
-import mir.generator.Generator;
-import mir.generator.GeneratorHelper;
-import mir.log.LoggerWrapper;
-import mir.servlet.ServletModuleExc;
-import mir.servlet.ServletModuleFailure;
-import mircoders.entity.EntityUsers;
-import mircoders.global.MirGlobal;
-
-
-public class ServletHelper {
- private static LoggerWrapper logger = new LoggerWrapper("ServletModule.Helper");
-
- public static Map makeGenerationData(HttpServletRequest aRequest, HttpServletResponse aResponse, Locale[] aLocales) throws ServletModuleExc {
- return makeGenerationData(aRequest, aResponse, aLocales, "bundles.adminlocal", "bundles.admin");
- }
-
- public static Map makeGenerationData(HttpServletRequest aRequest, HttpServletResponse aResponse, Locale[] aLocales, String aBundle) throws ServletModuleExc {
- return makeGenerationData(aRequest, aResponse, aLocales, aBundle, aBundle);
- }
-
- public static Map makeGenerationData(HttpServletRequest aRequest, HttpServletResponse aResponse, Locale[] aLocales, String aBundle, String aDefaultBundle) throws ServletModuleExc {
- try {
- MirPropertiesConfiguration configuration = MirPropertiesConfiguration.instance();
- Map result=GeneratorHelper.makeBasicGenerationData(aLocales,aBundle,aDefaultBundle);
- if (configuration.getString("Mir.Admin.ShowLoggedinUsers").equals("1")) {
- result.put("loggedinusers", MirGlobal.getLoggedInUsers());
- }
- else
- result.put("loggedinusers", null);
-
- // ML: hackish
- ((Map) result.get("config")).put("actionRoot",
- aResponse.encodeURL(MirGlobal.config().getString("RootUri") + "/servlet/Mir"));
-
- result.put("returnurl", null);
- result.put("login_user", getUserAdapter(aRequest));
-
- return result;
- }
- catch (Throwable t) {
- throw new ServletModuleFailure(t);
- }
- }
-
- public static void generateResponse(PrintWriter aWriter, Map aGenerationData, String aGenerator) throws ServletModuleExc {
- logger.debug("generator used: " + aGenerator);
-
- Generator generator;
-
- try {
- generator = MirGlobal.localizer().generators().makeAdminGeneratorLibrary().makeGenerator(aGenerator);
-
- generator.generate(aWriter, aGenerationData, logger);
- }
- catch (Throwable t) {
- throw new ServletModuleFailure(t);
- }
- }
-
- public static void generateOpenPostingResponse(PrintWriter aWriter, Map aGenerationData, String aGenerator) throws ServletModuleExc {
- Generator generator;
-
- try {
- generator = MirGlobal.localizer().generators().makeOpenPostingGeneratorLibrary().makeGenerator(aGenerator);
-
- generator.generate(aWriter, aGenerationData, logger);
- }
- catch (Throwable t) {
- throw new ServletModuleFailure(t);
- }
- }
-
- public static void redirect(HttpServletResponse aResponse, String aQuery) throws ServletModuleExc, ServletModuleFailure {
- try {
- aResponse.sendRedirect(aResponse.encodeRedirectURL(MirPropertiesConfiguration.instance().getString("RootUri") + "/servlet/Mir?"+aQuery));
- }
- catch (Throwable t) {
- throw new ServletModuleFailure("ServletModule.redirect: " +t.getMessage(), t);
- }
- }
-
- public static void redirect(HttpServletResponse aResponse, String aModule, String aMethod) throws ServletModuleExc, ServletModuleFailure {
- redirect(aResponse, "module="+aModule+"&do="+aMethod);
- }
-
- public static void setUser(HttpServletRequest aRequest, EntityUsers aUser) {
- if (aUser!=null)
- aRequest.getSession().setAttribute("login.uid", aUser);
- else
- aRequest.getSession().removeAttribute("login.uid");
- }
-
- public static EntityUsers getUser(HttpServletRequest aRequest) {
- return (EntityUsers) aRequest.getSession().getAttribute("login.uid");
- }
-
- public static EntityAdapter getUserAdapter(HttpServletRequest aRequest) {
- try {
- return MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter( "user", (EntityUsers) aRequest.getSession().getAttribute("login.uid"));
- }
- catch (Throwable t) {
- throw new ServletModuleFailure (t);
- }
- }
-
- public static String getUserName(HttpServletRequest aRequest) {
- EntityUsers user = getUser(aRequest);
-
- if (user!=null)
- return user.getValue("login");
- else
- return "nobody";
- }
-}
+/*\r
+ * Copyright (C) 2001, 2002 The Mir-coders group\r
+ *\r
+ * This file is part of Mir.\r
+ *\r
+ * Mir is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Mir is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with Mir; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+ *\r
+ * In addition, as a special exception, The Mir-coders gives permission to link\r
+ * the code of this program with any library licensed under the Apache Software License,\r
+ * The Sun (tm) Java Advanced Imaging library (JAI), The Sun JIMI library\r
+ * (or with modified versions of the above that use the same license as the above),\r
+ * and distribute linked combinations including the two. You must obey the\r
+ * GNU General Public License in all respects for all of the code used other than\r
+ * the above mentioned libraries. If you modify this file, you may extend this\r
+ * exception to your version of the file, but you are not obligated to do so.\r
+ * If you do not wish to do so, delete this exception statement from your version.\r
+ */\r
+package mircoders.servlet;\r
+\r
+import java.io.PrintWriter;\r
+import java.util.Locale;\r
+import java.util.Map;\r
+\r
+import javax.servlet.http.HttpServletRequest;\r
+import javax.servlet.http.HttpServletResponse;\r
+\r
+import mir.config.MirPropertiesConfiguration;\r
+import mir.entity.adapter.EntityAdapter;\r
+import mir.generator.Generator;\r
+import mir.generator.GeneratorHelper;\r
+import mir.log.LoggerWrapper;\r
+import mir.servlet.ServletModuleExc;\r
+import mir.servlet.ServletModuleFailure;\r
+import mircoders.entity.EntityUsers;\r
+import mircoders.global.MirGlobal;\r
+\r
+\r
+public class ServletHelper {\r
+ private static LoggerWrapper logger = new LoggerWrapper("ServletModule.Helper");\r
+\r
+ public static Map makeGenerationData(HttpServletRequest aRequest, HttpServletResponse aResponse, Locale[] aLocales) throws ServletModuleExc {\r
+ return makeGenerationData(aRequest, aResponse, aLocales, "bundles.adminlocal", "bundles.admin");\r
+ }\r
+\r
+ public static Map makeGenerationData(HttpServletRequest aRequest, HttpServletResponse aResponse, Locale[] aLocales, String aBundle) throws ServletModuleExc {\r
+ return makeGenerationData(aRequest, aResponse, aLocales, aBundle, aBundle);\r
+ }\r
+\r
+ public static Map makeGenerationData(HttpServletRequest aRequest, HttpServletResponse aResponse, Locale[] aLocales, String aBundle, String aDefaultBundle) throws ServletModuleExc {\r
+ try {\r
+ MirPropertiesConfiguration configuration = MirPropertiesConfiguration.instance();\r
+ Map result=GeneratorHelper.makeBasicGenerationData(aLocales,aBundle,aDefaultBundle);\r
+ if (configuration.getString("Mir.Admin.ShowLoggedinUsers").equals("1")) {\r
+ result.put("loggedinusers", MirGlobal.getLoggedInUsers());\r
+ }\r
+ else {\r
+ result.put("loggedinusers", null);\r
+ }\r
+ result.put("systemstatus", MirGlobal.getStatus());\r
+\r
+ // ML: hackish\r
+ ((Map) result.get("config")).put("actionRoot",\r
+ aResponse.encodeURL(MirGlobal.config().getString("RootUri") + "/servlet/Mir"));\r
+\r
+ result.put("returnurl", null);\r
+ result.put("login_user", getUserAdapter(aRequest));\r
+\r
+ return result;\r
+ }\r
+ catch (Throwable t) {\r
+ throw new ServletModuleFailure(t);\r
+ }\r
+ }\r
+\r
+ public static void generateResponse(PrintWriter aWriter, Map aGenerationData, String aGenerator) throws ServletModuleExc {\r
+ logger.debug("generator used: " + aGenerator);\r
+\r
+ Generator generator;\r
+\r
+ try {\r
+ generator = MirGlobal.localizer().generators().makeAdminGeneratorLibrary().makeGenerator(aGenerator);\r
+\r
+ generator.generate(aWriter, aGenerationData, logger);\r
+ }\r
+ catch (Throwable t) {\r
+ throw new ServletModuleFailure(t);\r
+ }\r
+ }\r
+\r
+ public static void generateOpenPostingResponse(PrintWriter aWriter, Map aGenerationData, String aGenerator) throws ServletModuleExc {\r
+ Generator generator;\r
+\r
+ try {\r
+ generator = MirGlobal.localizer().generators().makeOpenPostingGeneratorLibrary().makeGenerator(aGenerator);\r
+\r
+ generator.generate(aWriter, aGenerationData, logger);\r
+ }\r
+ catch (Throwable t) {\r
+ throw new ServletModuleFailure(t);\r
+ }\r
+ }\r
+\r
+ public static void redirect(HttpServletResponse aResponse, String aQuery) throws ServletModuleExc, ServletModuleFailure {\r
+ try {\r
+ aResponse.sendRedirect(aResponse.encodeRedirectURL(MirPropertiesConfiguration.instance().getString("RootUri") + "/servlet/Mir?"+aQuery));\r
+ }\r
+ catch (Throwable t) {\r
+ throw new ServletModuleFailure("ServletModule.redirect: " +t.getMessage(), t);\r
+ }\r
+ }\r
+\r
+ public static void redirect(HttpServletResponse aResponse, String aModule, String aMethod) throws ServletModuleExc, ServletModuleFailure {\r
+ redirect(aResponse, "module="+aModule+"&do="+aMethod);\r
+ }\r
+\r
+ public static void setUser(HttpServletRequest aRequest, EntityUsers aUser) {\r
+ if (aUser!=null)\r
+ aRequest.getSession().setAttribute("login.uid", aUser);\r
+ else\r
+ aRequest.getSession().removeAttribute("login.uid");\r
+ }\r
+\r
+ public static EntityUsers getUser(HttpServletRequest aRequest) {\r
+ return (EntityUsers) aRequest.getSession().getAttribute("login.uid");\r
+ }\r
+\r
+ public static EntityAdapter getUserAdapter(HttpServletRequest aRequest) {\r
+ try {\r
+ return MirGlobal.localizer().dataModel().adapterModel().makeEntityAdapter( "user", (EntityUsers) aRequest.getSession().getAttribute("login.uid"));\r
+ }\r
+ catch (Throwable t) {\r
+ throw new ServletModuleFailure (t);\r
+ }\r
+ }\r
+\r
+ public static String getUserName(HttpServletRequest aRequest) {\r
+ EntityUsers user = getUser(aRequest);\r
+\r
+ if (user!=null)\r
+ return user.getValue("login");\r
+ else\r
+ return "nobody";\r
+ }\r
+}\r
* 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.
+ * GNU General Public License for more details.f
*
* You should have received a copy of the GNU General Public License
* along with Mir; if not, write to the Free Software
* open-postings to the newswire
*
* @author mir-coders group
- * @version $Id: ServletModuleOpenIndy.java,v 1.89.2.9 2003/12/03 18:10:46 rk Exp $
+ * @version $Id: ServletModuleOpenIndy.java,v 1.89.2.10 2004/01/11 20:35:53 zapata Exp $
*
*/
*/
public void addposting(HttpServletRequest req, HttpServletResponse res)
- throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure
- {
+ throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure {
try {
if (MirGlobal.abuse().getOpenPostingDisabled()) {
openPostingDisabled(req, res);
extraInfo.put("languagePopUpData", DatabaseLanguage.getInstance().getPopupData());
extraInfo.put("themenPopupData", DatabaseTopics.getInstance().getPopupData());
- extraInfo.put("topics", topicsModule.getTopicsList());
deliver(req, res, mergeData, extraInfo, postingFormTemplate);
}
catch (Throwable t) {
queryString = queryString + " +" + videoFragment;
}
- if (queryString == null) {
+ if (queryString == null || queryString.length()==0) {
queryString = "";
}
else {
*/
public void getpdf(HttpServletRequest req, HttpServletResponse res)
- throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure {
- long starttime=System.currentTimeMillis();
+ throws ServletModuleExc, ServletModuleUserExc, ServletModuleFailure {
+ long starttime = System.currentTimeMillis();
String ID_REQUEST_PARAM = "id";
int maxArticlesInNewsleter = 15; // it is nice not to be dos'ed
try {
String idParam = req.getParameter(ID_REQUEST_PARAM);
if (idParam != null) {
+ RE re = new RE("[0-9]+");
- RE re = new RE("[0-9]+");
-
+ REMatch[] idMatches = re.getAllMatches(idParam);
- REMatch[] idMatches=re.getAllMatches(idParam);
+ String cacheSelector = "";
- String cacheSelector="";
-
- for (int i = 0; i < idMatches.length; i++){
- cacheSelector= cacheSelector + "," + idMatches[i].toString();
- }
+ for (int i = 0; i < idMatches.length; i++) {
+ cacheSelector = cacheSelector + "," + idMatches[i].toString();
+ }
- String cacheType="pdf";
+ String cacheType = "pdf";
- CacheKey theCacheKey = new CacheKey(cacheType,cacheSelector);
+ CacheKey theCacheKey = new CacheKey(cacheType, cacheSelector);
- byte[] thePDF;
+ byte[] thePDF;
- if (MirGlobal.mruCache().hasObject(theCacheKey)){
- logger.info("fetching pdf from cache");
- thePDF = (byte[]) MirGlobal.mruCache().getObject(theCacheKey);
- }
- else {
- logger.info("generating pdf and caching it");
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- PDFGenerator pdfMaker = new PDFGenerator(out);
-
- if (idMatches.length > 1){
- pdfMaker.addLine();
- for (int i = 0; i < idMatches.length && i < maxArticlesInNewsleter; i++){
- REMatch aMatch = idMatches[i];
- String id=aMatch.toString();
- EntityContent contentEnt = (EntityContent)contentModule.getById(id);
- pdfMaker.addIndexItem(contentEnt);
- }
- }
+ if (MirGlobal.mruCache().hasObject(theCacheKey)) {
+ logger.info("fetching pdf from cache");
+ thePDF = (byte[]) MirGlobal.mruCache().getObject(theCacheKey);
+ }
+ else {
+ logger.info("generating pdf and caching it");
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ PDFGenerator pdfMaker = new PDFGenerator(out);
+
+ if (idMatches.length > 1) {
+ pdfMaker.addLine();
+ for (int i = 0; i < idMatches.length && i < maxArticlesInNewsleter; i++) {
+ REMatch aMatch = idMatches[i];
+ String id = aMatch.toString();
+ EntityContent contentEnt = (EntityContent) contentModule.getById(id);
+ pdfMaker.addIndexItem(contentEnt);
+ }
+ }
- for (int i = 0; i < idMatches.length; i++){
- REMatch aMatch = idMatches[i];
- String id=aMatch.toString();
- EntityContent contentEnt = (EntityContent)contentModule.getById(id);
+ for (int i = 0; i < idMatches.length; i++) {
+ REMatch aMatch = idMatches[i];
+ String id = aMatch.toString();
+ EntityContent contentEnt = (EntityContent) contentModule.getById(id);
- pdfMaker.add(contentEnt);
- }
+ pdfMaker.add(contentEnt);
+ }
- pdfMaker.stop();
- thePDF = out.toByteArray();
+ pdfMaker.stop();
+ thePDF = out.toByteArray();
- //and save all our hard work!
- MirGlobal.mruCache().storeObject(theCacheKey,thePDF);
- }
+ //and save all our hard work!
+ MirGlobal.mruCache().storeObject(theCacheKey, thePDF);
+ }
- res.setContentType("application/pdf");
- res.setContentLength(thePDF.length);
- res.getOutputStream().write(thePDF);
- res.getOutputStream().flush();
- String elapsedtime=(new Long(System.currentTimeMillis()-starttime)).toString();
- logger.info("pdf retireval took "+elapsedtime + " milliseconds" );
+ res.setContentType("application/pdf");
+ res.setContentLength(thePDF.length);
+ res.getOutputStream().write(thePDF);
+ res.getOutputStream().flush();
+ String elapsedtime = (new Long(System.currentTimeMillis() - starttime)).toString();
+ logger.info("pdf retireval took " + elapsedtime + " milliseconds");
}
else {
- throw new ServletModuleExc("Missing id.");
+ throw new ServletModuleExc("Missing id.");
}
}
catch (Throwable t) {
logger.error(t.toString());
throw new ServletModuleFailure(t);
}
-
}
/**
*
- * <p>Title: </p>
- * <p>Description: </p>
- * <p>Copyright: Copyright (c) 2003</p>
- * <p>Company: </p>
- * @author not attributable
- * @version 1.0
+ *
*/
public class ServletModuleUsers extends ServletModule
{
int anOffset) throws ServletModuleExc {
// ML: to be deleted, support for 3 extra vars to be added
-
HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);
URLBuilder urlBuilder = new URLBuilder();
EntityAdapterModel model;
</table>
<hr>
<if loggedinusers>
- logged in:
- <list loggedinusers as u>
- ${u.name} (${u.count})
- </list>
+ <table cellpadding="3" cellspacing="0" width="100%">
+ <tr >
+ <td class="bg-neutral small" align="left">
+ <b>${lang("system.loggedin")}
+ <list loggedinusers as u>
+ ${u.name} (${u.count})
+ </list>
+ </b>
+ </td>
+ <td class="bg-neutral small" align="right">
+ <b>${lang("system.status")}
+ ${systemstatus}
+ </b>
+ </td>
+ </tr>
+ </table>
<hr>
</if>