List of usage examples for java.util Vector addElement
public synchronized void addElement(E obj)
From source file:com.netscape.admin.certsrv.Console.java
/** * get the user and group information.// ww w . j a v a2 s . co m * * @param info console info */ public void initialize(ConsoleInfo info) { setDomainSuffix(_adminServerSIE); LDAPConnection ldc = _info.getLDAPConnection(); if (ldc != null) { LDAPAttribute attribute; Enumeration<String> eAttributes; String ldapLocation = ""; LDAPEntry entry; LDAPSearchResults result; LDAPSearchConstraints cons; // get default object classes container try { ldapLocation = "cn=user, cn=DefaultObjectClassesContainer," + LDAPUtil.getAdminGlobalParameterEntry(); entry = ldc.read(ldapLocation); if (entry != null) { // get the new user / group class information attribute = entry.getAttribute("nsDefaultObjectClass", LDAPUtil.getLDAPAttributeLocale()); if (attribute != null) { Vector<String> vUserObjectClasses = new Vector<>(); eAttributes = attribute.getStringValues(); while (eAttributes.hasMoreElements()) { String sUserObjectClass = eAttributes.nextElement(); vUserObjectClasses.addElement(sUserObjectClass); } ResourceEditor.getNewObjectClasses().put(ResourceEditor.KEY_NEW_USER_OBJECTCLASSES, vUserObjectClasses); } } } catch (LDAPException e) { Debug.println("Console: Cannot open: " + ldapLocation); } if (ResourceEditor.getNewObjectClasses().get(ResourceEditor.KEY_NEW_USER_OBJECTCLASSES) == null) { Vector<String> vObject = new Vector<>(); vObject.addElement("top"); vObject.addElement("person"); vObject.addElement("organizationalPerson"); vObject.addElement("inetorgperson"); ResourceEditor.getNewObjectClasses().put(ResourceEditor.KEY_NEW_USER_OBJECTCLASSES, vObject); } try { ldapLocation = "cn=group, cn=DefaultObjectClassesContainer," + LDAPUtil.getAdminGlobalParameterEntry(); entry = ldc.read(ldapLocation); if (entry != null) { attribute = entry.getAttribute("nsDefaultObjectClass", LDAPUtil.getLDAPAttributeLocale()); if (attribute != null) { Vector<String> vGroupObjectClasses = new Vector<>(); eAttributes = attribute.getStringValues(); while (eAttributes.hasMoreElements()) { String sGroupObjectClass = eAttributes.nextElement(); vGroupObjectClasses.addElement(sGroupObjectClass); } ResourceEditor.getNewObjectClasses().put(ResourceEditor.KEY_NEW_GROUP_OBJECTCLASSES, vGroupObjectClasses); } } } catch (LDAPException e) { Debug.println("Console: Cannot open " + ldapLocation); } if (ResourceEditor.getNewObjectClasses().get(ResourceEditor.KEY_NEW_GROUP_OBJECTCLASSES) == null) { Vector<String> vObject = new Vector<>(); vObject.addElement("top"); vObject.addElement("groupofuniquenames"); ResourceEditor.getNewObjectClasses().put(ResourceEditor.KEY_NEW_GROUP_OBJECTCLASSES, vObject); } try { ldapLocation = "cn=OU, cn=DefaultObjectClassesContainer," + LDAPUtil.getAdminGlobalParameterEntry(); entry = ldc.read(ldapLocation); if (entry != null) { attribute = entry.getAttribute("nsDefaultObjectClass", LDAPUtil.getLDAPAttributeLocale()); if (attribute != null) { Vector<String> vOUObjectClasses = new Vector<>(); eAttributes = attribute.getStringValues(); while (eAttributes.hasMoreElements()) { String sOUObjectClass = eAttributes.nextElement(); vOUObjectClasses.addElement(sOUObjectClass); } ResourceEditor.getNewObjectClasses().put(ResourceEditor.KEY_NEW_OU_OBJECTCLASSES, vOUObjectClasses); } } } catch (LDAPException e) { Debug.println("Console: Cannot open " + ldapLocation); } if (ResourceEditor.getNewObjectClasses().get(ResourceEditor.KEY_NEW_OU_OBJECTCLASSES) == null) { Vector<String> vObject = new Vector<>(); vObject.addElement("top"); vObject.addElement("organizationalunit"); ResourceEditor.getNewObjectClasses().put(ResourceEditor.KEY_NEW_OU_OBJECTCLASSES, vObject); } try { cons = ldc.getSearchConstraints(); cons.setBatchSize(1); // then get the resource editor extension ldapLocation = "cn=ResourceEditorExtension," + LDAPUtil.getAdminGlobalParameterEntry(); result = ldc.search(ldapLocation, LDAPConnection.SCOPE_ONE, "(Objectclass=nsAdminResourceEditorExtension)", null, false, cons); Hashtable<String, Vector<Class<?>>> hResourceEditorExtension = new Hashtable<>(); Hashtable<String, Vector<Class<?>>> deleteResourceEditorExtension = new Hashtable<>(); if (result != null) { while (result.hasMoreElements()) { LDAPEntry ExtensionEntry; try { ExtensionEntry = result.next(); } catch (Exception e) { // ldap exception continue; } attribute = ExtensionEntry.getAttribute("cn", LDAPUtil.getLDAPAttributeLocale()); Enumeration<String> eValues = attribute.getStringValues(); String sCN = ""; while (eValues.hasMoreElements()) { sCN = eValues.nextElement(); // Take the first CN break; } attribute = ExtensionEntry.getAttribute("nsClassname", LDAPUtil.getLDAPAttributeLocale()); if (attribute != null) { eValues = attribute.getStringValues(); Vector<Class<?>> vClass = new Vector<>(); while (eValues.hasMoreElements()) { String sJarClassName = eValues.nextElement(); Class<?> c = ClassLoaderUtil.getClass(_info, sJarClassName); if (c != null) { vClass.addElement(c); } } hResourceEditorExtension.put(sCN.toLowerCase(), vClass); } attribute = ExtensionEntry.getAttribute("nsDeleteClassname", LDAPUtil.getLDAPAttributeLocale()); if (attribute != null) { Enumeration<String> deleteClasses = attribute.getStringValues(); Vector<Class<?>> deleteClassesVector = new Vector<>(); while (deleteClasses.hasMoreElements()) { String jarClassname = deleteClasses.nextElement(); Class<?> c = ClassLoaderUtil.getClass(_info, jarClassname); if (c != null) { deleteClassesVector.addElement(c); } } deleteResourceEditorExtension.put(sCN.toLowerCase(), deleteClassesVector); } } ResourceEditor.setResourceEditorExtension(hResourceEditorExtension); ResourceEditor.setDeleteResourceEditorExtension(deleteResourceEditorExtension); } // set up resource editor attribute ResourceEditor.setUniqueAttribute(LDAPUtil.getUniqueAttribute(_info.getLDAPConnection(), LDAPUtil.getCommonGlobalParameterEntry())); String sLocation = LDAPUtil.getCommonGlobalParameterEntry(); entry = ldc.read(sLocation); if (entry != null) { attribute = entry.getAttribute("nsUserRDNComponent"); String sAttribute = LDAPUtil.flatting(attribute); ResourceEditor.setUserRDNComponent(sAttribute); attribute = entry.getAttribute("nsUserIDFormat"); sAttribute = LDAPUtil.flatting(attribute); ResourceEditor.setUserIDFormat(sAttribute); attribute = entry.getAttribute("nsGroupRDNComponent"); sAttribute = LDAPUtil.flatting(attribute); ResourceEditor.setGroupRDNComponent(sAttribute); } ResourceEditor.setAccountPlugin(buildAccountPluginHashtable()); } catch (LDAPException e) { Debug.println("Console: Cannot open " + ldapLocation); } // this *should* already be created at install time, but just in case // note: if this entry is created here, then ACIs (for non-admins) will break String userPreferenceDN = LDAPUtil.createEntry(ldc, LDAPUtil.getUserPreferenceOU(), LDAPUtil.getInstalledSoftwareDN()); userPreferenceDN = LDAPUtil.createEntry(ldc, "\"" + _info.getAuthenticationDN() + "\"", userPreferenceDN, true); _info.setUserPreferenceDN(userPreferenceDN); } checkHelpSystem(); }
From source file:com.netscape.admin.certsrv.Console.java
public Console(String adminURL, String localAdminURL, String language, String host, String uid, String passwd) { Vector<String> recentURLs = new Vector<>(); String lastUsedURL;//from www . j a v a2 s . c o m common_init(language); String userid = uid; String password = passwd; if (userid == null) { userid = _preferences.getString(PREFERENCE_UID); } lastUsedURL = _preferences.getString(PREFERENCE_URL); if (lastUsedURL != null) { recentURLs.addElement(lastUsedURL); if (adminURL == null) { adminURL = lastUsedURL; } } if (adminURL == null) { adminURL = localAdminURL; } for (int count = 1; count < MAX_RECENT_URLS; count++) { String temp; temp = _preferences.getString(PREFERENCE_URL + Integer.toString(count)); if (temp != null && temp.length() > 0) recentURLs.addElement(temp); } _frame = new JFrame(); // Set the icon image so that login dialog will inherit it _frame.setIconImage(new RemoteImage("com/netscape/management/client/images/logo16.gif").getImage()); ModalDialogUtil.setWindowLocation(_frame); //enable server auth UtilConsoleGlobals.setServerAuthEnabled(true); _splashScreen = new com.netscape.management.client.console.SplashScreen(_frame); _splashScreen.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); if (_showSplashScreen) _splashScreen.showWindow(); boolean fSecondTry = false; while (true) { LoginDialog dialog = null; _splashScreen.setStatusText(_resource.getString("splash", "PleaseLogin")); _splashScreen.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if ((adminURL == null) || (userid == null) || (password == null) || (fSecondTry)) { dialog = new LoginDialog(_frame, userid, adminURL, recentURLs); Dimension paneSize = dialog.getSize(); Dimension screenSize = dialog.getToolkit().getScreenSize(); int centerX = (screenSize.width - paneSize.width) / 2; int centerY = (screenSize.height - paneSize.height) / 2; int x = _preferences.getInt(PREFERENCE_X, centerX); int y = _preferences.getInt(PREFERENCE_Y, centerY); UtilConsoleGlobals.setAdminURL(adminURL); UtilConsoleGlobals.setAdminHelpURL(adminURL); dialog.setInitialLocation(x, y); _splashScreen.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); dialog.showModal(); if (dialog.isCancel()) System.exit(0); _splashScreen.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); userid = dialog.getUsername(); adminURL = dialog.getURL(); if (!adminURL.startsWith("http://") && !adminURL.startsWith("https://")) adminURL = "http://" + adminURL; password = dialog.getPassword(); } fSecondTry = true; UtilConsoleGlobals.setAdminURL(adminURL); UtilConsoleGlobals.setAdminHelpURL(adminURL); _consoleAdminURL = adminURL; _splashScreen.setStatusText( MessageFormat.format(_resource.getString("splash", "authenticate"), new Object[] { userid })); if (authenticate_user(adminURL, _info, userid, password)) { _splashScreen.setStatusText(_resource.getString("splash", "initializing")); /** * Initialize ldap. In the case config DS is down, the user can restart * the DS from the Console. The Console will need to re-authenticate * the user if that's the case. */ int ldapInitResult = LDAPinitialization(_info); if (ldapInitResult == LDAP_INIT_FAILED) { Debug.println("Console: LDAPinitialization() failed."); System.exit(1); } else if (ldapInitResult == LDAP_INIT_DS_RESTART) { Debug.println("Console: LDAPinitialization() DS restarted."); // Need to re-authenticate the user _splashScreen.setStatusText(MessageFormat.format(_resource.getString("splash", "authenticate"), new Object[] { userid })); if (authenticate_user(adminURL, _info, userid, password)) { _splashScreen.setStatusText(_resource.getString("splash", "initializing")); if (LDAPinitialization(_info) == LDAP_INIT_FAILED) { Debug.println("Console: LDAPinitialization() failed."); System.exit(1); } } else { continue; // Autentication faled, try again } } else if (ldapInitResult == LDAP_INIT_BIND_FAIL) { continue; } boolean rememberUserid = _preferences.getBoolean(PREFERENCE_REMEMBER_UID, true); if (rememberUserid) { _preferences.set(PREFERENCE_UID, userid); _preferences.set(PREFERENCE_URL, adminURL); String recentlyUsedURL; int count = 1; Enumeration<String> urlEnum = recentURLs.elements(); while (urlEnum.hasMoreElements()) { recentlyUsedURL = urlEnum.nextElement(); if (!recentlyUsedURL.equals(adminURL)) _preferences.set(PREFERENCE_URL + Integer.toString(count++), recentlyUsedURL); } for (; count < MAX_RECENT_URLS; count++) { _preferences.remove(PREFERENCE_URL + Integer.toString(count)); } if (dialog != null) { Point p = dialog.getLocation(); _preferences.set(PREFERENCE_X, p.x); _preferences.set(PREFERENCE_Y, p.y); dialog.dispose(); dialog = null; } _preferences.save(); } initialize(_info); if (host == null) { Framework framework = createTopologyFrame(); UtilConsoleGlobals.setRootFrame(framework.getJFrame()); } else { // popup the per server configuration UI // first get the java class name createPerInstanceUI(host); } _frame.dispose(); _splashScreen.dispose(); com.netscape.management.client.console.SplashScreen.removeInstance(); _splashScreen = null; break; } } }
From source file:com.dragonflow.StandardMonitor.URLMonitor.java
public Vector getScalarValues(ScalarProperty scalarproperty, HTTPRequest httprequest, CGI cgi) throws SiteViewException { if (scalarproperty == pCheckContent) { Vector vector = new Vector(); vector.addElement(""); vector.addElement("no content checking"); vector.addElement("on"); vector.addElement("compare to last contents "); vector.addElement("baseline"); vector.addElement("compare to saved contents"); vector.addElement("reset"); vector.addElement("reset saved contents"); return vector; }//from ww w . j a v a2 s . c o m if (scalarproperty == pEncodePostData) { Vector vector1 = new Vector(); vector1.addElement(urlencodedDropDown[0]); vector1.addElement(urlencodedDropDown[1]); vector1.addElement(urlencodedDropDown[2]); vector1.addElement(urlencodedDropDown[3]); vector1.addElement(urlencodedDropDown[4]); vector1.addElement(urlencodedDropDown[5]); return vector1; } if (scalarproperty == pWhenToAuthenticate) { Vector vector2 = new Vector(); vector2.addElement(authOn401DropDown[0]); vector2.addElement(authOn401DropDown[1]); vector2.addElement(authOn401DropDown[2]); vector2.addElement(authOn401DropDown[3]); vector2.addElement(authOn401DropDown[4]); vector2.addElement(authOn401DropDown[5]); return vector2; } else { return super.getScalarValues(scalarproperty, httprequest, cgi); } }
From source file:com.vsquaresystem.safedeals.readyreckoner.ReadyReckonerService.java
public Vector read() throws IOException { File excelFile = attachmentUtils .getDirectoryByAttachmentType(AttachmentUtils.AttachmentType.READY_RECKONER); File[] listofFiles = excelFile.listFiles(); String fileName = excelFile + "/" + listofFiles[0].getName(); Vector cellVectorHolder = new Vector(); int type;/*from w ww .j ava 2s .c om*/ try { FileInputStream myInput = new FileInputStream(fileName); XSSFWorkbook myWorkBook = new XSSFWorkbook(myInput); XSSFSheet mySheet = myWorkBook.getSheetAt(0); Iterator rowIter = mySheet.rowIterator(); while (rowIter.hasNext()) { XSSFRow myRow = (XSSFRow) rowIter.next(); Iterator cellIter = myRow.cellIterator(); List list = new ArrayList(); while (cellIter.hasNext()) { XSSFCell myCell = (XSSFCell) cellIter.next(); if (myCell != null) { switch (myCell.getCellType()) { case Cell.CELL_TYPE_BOOLEAN: System.out.println(new DataFormatter().formatCellValue(myCell)); list.add(new DataFormatter().formatCellValue(myCell)); break; case Cell.CELL_TYPE_NUMERIC: System.out.println(new DataFormatter().formatCellValue(myCell)); list.add(new DataFormatter().formatCellValue(myCell)); break; case Cell.CELL_TYPE_STRING: System.out.println(new DataFormatter().formatCellValue(myCell)); list.add(new DataFormatter().formatCellValue(myCell)); break; case Cell.CELL_TYPE_BLANK: break; case Cell.CELL_TYPE_ERROR: System.out.println(new DataFormatter().formatCellValue(myCell)); list.add(new DataFormatter().formatCellValue(myCell)); break; case Cell.CELL_TYPE_FORMULA: break; } } } cellVectorHolder.addElement(list); } } catch (Exception e) { e.printStackTrace(); } return cellVectorHolder; }
From source file:com.netscape.cmscore.usrgrp.UGSubsystem.java
/** * builds a User instance. Sets only uid for user entry retrieved * from LDAP server. for listing efficiency only. * * @return the User entity./* w w w . j ava2 s .c o m*/ */ protected IUser lbuildUser(LDAPEntry entry) throws EUsrGrpException { LDAPAttribute uid = entry.getAttribute("uid"); if (uid == null) { throw new EUsrGrpException("No Attribute UID in LDAP Entry " + entry.getDN()); } IUser id = createUser(this, (String) uid.getStringValues().nextElement()); LDAPAttribute cnAttr = entry.getAttribute("cn"); if (cnAttr != null) { String cn = (String) cnAttr.getStringValues().nextElement(); if (cn != null) { id.setFullName(cn); } } LDAPAttribute certAttr = entry.getAttribute(LDAP_ATTR_USER_CERT); if (certAttr != null) { Vector<X509Certificate> certVector = new Vector<X509Certificate>(); @SuppressWarnings("unchecked") Enumeration<byte[]> e = certAttr.getByteValues(); try { for (; e != null && e.hasMoreElements();) { X509Certificate cert = new X509CertImpl(e.nextElement()); certVector.addElement(cert); } } catch (Exception ex) { throw new EUsrGrpException(CMS.getUserMessage("CMS_INTERNAL_ERROR")); } if (certVector != null && certVector.size() != 0) { // Make an array of certs X509Certificate[] certArray = new X509Certificate[certVector.size()]; Enumeration<X509Certificate> en = certVector.elements(); int i = 0; while (en.hasMoreElements()) { certArray[i++] = en.nextElement(); } id.setX509Certificates(certArray); } } return id; }
From source file:mypackage.State_Stream.java
private void makeAllEntriesAsRead() { // L?MoH??^?[ if (!Network.isCoverageSufficient()) { // ANeBreBCWP?[^?[?? _screen.deleteActivityIndicator(); UiApplication.getUiApplication().invokeLater(new Runnable() { public void run() { Dialog.alert(// w ww .ja v a 2 s .co m "A communication error has occurred. Please make sure your device is connected to Internet."); } }); return; } //if() // _CA?O?o?smF?B int select = Dialog.ask(Dialog.D_OK_CANCEL, "Do you really want to make all entries as read?", Dialog.NO); if (select == Dialog.NO) { return; } new Thread() { public void run() { Vector ids = new Vector(); // ?Gg?[? int num_items = entries.size(); try { // ANeBreBCWP?[^?[\ _screen.showActivityIndicator(); // Gg?[?? for (int i = 0; i < num_items; i++) { Entry _entry = (Entry) entries.elementAt(i); // ??XLbv if (!_entry.isUnread()) { continue; } // Gg?[ _entry.makeAsRead(); // APIGg?[id?B ids.addElement(_entry.getId()); } // Gg?[??^?[ if (ids.size() == 0) { return; } // \?X?V?B _screen.refreshRichList(); // JSONf?[^POST _feedlyapi.markOneOrMultipleArticlesAsRead(ids); } catch (final Exception e) { // sGg?[?B for (int i = 0; i < num_items; i++) { Entry _entry = (Entry) entries.elementAt(i); _entry.makeAsUnread(); } // \?B _screen.refreshRichList(); // G?[?MO updateStatus("makeAllEntriesAsRead() " + e.toString()); // s_CA?O\ UiApplication.getUiApplication().invokeLater(new Runnable() { public void run() { Dialog.alert("An unexpected error occurred while making entries as Read"); } }); } finally { // ANeBreBCWP?[^?[?? _screen.deleteActivityIndicator(); } } //run() }.start(); //Thread() }
From source file:alter.vitro.vgw.service.query.SimpleQueryHandler.java
/** * Aggregate type queries (Aggregated queries are created to be issued per gateway, but they are also * used to be issued per mote sensor)//from w ww.ja v a 2s . com * * @param aggrQuery The QueryAggrMsg that arrived * @param wrpResponse The wrapped Response to be sent as a reply to the query. * @return 0 if the query was processed successfully and -1 if errors were encountered */ public int processAggregateQuery(QueryAggrMsg aggrQuery, int specificQueryId, UserNodeResponse wrpResponse) { // new: these two are needed to associate the security Coap messages at the VSP with partial services // List<MoteType> motesAndTheirSensorAndFunctVec; Vector<QueriedMoteAndSensors> motesAndTheirSensorAndFunctVec; boolean isHist; boolean asynch; boolean encrypt; boolean dtn; boolean security; boolean continuation; Vector<ReqFunctionOverData> reqFunctionVec; // Get the counter of the query. It will be copied to the response message int qCount = aggrQuery.getQuery().getQueryCount(); //Vector fileToSend = new Vector(); String uniqQueryDefID = aggrQuery.getQuery().getQueryDefID().trim(); String value; //Support for various data types is added by the DataTypeAdapter class try { logger.debug("Processing Aggregated query with id " + uniqQueryDefID + " and count: " + Integer.toString(qCount)); motesAndTheirSensorAndFunctVec = aggrQuery.getMotesAndTheirSensorAndFunctVec(); reqFunctionVec = aggrQuery.getReqFunctionVector(); isHist = aggrQuery.getQuery().isIsHistory(); //new 21/03/13 asynch = aggrQuery.getQuery().isAsynch(); encrypt = aggrQuery.getQuery().isEncrypt(); dtn = aggrQuery.getQuery().isDtn(); security = aggrQuery.getQuery().isSecurity(); continuation = aggrQuery.getQuery().isContinuation(); if (dtn) { if (!myDCon.isDTNModeSupported()) { logger.info("DTN mode was requested but is unsupported by this VGW!"); } myDCon.setDtnPolicy(dtn); // this includes in its implementation a check for DTN mode support (we don't have to include it in an else block if (myDCon.getDtnPolicy()) { logger.info("DTN mode was requested and activated!"); } else { logger.info("DTN mode was requested but WAS NOT activated!"); } } // TODO: Fix the code that handles the History function // e.g. Call the function that puts the file (if requested) to be sent into a vector if (isHist) { ; // (++++) } //Perform the search to see if the peer is aware of such an attribute. List<String> out_decidedDeployStatus = new ArrayList<String>(1); // [0] is the original nodeId, [1] the replacing node id and [2] the capability // skip the entries that [0] is the same with [1] List<String[]> out_replacementLocalInfoList = new ArrayList<String[]>(); Vector<ReqResultOverData> allValuesVec = findAggrAttrValue(uniqQueryDefID, motesAndTheirSensorAndFunctVec, reqFunctionVec, out_decidedDeployStatus, out_replacementLocalInfoList); // Get my identity in responderName so that the peer that made the query knows who is answering him // Create the response message. ResponseAggrMsg prm = new ResponseAggrMsg(uniqQueryDefID, myPeerId, myPeerName, allValuesVec, qCount); if (out_decidedDeployStatus != null && out_decidedDeployStatus.size() > 0) { prm.setDeployStatus(out_decidedDeployStatus.get(0)); } Vector<RespServContinuationReplacementStruct> continuationInfoVec = new Vector<RespServContinuationReplacementStruct>(); if (out_replacementLocalInfoList != null && out_replacementLocalInfoList.size() > 0) { for (String[] entryInConList : out_replacementLocalInfoList) { if (entryInConList[0].compareToIgnoreCase(entryInConList[1]) != 0) { RespServContinuationReplacementStruct entryInFinalContList = new RespServContinuationReplacementStruct( entryInConList[0], entryInConList[1], entryInConList[2]); continuationInfoVec.addElement(entryInFinalContList); } } } else { logger.debug("No Replacement info found!"); } prm.setServiceContinuationList(continuationInfoVec); logger.info("Sending response!"); logger.debug(prm.toString()); // Append the response message with some special info. wrpResponse.setQueryId(specificQueryId); wrpResponse.setSrc(myPeerId); //not really needed though wrpResponse.setResponse(prm.toString()); // Send the response to the requesting end user this.sendResponse(wrpResponse.toString()); // Signal that the resolver handled sending the response. return 0; //means OK } catch (Exception e) { // Signal that the query should be re-propagated. logger.error("General exception from processAggregateQuery method", e); return -1; // means error } }
From source file:de.juwimm.cms.remote.ClientServiceSpringImpl.java
private String getParents4View(ViewComponentHbm viewComponent) { try {//from w w w . j a v a2s .com if (viewComponent.getParent().isRoot()) { return "\\"; } } catch (Exception ex) { return "\\"; } Vector<ViewComponentHbm> vec = new Vector<ViewComponentHbm>(); ViewComponentHbm parentView = viewComponent.getParent(); while (parentView.getAssignedUnit() == null) { vec.addElement(parentView); parentView = parentView.getParent(); try { if (parentView.isRoot()) { break; } } catch (Exception ex) { break; } } if (parentView.getAssignedUnit() != null) { vec.addElement(parentView); } StringBuffer sb = new StringBuffer("\\"); for (int i = vec.size() - 1; i > -1; i--) { sb.append((vec.elementAt(i)).getUrlLinkName()); if (i != 0) { sb.append("\\"); } } sb.append("\\").append(viewComponent.getUrlLinkName()); return sb.toString(); }
From source file:com.vsquaresystem.safedeals.marketprice.MarketPriceService.java
public Vector read() throws IOException { File excelFile = attachmentUtils.getDirectoryByAttachmentType(AttachmentUtils.AttachmentType.MARKET_PRICE); File[] listofFiles = excelFile.listFiles(); String fileName = excelFile + "/" + listofFiles[0].getName(); Vector cellVectorHolder = new Vector(); int type;/*from w w w .ja v a 2 s . c o m*/ try { FileInputStream myInput = new FileInputStream(fileName); XSSFWorkbook myWorkBook = new XSSFWorkbook(myInput); XSSFSheet mySheet = myWorkBook.getSheetAt(0); Iterator rowIter = mySheet.rowIterator(); while (rowIter.hasNext()) { XSSFRow myRow = (XSSFRow) rowIter.next(); Iterator cellIter = myRow.cellIterator(); List list = new ArrayList(); while (cellIter.hasNext()) { XSSFCell myCell = (XSSFCell) cellIter.next(); if (myCell != null) { switch (myCell.getCellType()) { case Cell.CELL_TYPE_BOOLEAN: System.out.println(new DataFormatter().formatCellValue(myCell)); list.add(new DataFormatter().formatCellValue(myCell)); break; case Cell.CELL_TYPE_NUMERIC: System.out.println(new DataFormatter().formatCellValue(myCell)); list.add(new DataFormatter().formatCellValue(myCell)); break; case Cell.CELL_TYPE_STRING: System.out.println(new DataFormatter().formatCellValue(myCell)); list.add(new DataFormatter().formatCellValue(myCell)); break; case Cell.CELL_TYPE_BLANK: break; case Cell.CELL_TYPE_ERROR: System.out.println(new DataFormatter().formatCellValue(myCell)); list.add(new DataFormatter().formatCellValue(myCell)); break; case Cell.CELL_TYPE_FORMULA: break; } } } logger.info("Line Line108 {}" + list); System.out.println("MAINlist" + list); cellVectorHolder.addElement(list); } } catch (Exception e) { e.printStackTrace(); } return cellVectorHolder; }
From source file:com.netscape.cmscore.usrgrp.UGSubsystem.java
/** * builds a User instance. Set all attributes retrieved from * LDAP server and set them on User./*from w w w .j a va 2 s . c o m*/ * * @return the User entity. */ protected IUser buildUser(LDAPEntry entry) throws EUsrGrpException { LDAPAttribute uid = entry.getAttribute("uid"); if (uid == null) { throw new EUsrGrpException("No Attribute UID in LDAP Entry " + entry.getDN()); } IUser id = createUser(this, (String) uid.getStringValues().nextElement()); LDAPAttribute cnAttr = entry.getAttribute("cn"); if (cnAttr != null) { String cn = (String) cnAttr.getStringValues().nextElement(); if (cn != null) { id.setFullName(cn); } } String userdn = entry.getDN(); if (userdn != null) { id.setUserDN(userdn); } else { // the impossible log(ILogger.LL_FAILURE, CMS.getLogMessage("CMSCORE_USRGRP_BUILD_USER", userdn)); throw new EUsrGrpException(CMS.getUserMessage("CMS_INTERNAL_ERROR")); } /* LDAPAttribute certdnAttr = entry.getAttribute(LDAP_ATTR_CERTDN); if (certdnAttr != null) { String cdn = (String)certdnAttr.getStringValues().nextElement(); if (cdn != null) { id.setCertDN(cdn); } } */ LDAPAttribute mailAttr = entry.getAttribute("mail"); if (mailAttr != null) { @SuppressWarnings("unchecked") Enumeration<String> en = mailAttr.getStringValues(); if (en != null && en.hasMoreElements()) { String mail = en.nextElement(); if (mail != null) { id.setEmail(mail); } } } if (id.getEmail() == null) { id.setEmail(""); // safety net } LDAPAttribute pwdAttr = entry.getAttribute("userpassword"); if (pwdAttr != null) { String pwd = (String) pwdAttr.getStringValues().nextElement(); if (pwd != null) { id.setPassword(pwd); } } LDAPAttribute phoneAttr = entry.getAttribute("telephonenumber"); if (phoneAttr != null) { @SuppressWarnings("unchecked") Enumeration<String> en = phoneAttr.getStringValues(); if (en != null && en.hasMoreElements()) { String phone = en.nextElement(); if (phone != null) { id.setPhone(phone); } } } if (id.getPhone() == null) { id.setPhone(""); // safety net } LDAPAttribute userTypeAttr = entry.getAttribute("usertype"); if (userTypeAttr == null) id.setUserType(""); else { @SuppressWarnings("unchecked") Enumeration<String> en = userTypeAttr.getStringValues(); if (en != null && en.hasMoreElements()) { String userType = en.nextElement(); if ((userType != null) && (!userType.equals("undefined"))) id.setUserType(userType); else id.setUserType(""); } } LDAPAttribute userStateAttr = entry.getAttribute("userstate"); if (userStateAttr == null) id.setState(""); else { @SuppressWarnings("unchecked") Enumeration<String> en = userStateAttr.getStringValues(); if (en != null && en.hasMoreElements()) { String userState = en.nextElement(); if (userState != null) id.setState(userState); else id.setState(""); } } LDAPAttribute certAttr = entry.getAttribute(LDAP_ATTR_USER_CERT); if (certAttr != null) { Vector<X509Certificate> certVector = new Vector<X509Certificate>(); @SuppressWarnings("unchecked") Enumeration<byte[]> e = certAttr.getByteValues(); try { for (; e != null && e.hasMoreElements();) { X509Certificate cert = new X509CertImpl(e.nextElement()); certVector.addElement(cert); } } catch (Exception ex) { throw new EUsrGrpException(CMS.getUserMessage("CMS_INTERNAL_ERROR")); } if (certVector != null && certVector.size() != 0) { // Make an array of certs X509Certificate[] certArray = new X509Certificate[certVector.size()]; Enumeration<X509Certificate> en = certVector.elements(); int i = 0; while (en.hasMoreElements()) { certArray[i++] = en.nextElement(); } id.setX509Certificates(certArray); } } LDAPAttribute profileAttr = entry.getAttribute(LDAP_ATTR_PROFILE_ID); if (profileAttr != null) { @SuppressWarnings("unchecked") Enumeration<String> profiles = profileAttr.getStringValues(); id.setTpsProfiles(Collections.list(profiles)); } return id; }