⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newswsmanager.java

📁 这是一个J2EE的一个小内容
💻 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;        }                    }    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -