throw new ProducerFailure(t.getMessage(), t);
}
}
+}
+
+
+/*
+
- public Set buildVerbSet() {
- return new HashSet();
+ abstract Database getStorage() throws StorageObjectException;
+
+ public void handle(PrintWriter htmlout, EntityUsers user, boolean force,
+ boolean sync) throws StorageObjectException, ModuleException {
+ handle(htmlout,user,force,sync,null);
}
-}
+
+ public void handle(PrintWriter htmlout,EntityUsers user,boolean force,
+ boolean sync, String id) throws StorageObjectException, ModuleException
+ {
+ long sessionConnectTime = 0;
+ long startTime = (new java.util.Date()).getTime();
+ String whereClause;
+ String orderBy;
+ Entity currentMedia;
+ MirMedia currentMediaHandler;
+ EntityList batchEntityList;
+
+ int contentBatchsize =
+ Integer.parseInt(MirConfig.getProp("Producer.Content.Batchsize"));
+ orderBy = "date desc, webdb_lastchange desc";
+
+ // get batch of non-produced medias, that are to be published
+ whereClause="is_published='1'";
+ if (id!= null) {
+ whereClause += " and id="+id;
+ // optimization to avoid select count(*)..
+ contentBatchsize = -1;
+ }
+ if (force==false) whereClause += " and is_produced='0'";
+
+ batchEntityList = getStorage().selectByWhereClause(whereClause,
+ orderBy, 0, contentBatchsize);
+
+ while (batchEntityList != null) {
+ for(int i=0;i<batchEntityList.size();i++) {
+ currentMedia = (Entity)batchEntityList.elementAt(i);
+ try {
+ Entity currentMediaType =
+ DatabaseUploadedMedia.getInstance().getMediaType(currentMedia);
+ currentMediaHandler = MediaHelper.getHandler( currentMediaType );
+
+ // now produce
+ currentMediaHandler.produce(currentMedia,currentMediaType);
+ currentMedia.setValueForProperty("publish_server",
+ currentMediaHandler.getPublishHost());
+ currentMedia.setValueForProperty("icon_is_produced", "1");
+ currentMedia.setValueForProperty("is_produced", "1");
+ currentMedia.update();
+ logHTML(htmlout,"produced media id "+currentMedia.getId()
+ +": "+currentMediaType.getValue("mime_type")+" success");
+ } catch (Exception e) {
+ // don't throw and exception here, just log.
+ // we don't want to make the admin interface unuseable
+ theLog.printError("media exception: "+currentMedia.getId()+
+ e.toString());
+ logHTML(htmlout, "problem with media id: "+currentMedia.getId()+
+ " <font color=\"Red\"> failed!</font>: "+e.toString());
+ e.printStackTrace(htmlout);
+ }
+ }
+
+ // if next batch get it...
+ if (batchEntityList.hasNextBatch()){
+ batchEntityList = uploadedMediaModule.getByWhereClause(whereClause,
+ orderBy, batchEntityList.getNextBatch(),contentBatchsize);
+ } else {
+ batchEntityList=null;
+ }
+ }
+ // Finish
+ sessionConnectTime = new java.util.Date().getTime() - startTime;
+ logHTML(htmlout, "Producer.Media finished: " + sessionConnectTime + " ms.");
+ }
+*/