User: schaefera Date: 02/03/19 15:12:30 Modified: src/main/org/jboss/survey/command SurveyHandler.java Log: Some Adjustments to Survey and adding JBoss 3.0 Beta to the download page of www.jboss.org. Revision Changes Path 1.2 +60 -2 website-survey/src/main/org/jboss/survey/command/SurveyHandler.java Index: SurveyHandler.java =================================================================== RCS file: /cvsroot/jboss/website-survey/src/main/org/jboss/survey/command/SurveyHandler.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- SurveyHandler.java 2 Oct 2001 21:34:56 -0000 1.1 +++ SurveyHandler.java 19 Mar 2002 23:12:30 -0000 1.2 @@ -1,9 +1,9 @@ // ---------------------------------------------------------------------------- // File: SurveyHandler.java // Copyright ( c ) 2001 eBuilt, Inc. All rights reserved. -// Version: $Revision: 1.1 $ -// Last Checked In: $Date: 2001/10/02 21:34:56 $ -// Last Checked In By: $Author: user57 $ +// Version: $Revision: 1.2 $ +// Last Checked In: $Date: 2002/03/19 23:12:30 $ +// Last Checked In By: $Author: schaefera $ // ---------------------------------------------------------------------------- package org.jboss.survey.command; @@ -14,8 +14,11 @@ import org.jboss.survey.exception.InvalidValueException; import org.jboss.survey.ejb.session.SurveyManagement; import org.jboss.survey.ejb.session.SurveyManagementHome; +import org.jboss.survey.ejb.session.SurveyStatistics; +import org.jboss.survey.ejb.session.SurveyStatisticsHome; import java.util.Collection; +import java.util.Hashtable; import java.rmi.RemoteException; import javax.ejb.CreateException; @@ -30,7 +33,7 @@ * EJBs. It also delivers the rights Value Objects on requests. * * @author Andreas Schaefer ([EMAIL PROTECTED]) - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ **/ public class SurveyHandler { @@ -57,6 +60,28 @@ // ------------------------------------------------------------------------- /** + * Returns the requested Survey Statistics + * + * @return Hashtable containing the survey statistics + * + * @throws ServiceUnavailable If the service is unaccessible or unusable + **/ + public Hashtable getStatistics() + throws + ServiceUnavailableException + { + try { + SurveyStatistics lBean = getSurveyStatisticsBean(); + return lBean.getStatistics(); + } + catch ( RemoteException pRE ) { + throw new ServiceUnavailableException( + "Remote communication error: " + pRE.getMessage() + ); + } + } + + /** * Returns the requested Survey * * @param pSurveyId Id of the requested Survey @@ -351,6 +376,39 @@ PortableRemoteObject.narrow( aEJBRef, SurveyManagementHome.class ); return aHome.create(); + } + catch( NamingException pNE ) { + pNE.printStackTrace(); + throw new ServiceUnavailableException( + "JNDI lookup failed: " + pNE.getMessage() + ); + } + catch( RemoteException pRE ) { + throw new ServiceUnavailableException( + "Remote communication error: " + pRE.getMessage() + ); + } + catch( CreateException pCE ) { + throw new ServiceUnavailableException( + "Problem creating content management session bean: " + pCE.getMessage() + ); + } + } + /** + * Creates a SurveyStatistics bean. + * + * @return Returns a SurveyStatistics bean for use by the Survey handler. + **/ + private SurveyStatistics getSurveyStatisticsBean() + throws ServiceUnavailableException + { + try { + Context lContext = new InitialContext(); + Object lRef = lContext.lookup( "ejb/jboss/survey/SurveyStatistics" ); + SurveyStatisticsHome lHome = (SurveyStatisticsHome) + PortableRemoteObject.narrow( lRef, SurveyStatisticsHome.class ); + + return lHome.create(); } catch( NamingException pNE ) { pNE.printStackTrace();
_______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development