Example usage for javax.naming NamingException printStackTrace

List of usage examples for javax.naming NamingException printStackTrace

Introduction

In this page you can find the example usage for javax.naming NamingException printStackTrace.

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:org.openbizview.util.Programacion.java

/**
* Retorna el nombre de parmetros/* w  w w.  j a  v a 2s.  c o  m*/
* de la tabla temporal que almacena los parmetros
* Convierte las columnas en filas separadas por (|)
* <p>
**/
public String arregloParamNames(String reporte) {
    String paramNames = "";
    int vlrows = 0;
    String vlqueryOra = "select codrep, listagg (paramname, '|') WITHIN GROUP (ORDER BY paramname) arr FROM bvtparams_temp  where SESSIONID = '"
            + session + "' and codrep = '" + reporte + "' GROUP BY codrep";
    String vlqueryPg = "select codrep, string_agg(paramname,'|' order by paramname)  arr from bvtparams_temp where SESSIONID = '"
            + session + "' and codrep = '" + reporte + "' GROUP BY codrep";
    String vlquerySqlSrv = "";
    try {
        consulta.selectPntGenericaMDB(vlqueryOra, vlqueryPg, vlquerySqlSrv, JNDI);
        vlrows = consulta.getRows();
        if (vlrows > 0) {
            String[][] vltabla = consulta.getArray();
            paramNames = vltabla[0][1];
        }
    } catch (NamingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    return paramNames;
}

From source file:org.openbizview.util.Programacion.java

/**
   * Lee parmetros del los reportes/*  ww w  .j a  va 2s.  c  o m*/
   * Usa el API del birt report, Iterando los parmetros
   * y guardando los valores en un ArrayList
   * @param: Ruta, la ruta fsica de ubicacin del reporte
   */
public void ReadParamsBirtReport(String preporte) {
    //Borra todo lo que contenga la session
    try {
        deleteTemps(session, "bvtparams_temp");
        deleteTemps(session, "bvtparams_number_temp");
    } catch (NamingException e1) {

        e1.printStackTrace();
    }

    //Lectura de parmetros de reportes, BIRT ENGINE
    //
    EngineConfig config = new EngineConfig();
    ReportEngine engine = new ReportEngine(config);
    //Open a report design 
    IReportRunnable design = null;
    try {
        design = engine.openReportDesign(preporte);
    } catch (EngineException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    IGetParameterDefinitionTask task = engine.createGetParameterDefinitionTask(design);
    @SuppressWarnings("rawtypes")
    Collection params = task.getParameterDefns(true);

    @SuppressWarnings("rawtypes")
    Iterator iter = params.iterator();
    //Iterate over all parameters
    while (iter.hasNext()) {
        IParameterDefn param = (IParameterDefn) iter.next();
        listPN.add(param.getName());//Guarda el nombre del parmetro
        listPT.add(param.getDataType());//Guarda el tipo de parmetro
        listPH.add(param.isHidden());//Indica si es hidden
        listPR.add(param.isRequired());
        {
            if (param.getPromptText() == null) {
                listR.add(param.getName());
            } else {
                listR.add(param.getPromptText());
            }
            rowsParam = params.size();

        }
    }
    //Una vez obtenido los parmetros los guardamos en una tabla temporal
    //Esto permite hace un mejor manejo en el for each loop al momento de insertar los valores
    //Recorre la lista y va insertando, blanquea la tabla antes de cargarla
    //
    for (int i = 0; i < rowsParam; i++) {
        //System.out.println(listPH.get(i));
        try {
            //Inserta parmetros 
            deleteParam(reporte.split(" - ")[0].toUpperCase(), listPN.get(i), listPT.get(i), session);//Borra temporal
            insertParam(reporte.split(" - ")[0].toUpperCase(), listPN.get(i), listPT.get(i), session,
                    listR.get(i), listPH.get(i).toString(), listPR.get(i).toString());//CArga temporal
            //Inserta el nmero de parmetros
            deleteParamNumber(reporte.split(" - ")[0].toUpperCase(), session);
            insertParamNumber(reporte.split(" - ")[0].toUpperCase(), session, rowsParam);
        } catch (NamingException e) {

            e.printStackTrace();
        }
    }
    task.close();

    //Lectura de datos en la tabla posteriormente recorre el arreglo para impimir en pantalla
    //
    String[] vecreporte = reporte.split("\\ - ", -1);
    String vlquery = "select promptext from bvtparams_temp where sessionid = '" + session + "' and codrep = '"
            + vecreporte[0].toUpperCase() + "' and paramhidden = 'false' and paramrequired = 'true'";
    try {
        consulta.selectPntGenerica(vlquery, JNDI);
        rowsParam = consulta.getRows();

    } catch (NamingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    inputs = new String[rowsParam];//Asigna el tamao a los inputs
    //Si hay registros en la temporal recorre la tabla 
    if (rowsParam > 0) {//Si hay registros muestra los parmetros                 
        vlTabla = consulta.getArray();
        RequestContext.getCurrentInstance().execute("PF('dlg2').show()");
    }
}

From source file:org.apache.catalina.servlets.DefaultServlet.java

/**
 * Return an InputStream to an HTML representation of the contents
 * of this directory./*from ww w.ja v  a 2  s.  c om*/
 *
 * @param contextPath     Context path to which our internal paths are
 *                        relative
 * @param resourceInfo    Description of the Parameter
 * @param xsltInputStream Description of the Parameter
 * @return Description of the Return Value
 */
protected InputStream renderXml(String contextPath, ResourceInfo resourceInfo, InputStream xsltInputStream) {

    StringBuffer sb = new StringBuffer();

    sb.append("<?xml version=\"1.0\"?>");
    sb.append("<listing ");
    sb.append(" contextPath='");
    sb.append(contextPath);
    sb.append("'");
    sb.append(" directory='");
    sb.append(resourceInfo.path);
    sb.append("' ");
    sb.append(" hasParent='").append(!resourceInfo.path.equals("/"));
    sb.append("'>");

    sb.append("<entries>");

    try {

        // Render the directory entries within this directory
        DirContext directory = resourceInfo.directory;
        NamingEnumeration enum1 = resourceInfo.resources.list(resourceInfo.path);
        while (enum1.hasMoreElements()) {

            NameClassPair ncPair = (NameClassPair) enum1.nextElement();
            String resourceName = ncPair.getName();
            ResourceInfo childResourceInfo = new ResourceInfo(resourceName, directory);

            String trimmed = resourceName;
            if (trimmed.equalsIgnoreCase("WEB-INF") || trimmed.equalsIgnoreCase("META-INF")
                    || trimmed.equalsIgnoreCase(localXsltFile)) {
                continue;
            }

            sb.append("<entry");
            sb.append(" type='").append(childResourceInfo.collection ? "dir" : "file").append("'");
            sb.append(" urlPath='").append(rewriteUrl(contextPath))
                    .append(rewriteUrl(resourceInfo.path + resourceName))
                    .append(childResourceInfo.collection ? "/" : "").append("'");
            if (!childResourceInfo.collection) {
                sb.append(" size='").append(renderSize(childResourceInfo.length)).append("'");
            }
            sb.append(" date='").append(childResourceInfo.httpDate).append("'");

            sb.append(">");
            sb.append(trimmed);
            if (childResourceInfo.collection) {
                sb.append("/");
            }
            sb.append("</entry>");

        }

    } catch (NamingException e) {
        // Something went wrong
        e.printStackTrace();
    }

    sb.append("</entries>");

    String readme = getReadme(resourceInfo.directory);

    if (readme != null) {
        sb.append("<readme><![CDATA[");
        sb.append(readme);
        sb.append("]]></readme>");
    }

    sb.append("</listing>");

    try {
        TransformerFactory tFactory = TransformerFactory.newInstance();
        Source xmlSource = new StreamSource(new StringReader(sb.toString()));
        Source xslSource = new StreamSource(xsltInputStream);
        Transformer transformer = tFactory.newTransformer(xslSource);

        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        OutputStreamWriter osWriter = new OutputStreamWriter(stream, "UTF8");
        StreamResult out = new StreamResult(osWriter);
        transformer.transform(xmlSource, out);
        osWriter.flush();
        return (new ByteArrayInputStream(stream.toByteArray()));
    } catch (Exception e) {
        log("directory transform failure: " + e.getMessage());
        return renderHtml(contextPath, resourceInfo);
    }
}