2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.dmaap.dbcapi.aaf.client;
23 import java.io.BufferedReader;
24 import java.io.IOException;
25 import java.io.InputStream;
26 import java.io.InputStreamReader;
27 import java.io.OutputStream;
28 import java.net.ConnectException;
29 import java.net.ProtocolException;
30 import java.net.SocketException;
32 import java.util.ArrayList;
34 import javax.net.ssl.HttpsURLConnection;
36 import org.apache.log4j.Logger;
37 import org.apache.log4j.PropertyConfigurator;
38 import org.onap.dmaap.dbcapi.logging.BaseLoggingClass;
39 import org.onap.dmaap.dbcapi.logging.DmaapbcLogMessageEnum;
40 import org.onap.dmaap.dbcapi.model.ApiError;
41 import org.onap.dmaap.dbcapi.model.DR_Pub;
42 import org.onap.dmaap.dbcapi.model.DR_Sub;
43 import org.onap.dmaap.dbcapi.model.Feed;
44 import org.onap.dmaap.dbcapi.service.DmaapService;
45 import org.onap.dmaap.dbcapi.util.RandomInteger;
49 public class DrProvConnection extends BaseLoggingClass {
52 private String provURL;
54 private HttpsURLConnection uc;
57 public DrProvConnection() {
58 provURL = new DmaapService().getDmaap().getDrProvUrl();
59 if ( provURL.length() < 1 ) {
60 errorLogger.error( DmaapbcLogMessageEnum.PREREQ_DMAAP_OBJECT, "getDrProvUrl");
65 public boolean makeFeedConnection() {
66 return makeConnection( provURL );
68 public boolean makeFeedConnection(String feedId) {
69 return makeConnection( provURL + "/feed/" + feedId );
71 public boolean makeSubPostConnection( String subURL ) {
72 String[] parts = subURL.split("/");
73 String revisedURL = provURL + "/" + parts[3] + "/" + parts[4];
74 logger.info( "mapping " + subURL + " to " + revisedURL );
75 return makeConnection( revisedURL );
77 public boolean makeSubPutConnection( String subId ) {
78 String revisedURL = provURL + "/subs/" + subId;
79 logger.info( "mapping " + subId + " to " + revisedURL );
80 return makeConnection( revisedURL );
83 public boolean makeIngressConnection( String feed, String user, String subnet, String nodep ) {
84 String uri = String.format("/internal/route/ingress/?feed=%s&user=%s&subnet=%s&nodepatt=%s",
85 feed, user, subnet, nodep );
86 return makeConnection( provURL + uri );
88 public boolean makeEgressConnection( String sub, String nodep ) {
89 String uri = String.format("/internal/route/egress/?sub=%s&node=%s",
91 return makeConnection( provURL + uri );
93 public boolean makeNodesConnection( String varName ) {
95 String uri = String.format("/internal/api/%s", varName);
96 return makeConnection( provURL + uri );
99 public boolean makeNodesConnection( String varName, String val ) {
104 String cv = val.replaceAll("\\|", "%7C");
105 String uri = String.format( "/internal/api/%s?val=%s", varName, cv );
107 return makeConnection( provURL + uri );
110 private boolean makeConnection( String pURL ) {
113 URL u = new URL( pURL );
114 uc = (HttpsURLConnection) u.openConnection();
115 uc.setInstanceFollowRedirects(false);
116 logger.info( "successful connect to " + pURL );
118 } catch (Exception e) {
119 errorLogger.error( DmaapbcLogMessageEnum.HTTP_CONNECTION_ERROR, pURL, e.getMessage() );
126 public String bodyToString( InputStream is ) {
127 logger.info( "is=" + is );
128 StringBuilder sb = new StringBuilder();
129 BufferedReader br = new BufferedReader( new InputStreamReader(is));
132 while ((line = br.readLine()) != null ) {
135 } catch (IOException ex ) {
136 errorLogger.error( DmaapbcLogMessageEnum.IO_EXCEPTION, ex.getMessage());
139 return sb.toString();
143 public String doPostFeed( Feed postFeed, ApiError err ) {
145 byte[] postData = postFeed.getBytes();
146 logger.info( "post fields=" + postData.toString() );
147 String responsemessage = null;
148 String responseBody = null;
151 logger.info( "uc=" + uc );
152 uc.setRequestMethod("POST");
153 uc.setRequestProperty("Content-Type", "application/vnd.att-dr.feed");
154 uc.setRequestProperty( "charset", "utf-8");
155 uc.setRequestProperty( "X-ATT-DR-ON-BEHALF-OF", postFeed.getOwner() );
156 uc.setRequestProperty( "Content-Length", Integer.toString( postData.length ));
157 uc.setUseCaches(false);
158 uc.setDoOutput(true);
159 OutputStream os = null;
164 os = uc.getOutputStream();
165 os.write( postData );
167 } catch (ProtocolException pe) {
168 // Rcvd error instead of 100-Continue
170 // work around glitch in Java 1.7.0.21 and likely others
171 // without this, Java will connect multiple times to the server to run the same request
172 uc.setDoOutput(false);
173 } catch (Exception e) {
176 rc = uc.getResponseCode();
177 logger.info( "http response code:" + rc );
178 responsemessage = uc.getResponseMessage();
179 logger.info( "responsemessage=" + responsemessage );
182 if (responsemessage == null) {
183 // work around for glitch in Java 1.7.0.21 and likely others
184 // When Expect: 100 is set and a non-100 response is received, the response message is not set but the response code is
185 String h0 = uc.getHeaderField(0);
187 int i = h0.indexOf(' ');
188 int j = h0.indexOf(' ', i + 1);
189 if (i != -1 && j != -1) {
190 responsemessage = h0.substring(j + 1);
195 responseBody = bodyToString( uc.getInputStream() );
196 logger.info( "responseBody=" + responseBody );
200 err.setMessage(responsemessage);
203 } catch (ConnectException ce) {
204 errorLogger.error(DmaapbcLogMessageEnum.HTTP_CONNECTION_EXCEPTION, provURL, ce.getMessage() );
206 err.setMessage("Backend connection refused");
207 } catch (SocketException se) {
208 errorLogger.error( DmaapbcLogMessageEnum.SOCKET_EXCEPTION, se.getMessage(), "response from prov server" );
210 err.setMessage( "Unable to read response from DR");
211 } catch (Exception e) {
212 logger.warn("Unable to read response " );
215 err.setCode( uc.getResponseCode());
216 err.setMessage(uc.getResponseMessage());
217 } catch (Exception e2) {
219 err.setMessage("Unable to determine response message");
225 } catch ( Exception e ) {}
232 // the POST for /internal/route/ingress doesn't return any data, so needs a different function
233 // the POST for /internal/route/egress doesn't return any data, so needs a different function
234 public int doXgressPost( ApiError err ) {
236 String responsemessage = null;
240 uc.setRequestMethod("POST");
241 // uc.setRequestProperty("Content-Type", "application/vnd.att-dr.feed");
242 // uc.setRequestProperty( "charset", "utf-8");
243 // uc.setRequestProperty( "X-ATT-DR-ON-BEHALF-OF", postFeed.getOwner() );
244 // uc.setRequestProperty( "Content-Length", Integer.toString( postData.length ));
245 // uc.setUseCaches(false);
246 // uc.setDoOutput(true);
247 OutputStream os = null;
252 os = uc.getOutputStream();
255 } catch (ProtocolException pe) {
256 // Rcvd error instead of 100-Continue
258 // work around glitch in Java 1.7.0.21 and likely others
259 // without this, Java will connect multiple times to the server to run the same request
260 uc.setDoOutput(false);
261 } catch (Exception e) {
264 rc = uc.getResponseCode();
265 logger.info( "http response code:" + rc );
266 responsemessage = uc.getResponseMessage();
267 logger.info( "responsemessage=" + responsemessage );
271 if (rc < 200 || rc >= 300 ) {
273 err.setMessage(responsemessage);
275 } catch (Exception e) {
276 System.err.println("Unable to read response " );
281 } catch ( Exception e ) {}
288 public String doPostDr_Sub( DR_Sub postSub, ApiError err ) {
289 logger.info( "entry: doPostDr_Sub() " );
290 byte[] postData = postSub.getBytes();
291 logger.info( "post fields=" + postData );
292 String responsemessage = null;
293 String responseBody = null;
297 uc.setRequestMethod("POST");
299 uc.setRequestProperty("Content-Type", "application/vnd.att-dr.subscription");
300 uc.setRequestProperty( "charset", "utf-8");
301 uc.setRequestProperty( "X-ATT-DR-ON-BEHALF-OF", "DGL" );
302 uc.setRequestProperty( "Content-Length", Integer.toString( postData.length ));
303 uc.setUseCaches(false);
304 uc.setDoOutput(true);
305 OutputStream os = null;
310 os = uc.getOutputStream();
311 os.write( postData );
313 } catch (ProtocolException pe) {
314 // Rcvd error instead of 100-Continue
316 // work around glitch in Java 1.7.0.21 and likely others
317 // without this, Java will connect multiple times to the server to run the same request
318 uc.setDoOutput(false);
319 } catch (Exception e) {
322 rc = uc.getResponseCode();
323 logger.info( "http response code:" + rc );
324 responsemessage = uc.getResponseMessage();
325 logger.info( "responsemessage=" + responsemessage );
328 if (responsemessage == null) {
329 // work around for glitch in Java 1.7.0.21 and likely others
330 // When Expect: 100 is set and a non-100 response is received, the response message is not set but the response code is
331 String h0 = uc.getHeaderField(0);
333 int i = h0.indexOf(' ');
334 int j = h0.indexOf(' ', i + 1);
335 if (i != -1 && j != -1) {
336 responsemessage = h0.substring(j + 1);
341 responseBody = bodyToString( uc.getInputStream() );
342 logger.info( "responseBody=" + responseBody );
346 err.setMessage(responsemessage);
349 } catch (Exception e) {
350 System.err.println("Unable to read response " );
355 } catch ( Exception e ) {}
362 public String doPutFeed(Feed putFeed, ApiError err) {
363 byte[] postData = putFeed.getBytes();
364 logger.info( "post fields=" + postData.toString() );
365 String responsemessage = null;
366 String responseBody = null;
369 logger.info( "uc=" + uc );
370 uc.setRequestMethod("PUT");
371 uc.setRequestProperty("Content-Type", "application/vnd.att-dr.feed");
372 uc.setRequestProperty( "charset", "utf-8");
373 uc.setRequestProperty( "X-ATT-DR-ON-BEHALF-OF", putFeed.getOwner() );
374 uc.setRequestProperty( "Content-Length", Integer.toString( postData.length ));
375 uc.setUseCaches(false);
376 uc.setDoOutput(true);
377 OutputStream os = null;
382 os = uc.getOutputStream();
383 os.write( postData );
385 } catch (ProtocolException pe) {
386 // Rcvd error instead of 100-Continue
388 // work around glitch in Java 1.7.0.21 and likely others
389 // without this, Java will connect multiple times to the server to run the same request
390 uc.setDoOutput(false);
391 } catch (Exception e) {
394 rc = uc.getResponseCode();
395 logger.info( "http response code:" + rc );
396 responsemessage = uc.getResponseMessage();
397 logger.info( "responsemessage=" + responsemessage );
400 if (responsemessage == null) {
401 // work around for glitch in Java 1.7.0.21 and likely others
402 // When Expect: 100 is set and a non-100 response is received, the response message is not set but the response code is
403 String h0 = uc.getHeaderField(0);
405 int i = h0.indexOf(' ');
406 int j = h0.indexOf(' ', i + 1);
407 if (i != -1 && j != -1) {
408 responsemessage = h0.substring(j + 1);
412 if (rc >= 200 && rc < 300 ) {
413 responseBody = bodyToString( uc.getInputStream() );
414 logger.info( "responseBody=" + responseBody );
416 } else if ( rc == 404 ) {
418 err.setFields( "feedid");
419 String message = "FeedId " + putFeed.getFeedId() + " not found on DR to update. Out-of-sync condition?";
420 err.setMessage( message );
421 errorLogger.error( DmaapbcLogMessageEnum.PROV_OUT_OF_SYNC, "Feed", putFeed.getFeedId() );
425 err.setMessage(responsemessage);
428 } catch (ConnectException ce) {
429 errorLogger.error( DmaapbcLogMessageEnum.HTTP_CONNECTION_EXCEPTION, provURL, ce.getMessage() );
431 err.setMessage("Backend connection refused");
432 } catch (SocketException se) {
433 errorLogger.error( DmaapbcLogMessageEnum.SOCKET_EXCEPTION, se.getMessage(), "response from Prov server" );
435 err.setMessage( "Unable to read response from DR");
436 } catch (Exception e) {
437 logger.warn("Unable to read response " );
440 err.setCode( uc.getResponseCode());
441 err.setMessage(uc.getResponseMessage());
442 } catch (Exception e2) {
444 err.setMessage("Unable to determine response message");
449 } catch ( Exception e ) {}
453 public String doPutDr_Sub(DR_Sub postSub, ApiError err) {
454 logger.info( "entry: doPutDr_Sub() " );
455 byte[] postData = postSub.getBytes();
456 logger.info( "post fields=" + postData );
457 String responsemessage = null;
458 String responseBody = null;
462 uc.setRequestMethod("PUT");
464 uc.setRequestProperty("Content-Type", "application/vnd.att-dr.subscription");
465 uc.setRequestProperty( "charset", "utf-8");
466 uc.setRequestProperty( "X-ATT-DR-ON-BEHALF-OF", "DGL" );
467 uc.setRequestProperty( "Content-Length", Integer.toString( postData.length ));
468 uc.setUseCaches(false);
469 uc.setDoOutput(true);
470 OutputStream os = null;
475 os = uc.getOutputStream();
476 os.write( postData );
478 } catch (ProtocolException pe) {
479 // Rcvd error instead of 100-Continue
481 // work around glitch in Java 1.7.0.21 and likely others
482 // without this, Java will connect multiple times to the server to run the same request
483 uc.setDoOutput(false);
484 } catch (Exception e) {
487 rc = uc.getResponseCode();
488 logger.info( "http response code:" + rc );
489 responsemessage = uc.getResponseMessage();
490 logger.info( "responsemessage=" + responsemessage );
493 if (responsemessage == null) {
494 // work around for glitch in Java 1.7.0.21 and likely others
495 // When Expect: 100 is set and a non-100 response is received, the response message is not set but the response code is
496 String h0 = uc.getHeaderField(0);
498 int i = h0.indexOf(' ');
499 int j = h0.indexOf(' ', i + 1);
500 if (i != -1 && j != -1) {
501 responsemessage = h0.substring(j + 1);
506 responseBody = bodyToString( uc.getInputStream() );
507 logger.info( "responseBody=" + responseBody );
511 err.setMessage(responsemessage);
514 } catch (ConnectException ce) {
515 errorLogger.error( DmaapbcLogMessageEnum.HTTP_CONNECTION_EXCEPTION, provURL, ce.getMessage() );
517 err.setMessage("Backend connection refused");
518 } catch (Exception e) {
519 System.err.println("Unable to read response " );
528 public String doGetNodes( ApiError err ) {
529 logger.info( "entry: doGetNodes() " );
530 //byte[] postData = postSub.getBytes();
531 //logger.info( "get fields=" + postData );
532 String responsemessage = null;
533 String responseBody = null;
534 logger.info( "templog:doGetNodes at 12.10.14.10" );
537 logger.info( "templog:doGetNodes at 12.10.14.11" );
539 uc.setRequestMethod("GET");
541 //uc.setRequestProperty("Content-Type", "application/vnd.att-dr.subscription");
542 //uc.setRequestProperty( "charset", "utf-8");
543 //uc.setRequestProperty( "X-ATT-DR-ON-BEHALF-OF", "DGL" );
544 //uc.setRequestProperty( "Content-Length", Integer.toString( postData.length ));
545 //uc.setUseCaches(false);
546 //uc.setDoOutput(true);
547 OutputStream os = null;
550 logger.info( "templog:doGetNodes at 12.10.14.12" );
553 logger.info( "templog:doGetNodes at 12.10.14.13" );
554 //os = uc.getOutputStream();
555 //os.write( postData );
557 } catch (ProtocolException pe) {
558 logger.info( "templog:doGetNodes at 12.10.14.14" );
559 // Rcvd error instead of 100-Continue
561 // work around glitch in Java 1.7.0.21 and likely others
562 // without this, Java will connect multiple times to the server to run the same request
563 uc.setDoOutput(false);
564 } catch (Exception e) {
567 logger.info( "templog:doGetNodes at 12.10.14.15" );
568 rc = uc.getResponseCode();
569 logger.info( "http response code:" + rc );
570 responsemessage = uc.getResponseMessage();
571 logger.info( "responsemessage=" + responsemessage );
572 logger.info( "templog:doGetNodes at 12.10.14.16" );
575 if (responsemessage == null) {
576 logger.info( "templog:doGetNodes at 12.10.14.17" );
577 // work around for glitch in Java 1.7.0.21 and likely others
578 // When Expect: 100 is set and a non-100 response is received, the response message is not set but the response code is
579 String h0 = uc.getHeaderField(0);
581 int i = h0.indexOf(' ');
582 int j = h0.indexOf(' ', i + 1);
583 if (i != -1 && j != -1) {
584 responsemessage = h0.substring(j + 1);
588 logger.info( "templog:doGetNodes at 12.10.14.18" );
589 err.setCode(rc); // may not really be an error, but we save rc
591 responseBody = bodyToString( uc.getInputStream() );
592 logger.info( "responseBody=" + responseBody );
594 err.setMessage(responsemessage);
597 logger.info( "templog:doGetNodes at 12.10.14.19" );
598 } catch (ConnectException ce) {
599 logger.info( "templog:doGetNodes at 12.10.14.20" );
600 errorLogger.error( DmaapbcLogMessageEnum.HTTP_CONNECTION_EXCEPTION, provURL, ce.getMessage() );
602 err.setMessage("Backend connection refused");
603 } catch (Exception e) {
604 logger.info( "templog:doGetNodes at 12.10.14.21" );
605 System.err.println("Unable to read response " );
608 logger.info( "templog:doGetNodes at 12.10.14.22" );
609 if ( uc != null ) uc.disconnect();
611 logger.info( "templog:doGetNodes at 12.10.14.23" );
615 public String doPutNodes( ApiError err ) {
616 logger.info( "entry: doPutNodes() " );
617 //byte[] postData = nodeList.getBytes();
618 //logger.info( "get fields=" + postData );
619 String responsemessage = null;
620 String responseBody = null;
624 uc.setRequestMethod("PUT");
626 //uc.setRequestProperty("Content-Type", "application/vnd.att-dr.subscription");
627 //uc.setRequestProperty( "charset", "utf-8");
628 //uc.setRequestProperty( "X-ATT-DR-ON-BEHALF-OF", "DGL" );
629 //uc.setRequestProperty( "Content-Length", Integer.toString( postData.length ));
630 uc.setUseCaches(false);
631 //uc.setDoOutput(true);
632 OutputStream os = null;
637 //os = uc.getOutputStream();
638 //os.write( postData );
640 } catch (ProtocolException pe) {
641 // Rcvd error instead of 100-Continue
643 // work around glitch in Java 1.7.0.21 and likely others
644 // without this, Java will connect multiple times to the server to run the same request
645 uc.setDoOutput(false);
646 } catch (Exception e) {
649 rc = uc.getResponseCode();
650 logger.info( "http response code:" + rc );
651 responsemessage = uc.getResponseMessage();
652 logger.info( "responsemessage=" + responsemessage );
655 if (responsemessage == null) {
656 // work around for glitch in Java 1.7.0.21 and likely others
657 // When Expect: 100 is set and a non-100 response is received, the response message is not set but the response code is
658 String h0 = uc.getHeaderField(0);
660 int i = h0.indexOf(' ');
661 int j = h0.indexOf(' ', i + 1);
662 if (i != -1 && j != -1) {
663 responsemessage = h0.substring(j + 1);
669 responseBody = bodyToString( uc.getInputStream() );
670 logger.info( "responseBody=" + responseBody );
674 err.setMessage(responsemessage);
677 } catch (Exception e) {
678 System.err.println("Unable to read response " + e.getMessage() );
689 public String doDeleteFeed(Feed putFeed, ApiError err) {
690 //byte[] postData = putFeed.getBytes();
691 //logger.info( "post fields=" + postData.toString() );
692 String responsemessage = null;
693 String responseBody = null;
696 logger.info( "uc=" + uc );
697 uc.setRequestMethod("DELETE");
698 uc.setRequestProperty("Content-Type", "application/vnd.att-dr.feed");
699 uc.setRequestProperty( "charset", "utf-8");
700 uc.setRequestProperty( "X-ATT-DR-ON-BEHALF-OF", putFeed.getOwner() );
701 //uc.setRequestProperty( "Content-Length", Integer.toString( postData.length ));
702 uc.setUseCaches(false);
703 uc.setDoOutput(true);
704 OutputStream os = null;
709 os = uc.getOutputStream();
710 //os.write( postData );
712 } catch (ProtocolException pe) {
713 // Rcvd error instead of 100-Continue
715 // work around glitch in Java 1.7.0.21 and likely others
716 // without this, Java will connect multiple times to the server to run the same request
717 uc.setDoOutput(false);
718 } catch (Exception e) {
721 rc = uc.getResponseCode();
722 logger.info( "http response code:" + rc );
723 responsemessage = uc.getResponseMessage();
724 logger.info( "responsemessage=" + responsemessage );
727 if (responsemessage == null) {
728 // work around for glitch in Java 1.7.0.21 and likely others
729 // When Expect: 100 is set and a non-100 response is received, the response message is not set but the response code is
730 String h0 = uc.getHeaderField(0);
732 int i = h0.indexOf(' ');
733 int j = h0.indexOf(' ', i + 1);
734 if (i != -1 && j != -1) {
735 responsemessage = h0.substring(j + 1);
739 if (rc >= 200 && rc < 300 ) {
740 responseBody = bodyToString( uc.getInputStream() );
741 logger.info( "responseBody=" + responseBody );
743 } else if ( rc == 404 ) {
745 err.setFields( "feedid");
746 String message = "FeedId " + putFeed.getFeedId() + " not found on DR to update. Out-of-sync condition?";
747 err.setMessage( message );
748 errorLogger.error( DmaapbcLogMessageEnum.PROV_OUT_OF_SYNC, "Feed", putFeed.getFeedId() );
752 err.setMessage(responsemessage);
755 } catch (ConnectException ce) {
756 errorLogger.error( DmaapbcLogMessageEnum.HTTP_CONNECTION_EXCEPTION, provURL, ce.getMessage() );
758 err.setMessage("Backend connection refused");
759 } catch (SocketException se) {
760 errorLogger.error( DmaapbcLogMessageEnum.SOCKET_EXCEPTION, se.getMessage(), "response from Prov server" );
762 err.setMessage( "Unable to read response from DR");
763 } catch (Exception e) {
764 logger.warn("Unable to read response " );
767 err.setCode( uc.getResponseCode());
768 err.setMessage(uc.getResponseMessage());
769 } catch (Exception e2) {
771 err.setMessage("Unable to determine response message");
776 } catch ( Exception e ) {}
782 public static void main( String[] args ) throws Exception {
783 PropertyConfigurator.configure("log4j.properties");
784 logger.info("Started.");
786 RandomInteger ri = new RandomInteger(10000);
787 //String postJSON = String.format("{\"name\": \"dgl feed %d\", \"version\": \"v1.0\", \"description\": \"dgl feed N for testing\", \"authorization\": { \"classification\": \"unclassified\", \"endpoint_addrs\": [],\"endpoint_ids\": [{\"password\": \"test\",\"id\": \"test\"}]}}", ri.next()) ;
789 Feed tst = new Feed( "dgl feed " + i,
791 "dgl feed " + i + "for testing",
795 ArrayList<DR_Pub> pubs = new ArrayList<DR_Pub>();
796 pubs.add( new DR_Pub( "centralLocation" ) );
800 DrProvConnection context = new DrProvConnection();
801 rc = context.makeFeedConnection();
802 logger.info( "makeFeedConnection returns " + rc);
803 ApiError err = new ApiError();
805 String tmp = context.doPostFeed( tst, err );
806 logger.info( "doPostFeed returns " + tmp);