?? newswsmanager.java
字號:
/** * NewsWSManager acts as a publisher of a webservice * It reuses the model service component, get the relevant * messages in a pre-defined data access object and converts this * into a required format to publish it a a webservice. * This class doesn't contain any struts related references or any * servlet related references thus making this as loosely coupled. * Exceptions are caught and rethrown as SOAPExceptions. * * *//** * Change History: * Author Date Version Details * Jerome Josephraj 28 October 2002 1.00.01 Created */package com.ddj.wsstruts.wsmanager.publisher;import com.ddj.wsstruts.ms.NewsMs;import com.ddj.wsstruts.valueobject.*;import com.ddj.wsstruts.constant.SystemConstants;import java.util.*;import java.util.Iterator;import javax.xml.soap.*;//Log4J statementsimport org.apache.log4j.Category;public class NewsWSManager { /** Creates new NewsWSManager */ public NewsWSManager() { } //Log4J // define a static category variable so that it references the // category instance of the same name as this class. static final Category category = Category.getInstance(NewsWSManager.class.getName()); /* * This method is exposed as a webservice. * It calls the relevant method in Model service, gets the result * in a predefined Data Access Object and populates a String array * with the obtained result. * * @return String[] object */ public String[] getNewsContent() throws SOAPException { try { if(category.isDebugEnabled()){ category.debug(SystemConstants.METHOD_START); } NewsMs newsMs = new NewsMs(); NewsSearchResult newsSearchCOD = null; NewsSearchResult newsSearchResultCOD = new NewsSearchResult(); Collection newsResult = null; String[] newsResultArray = new String[50]; Iterator i = null; int j = 1; //Create a Collection to get all news content newsSearchCOD = new NewsSearchResult(); newsResult = newsMs.getNews(newsSearchResultCOD); i = newsResult.iterator(); //Get newsSearchCod from newsResult collection //and get news content from each newsSearchCod //and build a string of array while(i.hasNext()) { newsSearchResultCOD = (NewsSearchResult) i.next(); newsResultArray[j] = newsSearchResultCOD.getNewsContent(); j++; } //return the array return newsResultArray; } catch(Exception e) { //Catch any eception and throw it as a SOAPException e.printStackTrace(); SOAPException se = new SOAPException(e.getMessage()); throw se; } } }
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -