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.jetbrains.webdemo.servlet.KotlinHttpServlet.java

private boolean loadTomcatParameters() {
    InitialContext initCtx = null;
    try {//from w  w w.  j a  v  a 2s . c o m
        initCtx = new InitialContext();
        NamingContext envCtx = (NamingContext) initCtx.lookup("java:comp/env");
        try {
            CommandRunner.setServerSettingFromTomcatConfig("app_output_dir",
                    (String) envCtx.lookup("app_output_dir"));
        } catch (NamingException e) {
            File rootFolder = new File(ApplicationSettings.WEBAPP_ROOT_DIRECTORY);
            String appHome = rootFolder.getParentFile().getParentFile().getParent();
            CommandRunner.setServerSettingFromTomcatConfig("app_output_dir", appHome);
        }

        try {
            CommandRunner.setServerSettingFromTomcatConfig("is_test_version",
                    (String) envCtx.lookup("is_test_version"));
        } catch (NameNotFoundException e) {
            //Absent is_test_version variable in context.xml
            CommandRunner.setServerSettingFromTomcatConfig("is_test_version", "false");
        }

        CommandRunner.setServerSettingFromTomcatConfig("backend_url", (String) envCtx.lookup("backend_url"));
        return true;
    } catch (Throwable e) {
        e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
        return false;
    }

}

From source file:org.wso2.carbon.apimgt.impl.dao.test.APIMgtDAOTest.java

private void initializeDatabase(String configFilePath) {

    InputStream in = null;/*from  w ww .  jav a2  s.  co m*/
    try {
        in = FileUtils.openInputStream(new File(configFilePath));
        StAXOMBuilder builder = new StAXOMBuilder(in);
        String dataSource = builder.getDocumentElement().getFirstChildWithName(new QName("DataSourceName"))
                .getText();
        OMElement databaseElement = builder.getDocumentElement().getFirstChildWithName(new QName("Database"));
        String databaseURL = databaseElement.getFirstChildWithName(new QName("URL")).getText();
        String databaseUser = databaseElement.getFirstChildWithName(new QName("Username")).getText();
        String databasePass = databaseElement.getFirstChildWithName(new QName("Password")).getText();
        String databaseDriver = databaseElement.getFirstChildWithName(new QName("Driver")).getText();

        BasicDataSource basicDataSource = new BasicDataSource();
        basicDataSource.setDriverClassName(databaseDriver);
        basicDataSource.setUrl(databaseURL);
        basicDataSource.setUsername(databaseUser);
        basicDataSource.setPassword(databasePass);

        // Create initial context
        System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.naming.java.javaURLContextFactory");
        System.setProperty(Context.URL_PKG_PREFIXES, "org.apache.naming");
        try {
            InitialContext.doLookup("java:/comp/env/jdbc/WSO2AM_DB");
        } catch (NamingException e) {
            InitialContext ic = new InitialContext();
            ic.createSubcontext("java:");
            ic.createSubcontext("java:/comp");
            ic.createSubcontext("java:/comp/env");
            ic.createSubcontext("java:/comp/env/jdbc");

            ic.bind("java:/comp/env/jdbc/WSO2AM_DB", basicDataSource);
        }
    } catch (XMLStreamException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (NamingException e) {
        e.printStackTrace();
    }
}

From source file:org.openhie.openempi.recordlinkage.protocols.MultiPartyPRLProtocolBase.java

public PersonMatchRequest sendPersonMatchRequest(Dataset dataset, String remoteTableName, String matchName,
        String keyServerUserName, String keyServerPassword, String dataIntegratorUserName,
        String dataIntegratorPassword, String parameterManagerUserName, String parameterManagerPassword) {
    ValidationUtil.sanityCheckFieldName(remoteTableName);
    ValidationUtil.sanityCheckFieldName(matchName);

    String thirdPartyAddress = getThirdPartyAddress();
    setIsLocalThirdParty(isLocalAddress(thirdPartyAddress));
    String thirdPartyUserName = getThirdPartyCredential(dataIntegratorUserName, parameterManagerUserName);
    String thirdPartyPassword = getThirdPartyCredential(dataIntegratorPassword, parameterManagerPassword);

    PersonMatchRequest personMatchRequest = null;
    RemotePersonService remotePersonService = Context.getRemotePersonService();
    try {/*  w  w w  .  j ava2s .  c om*/
        remotePersonService.authenticate(thirdPartyAddress, thirdPartyUserName, thirdPartyPassword,
                keyServerUserName, keyServerPassword);

        // 1. Send DataSet and patient data first
        List<ColumnInformation> matchColumnInformation = getColumnsForPRLRequest(dataset,
                !twoOrThreeThirdParty());
        List<ColumnInformation> noMatchColumnInformation = getNoMatchColumnInformation(dataset);
        List<ColumnInformation> columnInformation = new ArrayList<ColumnInformation>();
        List<String> matchColumnNames = new ArrayList<String>();
        String defaultHmacFunctionName = Constants.DEFAULT_HMAC_FUNCTION_NAME;
        boolean isThereClearField = fillColumnInformationForSend(matchColumnInformation, columnInformation,
                matchColumnNames);

        long totalRecords = dataset.getTotalRecords();
        List<ColumnInformation> allColumnInformation = new ArrayList<ColumnInformation>();
        allColumnInformation.addAll(matchColumnInformation);
        allColumnInformation.addAll(noMatchColumnInformation);
        remotePersonService.createDatasetTable(remoteTableName, allColumnInformation, totalRecords, false);

        Map<Long, Long> personPseudoIdsReverseLookup = null;
        if (getUsePseudoIds())
            personPseudoIdsReverseLookup = new HashMap<Long, Long>();
        sendFirstPhaseData(dataset, totalRecords, matchColumnNames, matchColumnInformation,
                noMatchColumnInformation, isThereClearField, defaultHmacFunctionName, thirdPartyAddress,
                personPseudoIdsReverseLookup, remotePersonService, remoteTableName);
        remotePersonService.addIndexesAndConstraintsToDatasetTable(remoteTableName, totalRecords + 1);

        // 2. Send MatchRequest right after
        // Preliminary steps
        int myDhSecret = getNonce();
        DiffieHellmanKeyExchange dhke = new DiffieHellmanKeyExchange(myDhSecret);
        byte[] myDhPublicKey = dhke.computePublicKey().toByteArray();

        String blockingServiceName1 = getMatchingServiceTypeName(ComponentType.PARAMETER_MANAGER_MODE);
        String matchingServiceName1 = getMatchingServiceTypeName(ComponentType.PARAMETER_MANAGER_MODE);
        personMatchRequest = createPersonMatchRequest(dataset, myDhPublicKey, matchName, blockingServiceName1,
                matchingServiceName1);
        personMatchRequest = personMatchRequestDao.addPersonMatchRequest(personMatchRequest);
        int personMatchRequestId = remotePersonService.addPersonMatchRequest(getName(), remoteTableName,
                matchName, myDhPublicKey, getMatchPairStatHalfTableName(remoteTableName));
        remotePersonService.close(); // Need to close the context, so the PersonMatchRequest and other data
        // waiting in the Hibernate 2nd level cache will be flushed after the EJB call returns

        // Update dataset with the source file name in case of local experiment
        if (getIsLocalThirdParty()) {
            PersonQueryService personQueryService = Context.getPersonQueryService();
            Dataset newlySentDataset = personQueryService.getDatasetByTableName(remoteTableName);
            newlySentDataset.setFileName(dataset.getFileName());
            Context.getPersonManagerService().updateDataset(newlySentDataset);
        }

        String blockingServiceName2 = getMatchingServiceTypeName(ComponentType.DATA_INTEGRATOR_MODE);
        String matchingServiceName2 = getMatchingServiceTypeName(ComponentType.DATA_INTEGRATOR_MODE);
        performSecondPhase(dataset, matchName, blockingServiceName2, matchingServiceName2, thirdPartyAddress,
                keyServerUserName, keyServerPassword, dataIntegratorUserName, dataIntegratorPassword,
                parameterManagerUserName, parameterManagerPassword, personMatchRequestId, dhke,
                personPseudoIdsReverseLookup);
    } catch (NamingException e) {
        log.error("Couldn't connect to third party " + thirdPartyAddress + " to send PersonMatchRequest");
        e.printStackTrace();
    } catch (ApplicationException e) {
        log.error("Couldn't connect to third party " + thirdPartyAddress + " to send PersonMatchRequest");
        e.printStackTrace();
    }
    return personMatchRequest;
}

From source file:com.dtolabs.rundeck.jetty.jaas.JettyCachingLdapLoginModule.java

private ConcurrentHashMap<String, List<String>> buildRoleMemberOfMap(DirContext dirContext) {
    Object[] filterArguments = { _roleObjectClass };
    SearchControls ctls = new SearchControls();
    ctls.setDerefLinkFlag(true);/*from w  ww.j  a v  a  2s  .co m*/
    ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);

    ConcurrentHashMap<String, List<String>> roleMemberOfMap = new ConcurrentHashMap<String, List<String>>();

    try {
        NamingEnumeration<SearchResult> results = dirContext.search(_roleBaseDn, _roleMemberFilter, ctls);
        while (results.hasMoreElements()) {
            SearchResult result = results.nextElement();
            Attributes attributes = result.getAttributes();

            if (attributes == null) {
                continue;
            }

            Attribute roleAttribute = attributes.get(_roleNameAttribute);
            Attribute memberAttribute = attributes.get(_roleMemberAttribute);

            if (roleAttribute == null || memberAttribute == null) {
                continue;
            }

            NamingEnumeration role = roleAttribute.getAll();
            NamingEnumeration members = memberAttribute.getAll();

            if (!role.hasMore() || !members.hasMore()) {
                continue;
            }

            String roleName = (String) role.next();
            if (_rolePrefix != null && !"".equalsIgnoreCase(_rolePrefix)) {
                roleName = roleName.replace(_rolePrefix, "");
            }

            while (members.hasMore()) {
                String member = (String) members.next();
                Matcher roleMatcher = rolePattern.matcher(member);
                if (!roleMatcher.find()) {
                    continue;
                }
                String roleMember = roleMatcher.group(1);
                List<String> memberOf;
                if (roleMemberOfMap.containsKey(roleMember)) {
                    memberOf = roleMemberOfMap.get(roleMember);
                } else {
                    memberOf = new ArrayList<String>();
                }

                memberOf.add(roleName);

                roleMemberOfMap.put(roleMember, memberOf);
            }

        }
    } catch (NamingException e) {
        e.printStackTrace();
    }
    return roleMemberOfMap;
}

From source file:org.openhie.openempi.recordlinkage.protocols.MultiPartyPRLProtocolBase.java

public void handleBloomFilterParameterAdvice(String blockingServiceName, String matchingServiceName,
        String keyServerUserName, String keyServerPassword, String dataIntegratorUserName,
        String dataIntegratorPassword, Dataset leftLocalDataset, Dataset leftRemoteDataset,
        Dataset rightRemoteDataset, List<ColumnMatchInformation> columnMatchInformation,
        List<MatchPairStatHalf> matchPairStatHalves, Map<Long, Long> personPseudoIdsReverseLookup,
        int sharedSecret, boolean leftOrRightSide, String matchName) throws ApplicationException {
    String remoteTableName = leftRemoteDataset.getTableName();

    long startTime1 = System.currentTimeMillis();
    log.warn("Reencode Start: " + startTime1);
    long totalMem = Runtime.getRuntime().totalMemory();
    long freeMem = Runtime.getRuntime().freeMemory();
    log.warn("Used memory = " + (totalMem - freeMem) + " total (" + totalMem + ") - free (" + freeMem + ")");
    String newBFTableName = remoteTableName + UniversalDaoHibernate.BF_TABLE_NAME_POSTFIX + "_"
            + getNowString(); // include time into name to avoid collision
    // Reencode from original cleartext file or from DB?
    List<ColumnInformation> bfColumnInformation = new ArrayList<ColumnInformation>();
    Dataset newBFDataset = bfReencodeDataset(leftLocalDataset, newBFTableName, columnMatchInformation,
            keyServerUserName, keyServerPassword, leftOrRightSide, personPseudoIdsReverseLookup,
            bfColumnInformation);//from  w  w  w. j  a v a  2s  .  com
    long endTime1 = System.currentTimeMillis();
    log.warn("Reencode End: " + endTime1 + ", elapsed: " + (endTime1 - startTime1));
    totalMem = Runtime.getRuntime().totalMemory();
    freeMem = Runtime.getRuntime().freeMemory();
    log.warn("Used memory = " + (totalMem - freeMem) + " total (" + totalMem + ") - free (" + freeMem + ")");

    long startTime2 = System.currentTimeMillis();
    log.warn("RBF Send Start: " + startTime2);
    PrivacySettings privacySettings = (PrivacySettings) Context.getConfiguration()
            .lookupConfigurationEntry(ConfigurationRegistry.RECORD_LINKAGE_PROTOCOL_SETTINGS);
    DataIntegratorSettings dataIntegratorSettings = privacySettings.getComponentSettings()
            .getDataIntegratorSettings();
    String serverAddress4DI = dataIntegratorSettings.getServerAddress();
    try {
        String sentTableName = sendNewDataset(newBFTableName, newBFDataset, remoteTableName,
                columnMatchInformation, keyServerUserName, keyServerPassword, dataIntegratorUserName,
                dataIntegratorPassword, matchPairStatHalves, personPseudoIdsReverseLookup, sharedSecret,
                leftOrRightSide, bfColumnInformation);

        RemotePersonService remotePersonService = Context.getRemotePersonService();

        remotePersonService.close();
        remotePersonService.authenticate(serverAddress4DI, dataIntegratorUserName, dataIntegratorPassword,
                keyServerUserName, keyServerPassword);

        // Sending MatchRequest after loading the data remotely
        int personMatchRequestId = remotePersonService.addPersonMatchRequest(getName(), sentTableName,
                matchName, null, getMatchPairStatHalfTableName(remoteTableName));
        remotePersonService.close(); // Needed to flush the PersonMatchRequest into the DB on the DI

        // Start the actual computation on the Data Integrator (one of the threads will perform it, the other returns immediately)
        remotePersonService.authenticate(serverAddress4DI, dataIntegratorUserName, dataIntegratorPassword,
                keyServerUserName, keyServerPassword);
        remotePersonService.acquireMatchRequests(getName(), personMatchRequestId,
                ComponentType.DATA_INTEGRATOR_MODE);
        remotePersonService.close();
    } catch (NamingException e) {
        log.error("Couldn't connect to Data Integrator (" + serverAddress4DI
                + ") to send back advice about new bloom filter parameters");
        e.printStackTrace();
    } catch (Exception e) {
        log.error("Error occured during creation, generation or loading of BF or CBF data");
        e.printStackTrace();
    }
    long endTime2 = System.currentTimeMillis();
    log.warn("RBF Send End: " + endTime2 + ", elapsed: " + (endTime2 - startTime2));
    totalMem = Runtime.getRuntime().totalMemory();
    freeMem = Runtime.getRuntime().freeMemory();
    log.warn("Used memory = " + (totalMem - freeMem) + " total (" + totalMem + ") - free (" + freeMem + ")");
}

From source file:edu.harvard.hul.ois.pds.ws.PDSWebService.java

/**
 * Initialize the servlet./*from  w  w w  .j a  v  a2  s.co  m*/
 */

public void init(ServletConfig config) throws ServletException {
    super.init(config);

    try {
        Context initContext = new InitialContext();
        Context envContext = (Context) initContext.lookup("java:/comp/env");
        PdsConf pdsConf = (PdsConf) envContext.lookup("bean/PdsConf");
        conf = pdsConf.getConf();
        memcache = (CacheController) envContext.lookup("bean/CacheController");
        ds = (DataSource) envContext.lookup("jdbc/DrsDB");
    } catch (NamingException e) {
        e.printStackTrace();
    }

    cache = conf.getString("cache");
    idsUrl = conf.getString("ids");
    ftsUrl = conf.getString("fts");
    giffy = conf.getString("t2gif");
    cacheUrl = conf.getString("cacheUrl");
    pdsUrl = conf.getString("pds");
    nrsUrl = conf.getString("nrsUrl");
    String logFile = conf.getString("logFile");

    maxThumbnails = conf.getString("maxThumbnails");

    //Configure the logger
    logger = Logger.getLogger("edu.harvard.hul.ois.pds.ws");
    try {
        XmlLayout myLayout = new XmlLayout();
        //an appender for the access log
        Appender myAppender = new DailyRollingFileAppender(myLayout, logFile, conf.getString("logRollover"));
        logger.addAppender(myAppender);
    } catch (Exception e) {
        WebAppLogMessage message = new WebAppLogMessage();
        message.setContext("init logger");
        message.setMessage("Error initializing logger");
        logger.error(message, e);
        throw new ServletException(e.getMessage());
    }
    //reset the logger for this class
    logger = Logger.getLogger(PDSWebService.class);

    System.setProperty("org.xml.sax.driver", "org.apache.xerces.parsers.SAXParser");

    //init pdf conversions hash
    pdfConversions = new Hashtable<String, ArrayList<Integer>>();

    //Log successful servlet init
    WebAppLogMessage message = new WebAppLogMessage();
    message.setMessage("Servlet init()");
    logger.info(message);

    drs2Service = new ServiceWrapper(conf.getString("drs2ServiceURL"), conf.getString("drs2AppKey"), 1);

}

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

/**
 * Retorna si el usuario tiene asignado algn rolList<Bvt002> listRoles = new ArrayList<Bvt002>(); adicional
 *//*from   w w  w.j  a v a  2s  .c o m*/
public String isRol(String pcodrol) {
    String valor = "fa fa-circle fa-2x text-danger";
    String query = "select b_codrol from bvt008 where coduser = '" + vusuario.trim().toUpperCase()
            + "' and instancia = '" + instancia_insert + "' and b_codrol = '" + pcodrol.toUpperCase() + "'";
    //System.out.println(query);
    try {
        consulta.selectPntGenerica(query, JNDI);
    } catch (NamingException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    int rows = consulta.getRows();
    if (rows > 0) {
        valor = "fa fa-circle fa-2x text-success";
    }
    return valor;
}

From source file:org.openhie.openempi.recordlinkage.protocols.MultiPartyPRLProtocolBase.java

protected String sendCBFDataset(String newBFTableName, Dataset newBFDataset, String remoteTableName,
        List<ColumnMatchInformation> columnMatchInformation, String keyServerUserName, String keyServerPassword,
        String dataIntegratorUserName, String dataIntegratorPassword,
        List<MatchPairStatHalf> matchPairStatHalves, Map<Long, Long> personPseudoIdsReverseLookup,
        int sharedSecret, boolean leftOrRightSide, List<ColumnInformation> bfColumnInformation)
        throws NamingException, ApplicationException {
    int cbfLength = 0;
    for (ColumnMatchInformation cmi : columnMatchInformation) {
        if (cmi.getFieldType().getFieldTypeEnum() == FieldType.FieldTypeEnum.Blob && !cmi
                .getComparisonFunctionName().equals(Constants.NO_COMPARISON_JUST_TRANSFER_FUNCTION_NAME)) {
            cbfLength += cmi.getBloomFilterProposedM();
        }/*from  w  ww  .  j a  va 2 s .  c o m*/
    }

    // It's important to use pseudo random generator, so both left and right side will deduct
    // the same bit permutation from the seed.
    Random rnd = new Random(sharedSecret);
    Map<String, int[][]> bitPermutation = generateBitPermutation(rnd, cbfLength, columnMatchInformation,
            leftOrRightSide);

    PersonQueryService personQueryService = Context.getPersonQueryService();
    PersonManagerService personManagerService = Context.getPersonManagerService();

    PrivacySettings privacySettings = (PrivacySettings) Context.getConfiguration()
            .lookupConfigurationEntry(ConfigurationRegistry.RECORD_LINKAGE_PROTOCOL_SETTINGS);
    int defaultK = privacySettings.getBloomfilterSettings().getDefaultK();
    String newCBFTableName = remoteTableName + UniversalDaoHibernate.CBF_TABLE_NAME_POSTFIX + "_"
            + getNowString(); // include time into name to avoid collision
    List<ColumnInformation> cbfColumnInformation = new ArrayList<ColumnInformation>();
    ColumnInformation ci = new ColumnInformation();
    ci.setFieldName(UniversalDaoHibernate.CBF_ATTRIBUTE_NAME);
    ci.setFieldMeaning(FieldMeaning.FieldMeaningEnum.CBF);
    ci.setFieldType(FieldType.FieldTypeEnum.Blob);
    ci.setBloomFilterKParameter(defaultK); // TODO
    ci.setBloomFilterMParameter(cbfLength);
    cbfColumnInformation.add(ci);
    List<String> noMatchColumnNames = new ArrayList<String>();
    for (ColumnMatchInformation cmi : columnMatchInformation) {
        if (cmi.getComparisonFunctionName().equals(Constants.NO_COMPARISON_JUST_TRANSFER_FUNCTION_NAME)) {
            String fn = leftOrRightSide ? cmi.getLeftFieldName() : cmi.getRightFieldName();
            ColumnInformation nci = new ColumnInformation();
            nci.setFieldName(fn);
            nci.setFieldMeaning(cmi.getFieldMeaning().getFieldMeaningEnum());
            nci.setFieldType(cmi.getFieldType().getFieldTypeEnum());
            cbfColumnInformation.add(nci);
            noMatchColumnNames.add(fn);
        }
    }
    personManagerService.createDatasetTable(newCBFTableName, cbfColumnInformation,
            newBFDataset.getTotalRecords(), false, false);
    // Sample the recoded bloomfilters -> CBF

    RemotePersonService remotePersonService = Context.getRemotePersonService();
    DataIntegratorSettings dataIntegratorSettings = privacySettings.getComponentSettings()
            .getDataIntegratorSettings();
    String serverAddress4DI = dataIntegratorSettings.getServerAddress();
    try {
        if (!isLocalAddress(serverAddress4DI)) {
            remotePersonService.close();
            remotePersonService.authenticate(serverAddress4DI, dataIntegratorUserName, dataIntegratorPassword,
                    keyServerUserName, keyServerPassword);
            remotePersonService.createDatasetTable(newCBFTableName, cbfColumnInformation,
                    newBFDataset.getTotalRecords(), false);
        }

        long firstResult = 0L;
        long personId = 0L;
        boolean morePatients = true;
        List<Person> cbfPersons = new ArrayList<Person>();
        do {
            List<Person> persons = personQueryService.getPersonsPaged(newBFTableName, firstResult,
                    Constants.PAGE_SIZE);
            morePatients = (persons != null && persons.size() > 0);
            if (morePatients) {
                cbfPersons.clear();
                for (Person person : persons) {
                    Person cbfPerson = generateCBFWithOverSamplingAndPermutation(person, cbfLength, rnd,
                            sharedSecret, bitPermutation, columnMatchInformation, leftOrRightSide);
                    cbfPerson.setPersonId(personId++);
                    // Add piggy backing no-match columns
                    for (String ncn : noMatchColumnNames)
                        cbfPerson.setAttribute(ncn, person.getAttribute(ncn));
                    cbfPersons.add(cbfPerson);
                }
                personManagerService.addPersons(newCBFTableName, cbfPersons, false, false);
                // Submit the new Dataset to the DataIntegrator at the same time of the local persistence
                if (!isLocalAddress(serverAddress4DI))
                    remotePersonService.addPersons(newCBFTableName, cbfPersons, false, false);
            }
            firstResult += persons.size();
        } while (morePatients);
        personManagerService.addIndexesAndConstraintsToDatasetTable(newCBFTableName, firstResult + 1);

        String matchPairStatHalfTableName = null;
        // We don't use pseudoIds for local experiments, so no need to resolve them
        if (!isLocalAddress(serverAddress4DI)) {
            remotePersonService.addIndexesAndConstraintsToDatasetTable(newCBFTableName, firstResult + 1);

            // No point in sending matchPairStatHalves in case there's a random bit selection blocking at DI => matchPairStatHalves == null
            if (matchPairStatHalves != null) {
                // Resolve pseudo Ids if appicable before sending it to DI
                for (MatchPairStatHalf matchPairStatHalf : matchPairStatHalves) {
                    long id = matchPairStatHalf.getPersonPseudoId();
                    long id2 = personPseudoIdsReverseLookup != null ? personPseudoIdsReverseLookup.get(id) : id;
                    matchPairStatHalf.setPersonPseudoId(id2);
                }

                // Submit the match pair stat half information separately from the match request
                matchPairStatHalfTableName = remoteTableName + "_"
                        + /*UniversalDaoHibernate.MATCHPAIRSTAT_TABLE_NAME_EXTRA_PREFIX + "_" +*/ getNowString(); // including timestamp to avoid collision
                remotePersonService.createMatchPairStatHalfTable(getName(), matchPairStatHalfTableName,
                        newCBFTableName, false);
                int i = 0;
                List<MatchPairStatHalf> matchPairStatHalvesPart = new ArrayList<MatchPairStatHalf>();
                do {
                    int j = 0;
                    while (j < Constants.PAGE_SIZE && i < matchPairStatHalves.size()) {
                        matchPairStatHalvesPart.add(matchPairStatHalves.get(i));
                        i++;
                        j++;
                    }
                    remotePersonService.addMatchPairStatHalves(getName(), matchPairStatHalfTableName,
                            matchPairStatHalvesPart);
                    matchPairStatHalvesPart.clear();
                } while (i < matchPairStatHalves.size());
                remotePersonService.addIndexesAndConstraintsToMatchPairStatHalfTable(getName(),
                        matchPairStatHalfTableName, i + 1, newCBFTableName);
            }
        }
    } catch (NamingException e) {
        log.error("Couldn't connect to Data Integrator (" + serverAddress4DI
                + ") to send back advice about new bloom filter parameters");
        e.printStackTrace();
    } catch (Exception e) {
        log.error("Error occured during creation, generation or loading of BF/CBF data");
        e.printStackTrace();
    }
    return newCBFTableName;
}

From source file:org.enlacerh.util.FileUploadController.java

/**
 * Mtodo para recibir los mail jndi//from w w w.j ava  2  s. co  m
 * **/
private String jndimail() {
    String query = "select trim(jndimail) from seg001 where grupo = '" + grupo + "'";
    int rows = 0;
    String[][] vltabla;
    String jndi = "";
    try {
        consulta.selectPntGenerica(query, JNDI);
        rows = consulta.getRows();
        vltabla = consulta.getArray();
        if (rows > 0) {
            jndi = vltabla[0][0];
        }
    } catch (NamingException e) {
        e.printStackTrace();
    }
    return jndi;
}

From source file:org.apache.directory.studio.connection.core.io.jndi.JNDIConnectionWrapper.java

/**
 * Sets the binary attributes.//  w w w. j  av a  2 s  .com
 * 
 * @param binaryAttributes the binary attributes
 */
public void setBinaryAttributes(Collection<String> binaryAttributes) {
    this.binaryAttributes = binaryAttributes;
    StringBuilder sb = new StringBuilder();

    for (String string : binaryAttributes) {
        sb.append(string).append(' ');
    }

    String binaryAttributesString = sb.toString();

    if (environment != null) {
        environment.put(JAVA_NAMING_LDAP_ATTRIBUTES_BINARY, binaryAttributesString);
    }

    if (context != null) {
        try {
            context.addToEnvironment(JAVA_NAMING_LDAP_ATTRIBUTES_BINARY, binaryAttributesString);
        } catch (NamingException e) {
            // TODO: logging
            e.printStackTrace();
        }
    }
}