// handle all
public void handle(PrintWriter htmlout, EntityUsers user, boolean force,boolean sync)
- throws StorageObjectException, ModuleException {
+ {
printHTML(htmlout, "Producer.All: started");
long sessionConnectTime = 0;
long startTime = (new java.util.Date()).getTime();
- //new ProducerImages().handle(htmlout, user, force,sync);
- new ProducerMedia().handle(htmlout, user, force,sync);
- new ProducerStartPage().handle(htmlout, user, force,sync);
- new ProducerContent().handle(htmlout, user, force,sync);
- new ProducerOpenPosting().handle(htmlout, user, force,sync);
- new ProducerTopics().handle(htmlout, user, force,sync);
- new ProducerNavigation().handle(htmlout, user, force,sync);
+
+ try {
+ //new ProducerImages().handle(htmlout, user, force,sync);
+ new ProducerMedia().handle(htmlout, user, force,sync);
+ } catch (Exception e) {
+ logHTML(htmlout, "Producer.All <font color=\"red\">ERROR:</font>"
+ +" in Producer.Media continuing "+ e.toString());
+ }
+ try {
+ new ProducerStartPage().handle(htmlout, user, force,sync);
+ } catch (Exception e) {
+ logHTML(htmlout, "Producer.All <font color=\"red\">ERROR:</font>"
+ +" in Producer.StartPage continuing "+ e.toString());
+ }
+ try {
+ new ProducerContent().handle(htmlout, user, force,sync);
+ } catch (Exception e) {
+ logHTML(htmlout, "Producer.All <font color=\"red\">ERROR:</font>"
+ +" in Producer.Content continuing "+ e.toString());
+ }
+ try {
+ new ProducerOpenPosting().handle(htmlout, user, force,sync);
+ } catch (Exception e) {
+ logHTML(htmlout, "Producer.All <font color=\"red\">ERROR:</font>"
+ +" in Producer.OpenPosting continuing "+ e.toString());
+ }
+ try {
+ new ProducerTopics().handle(htmlout, user, force,sync);
+ } catch (Exception e) {
+ logHTML(htmlout, "Producer.All <font color=\"red\">ERROR:</font>"
+ +" in Producer.Topics continuing "+ e.toString());
+ }
+ try {
+ new ProducerNavigation().handle(htmlout, user, force,sync);
+ } catch (Exception e) {
+ logHTML(htmlout, "Producer.All <font color=\"red\">ERROR:</font>"
+ +" in Producer.Navigation continuing "+ e.toString());
+ }
// Finish
sessionConnectTime = new java.util.Date().getTime() - startTime;
boolean first=true;
whereClause="is_published!=true AND to_article_type=0 AND id IN (";
for(int i=0; i < featureEntityList.size(); i++){
- if(first==false) {
- whereClause += ",";
- }
- EntityTopics currentTopic = (EntityTopics)featureEntityList.elementAt(i);
- EntityList contentEntityList = DatabaseContentToTopics.getInstance().getContent(currentTopic);
- whereClause += currentTopic.getId();
- fileDesc = currentTopic.getValue("filename").trim();
- setAdditional("topic",HTMLTemplateProcessor.makeSimpleHash(currentTopic));
+ try {
+ EntityTopics currentTopic = (EntityTopics)featureEntityList.elementAt(i);
+ EntityList contentEntityList = DatabaseContentToTopics.getInstance().getContent(currentTopic);
+ if(first==false) {
+ whereClause += ",";
+ }
+ whereClause += currentTopic.getId();
+ fileDesc = currentTopic.getValue("filename").trim();
+ setAdditional("topic",HTMLTemplateProcessor.makeSimpleHash(currentTopic));
+ } catch (Exception e) {
+ logHTML(htmlout, "problem with feature skipping");
+ }
first = false;
}
System.err.println(e.toString());
}
}
-}
\ No newline at end of file
+}
EntityImages currentImage;
EntityList batchEntityList;
- int contentBatchsize = Integer.parseInt(MirConfig.getProp("Producer.Content.Batchsize"));
- String imageHost = MirConfig.getProp("Producer.Image.Host");
- String imagePath = MirConfig.getProp("Producer.Image.Path");
- String iconPath = MirConfig.getProp("Producer.Image.IconPath");
+ int contentBatchsize = Integer.parseInt(MirConfig.getProp("Producer.Content.Batchsize"));
+ String imageHost = MirConfig.getProp("Producer.Image.Host");
+ String imagePath = MirConfig.getProp("Producer.Image.Path");
+ String iconPath = MirConfig.getProp("Producer.Image.IconPath");
// get batch of non-produced images, that are to be published
whereClause="is_published='1'";
theLog.printDebugInfo("trying image: " + i);
currentImage = (EntityImages)batchEntityList.elementAt(i);
+ try {
// make filenames
String date = currentImage.getValue("date");
productionPath = imagePath + "/" + imageFilename ;
currentImage.setValueForProperty("icon_path",iconFilename);
- //currentImage.setValueForProperty("publish_path","imc/germany/" + imageFilename);
- currentImage.setValueForProperty("publish_path",imageFilename);
+ currentImage.setValueForProperty("publish_path",imageFilename);
currentImage.setValueForProperty("publish_server", imageHost);
if (currentImage.getValue("icon_data")!= null && currentImage.getValue("image_data")!= null) {
}
}
- }
+ } catch (Exception e) {
+ logHTML(htmlout, "Producer.Images ERROR with: image ID " + currentImage.getId() + " <font color=\"Red\"> failed!</font>");
+ }
+ }//end for
// if next batch get it...
if (batchEntityList.hasNextBatch()){
}
-}
\ No newline at end of file
+}
EntityList currentMediaList = DatabaseContentToMedia.getInstance().getUploadedMedia(currentContent);
SimpleList contentList = (SimpleList)mergeData.get("contentlist");
SimpleHash contentHash = (SimpleHash)contentList.get(k);
- if (currentMediaList!=null && currentMediaList.getCount()>=1) {
+ if (currentMediaList!=null && currentMediaList.getCount()>=1) {
SimpleList mediaListAudio = new SimpleList();
SimpleList mediaListImages = new SimpleList();
SimpleList mediaListVideo = new SimpleList();
upMedia = currentMediaList.elementAt(n);
upMediaSimpleHash = HTMLTemplateProcessor.makeSimpleHash(upMedia);
mediaType = ((EntityMedia)upMedia).getMediaType();
- //must be a non-existant to_media_type entry..
- if (mediaType != null) {
- mediaHandlerName = mediaType.getValue("classname");
- mediaStorageName = mediaType.getValue("tablename");
- mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
- mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
- mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
- Method m = mediaStorageClass.getMethod("getInstance", null);
- mediaStorage = (Database)m.invoke(null, null);
- //we most likely need further info
- upMedia = mediaStorage.selectById(upMedia.getId());
- upMediaSimpleHash.put("url", mediaHandler.getListView(upMedia, mediaType));
- if (upMedia.getValue("is_published").equals("1")) {
- if (mediaHandler.isImage()) {
- mediaListImages.add(upMediaSimpleHash);
- } else if (mediaHandler.isAudio()) {
- mediaListAudio.add(upMediaSimpleHash);
- } else if (mediaHandler.isVideo()) {
- mediaListVideo.add(upMediaSimpleHash);
- } else {
- mediaListOther.add(upMediaSimpleHash);
- }
- } //end if is_published
- } //end if media_type != null
+ mediaHandlerName = mediaType.getValue("classname");
+ mediaStorageName = mediaType.getValue("tablename");
+ mediaStorageClass = Class.forName("mircoders.storage.Database"+mediaStorageName);
+ mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
+ mediaHandler = (MirMedia)mediaHandlerClass.newInstance();
+ Method m = mediaStorageClass.getMethod("getInstance", null);
+ mediaStorage = (Database)m.invoke(null, null);
+ //we most likely need further info
+ upMedia = mediaStorage.selectById(upMedia.getId());
+ upMediaSimpleHash.put("url", mediaHandler.getListView(upMedia, mediaType));
+ if (upMedia.getValue("is_published").equals("1")) {
+ if (mediaHandler.isImage()) {
+ mediaListImages.add(upMediaSimpleHash);
+ } else if (mediaHandler.isAudio()) {
+ mediaListAudio.add(upMediaSimpleHash);
+ } else if (mediaHandler.isVideo()) {
+ mediaListVideo.add(upMediaSimpleHash);
+ } else {
+ mediaListOther.add(upMediaSimpleHash);
+ }
+ } //end if is_published
} //end for
Entity currentMedia;
EntityList batchEntityList;
- int contentBatchsize = Integer.parseInt(MirConfig.getProp("Producer.Content.Batchsize"));
+ int contentBatchsize = Integer.parseInt(MirConfig.getProp("Producer.Content.Batchsize"));
// get batch of non-produced medias, that are to be published
whereClause="is_published='1'";
Entity currentMediaType = DatabaseUploadedMedia.getInstance().getMediaType(currentMedia);
String mediaHandlerName = currentMediaType.getValue("classname");
- theLog.printError("HANLDER"+mediaHandlerName);
Class mediaHandlerClass = Class.forName("mir.media.MediaHandler"+mediaHandlerName);
MirMedia currentMediaHandler = (MirMedia)mediaHandlerClass.newInstance();
iconProduced = produceFile(iconFilename, currentMediaHandler.getIcon(currentMedia), htmlout, true);
if(iconProduced) {
currentMedia.setValueForProperty("icon_path",iconFilename);
- logHTML(htmlout,"icon : " + iconFilename + (( iconProduced==true )? " succeded":" <font color=\"Red\" failed!</font>"));
+ logHTML(htmlout,"icon : " + iconFilename + (( iconProduced==true )? " succeded":" <font color=\"Red\"> failed!</font>"));
}
} else {
//now produce the media content
- theLog.printError("ABOUT OT MED"+id2);
mediaHost = currentMediaHandler.getPublishHost();
mediaPath = currentMediaHandler.getStoragePath();
id2 = currentMedia.getId();
theLog.printError("ABOUT OT FILE"+id2);
mediaProduced = produceFile(productionPath, currentMediaHandler.get(currentMedia, currentMediaType), htmlout, false);
- theLog.printError("FILED"+id2);
- logHTML(htmlout,"media: " + productionPath + ((mediaProduced==true)?" succeded":" <font color=\"Red\" failed!</font>"));
+ logHTML(htmlout,"media: " + productionPath + ((mediaProduced==true)?" succeded":" <font color=\"Red\"> failed!</font>"));
// update media-data
if (iconProduced && mediaProduced) {
currentMedia.setValueForProperty("is_produced", "1");
currentMedia.update();
}
-
+ } catch (MirMediaException e) {
+ theLog.printError("media exception: "+id+e.toString());
+ logHTML(htmlout, "problem with media id: "
+ +id+" <font color=\"Red\"> failed!</font>: "
+ +e.toString());
} catch (Exception e) {
theLog.printError("failed in reflection: "+id+e.toString());
+ logHTML(htmlout, "reflection problem in media id: "
+ +id+" <font color=\"Red\"> failed!</font>: "
+ +e.toString());
}
}
public void handle(PrintWriter htmlout, EntityUsers user, boolean forced, boolean sync)
throws mir.module.ModuleException, mir.storage.StorageObjectException {
- printHTML(htmlout, "Producer.Navigation: started");
+ printHTML(htmlout, "Producer.Navigation: started");
long sessionConnectTime = 0;
long startTime = (new java.util.Date()).getTime();
EntityList entityList;
SimpleHash naviPageModel;
- // get the imclinks
- entityList = linksImcsModule.getByWhereClause("", "sortpriority, title", -1);
- SimpleList imcList = HTMLTemplateProcessor.makeSimpleList(entityList);
+ // get the imclinks
+ entityList = linksImcsModule.getByWhereClause("", "sortpriority, title", -1);
+ SimpleList imcList = HTMLTemplateProcessor.makeSimpleList(entityList);
- EntityList theParentList = linksImcsModule.getByWhereClause("to_parent_id=NULL", "sortpriority, title", -1);
- SimpleList parentList = HTMLTemplateProcessor.makeSimpleList(theParentList);
+ EntityList theParentList = linksImcsModule.getByWhereClause("to_parent_id=NULL", "sortpriority, title", -1);
+ SimpleList parentList = HTMLTemplateProcessor.makeSimpleList(theParentList);
// put the informations into the navipagemodel
naviPageModel = new SimpleHash();
naviPageModel.put("topics", topicsModule.getTopicsList());
- naviPageModel.put("imclist", imcList);
- naviPageModel.put("parentlist", parentList);
+ naviPageModel.put("imclist", imcList);
+ naviPageModel.put("parentlist", parentList);
htmlFileName = producerDocRoot + "/navigation.inc";
}
}
-}
\ No newline at end of file
+}
public class ProducerOpenPosting extends ProducerList {
- public void setAdditional(String key, TemplateModel value) {
- additional.put(key,value);
- }
+ public void setAdditional(String key, TemplateModel value) {
+ additional.put(key,value);
+ }
public void handle(PrintWriter htmlout, EntityUsers user, boolean force, boolean sync)
throws StorageObjectException, ModuleException {
setAdditional("topicslist",topicsModule.getTopicsList());
setAdditional("title",title);
- handleIt(htmlout,user,force);
- }
+ handleIt(htmlout,user,force);
+ }
public static void main(String argv[]){
try {
System.err.println(e.toString());
}
}
-}
\ No newline at end of file
+}
for(int i=0; i < topicsEntityList.size(); i++){
EntityTopics currentTopic = (EntityTopics)topicsEntityList.elementAt(i);
+
+ try {
EntityList contentEntityList = DatabaseContentToTopics.getInstance().getContent(currentTopic);
String whereClauseSpecial=null;
setAdditional("special",specialHash);
} catch (Exception e) {
- theLog.printError("ProducerTopics: problem with start special: "+currentContent.getId()+" "+e.toString());
- logHTML(htmlout,"ProducerTopics: problem with start special: "+currentContent.getId()+" "+e.toString());
+ theLog.printError("ProducerTopics: problem with start special media: "+currentContent.getId()+" "+e.toString()+" <font color=\"red\">skipping</font>");
+ logHTML(htmlout,"ProducerTopics: problem with start special media: "+currentContent.getId()+" "+e.toString());
}
}
handleIt(htmlout,user,force);
}
+ } catch (Exception e) {
+ logHTML(htmlout,"ProducerTopics: problem with topic id: "
+ +currentTopic.getId()+ "<font color=\"red\">skipping</font>");
+ }
}
}