ContainsWritable() 공개 메소드

public ContainsWritable ( ) : bool
리턴 bool
 /**
  * Called in <code>open</code>, <code>content</code> and <code>close</code> to pass the {@link Writable}s to the handler
  * @param po
  */
 private void Consume(IWorkerContext context, ProcessObject po) {
     if (po.ContainsWritable()) {
         IWritable w = null;
         while ( null != (w =po.Poll())) {
             handler.Add(w);
         }
     }
 }
예제 #2
0
 /**
  * @param po
  * @throws PipelineException
  */
 private void Write(IWorkerContext context, ProcessObject po) {
     MapContext mp = (MapContext)GetLocalContext(context);
     if (po.ContainsWritable()) {
         Document doc = (Document) mp[DOCUMENT];
         bool continuousWrite = (bool) mp[CONTINUOUS];
         IWritable writable = null;
         while (null != (writable = po.Poll())) {
             if (writable is WritableElement) {
                 foreach (IElement e in ((WritableElement) writable).Elements()) {
                     try {
                         if (!doc.Add(e)) {
                             LOG.Trace(String.Format(
                                     LocaleMessages.GetInstance().GetMessage(LocaleMessages.ELEMENT_NOT_ADDED),
                                     e.ToString()));
                         }
                     } catch (DocumentException e1) {
                         if (!continuousWrite) {
                             throw new PipelineException(e1);
                         } else {
                             LOG.Error(
                                     LocaleMessages.GetInstance().GetMessage(LocaleMessages.ELEMENT_NOT_ADDED_EXC),
                                     e1);
                         }
                     }
                 }
             }
         }
     }
 }