List of usage examples for java.util Vector elementAt
public synchronized E elementAt(int index)
From source file:gov.nih.nci.evs.browser.utils.CodeSearchUtils.java
public ResolvedConceptReferencesIteratorWrapper searchByCode(Vector<String> schemes, Vector<String> versions, String matchText, String source, String matchAlgorithm, boolean ranking, int maxToReturn, boolean activeOnly, boolean caseSensitive) { if (matchText == null || matchText.trim().length() == 0) return null; LocalNameList contextList = null;// ww w . ja va 2 s . c o m NameAndValueList qualifierList = null; LocalNameList propertyLnL = null; SortOptionList sortCriteria = null; LocalNameList sourceLnL = null; LocalNameList sourceList = null; LocalNameList restrictToProperties = new LocalNameList(); CodedNodeSet.PropertyType[] propertyTypes = null; boolean resolveConcepts = false; //CodedNodeSet.PropertyType[] types = new PropertyType[] { PropertyType.PRESENTATION }; Vector<CodedNodeSet> cns_vec = new Vector<CodedNodeSet>(); try { matchText = matchText.trim(); String code = matchText; for (int i = 0; i < schemes.size(); i++) { String scheme = (String) schemes.elementAt(i); String version = (String) versions.elementAt(i); CodingSchemeVersionOrTag versionOrTag = new CodingSchemeVersionOrTag(); if (version != null) versionOrTag.setVersion(version); boolean searchInactive = !activeOnly; // Match concept code: CodedNodeSet cns = null; if (caseSensitive) { cns = getCodedNodeSetContainingCode(scheme, version, matchText, source, searchInactive); } else { cns = findCodedNodeSetContainingCode(scheme, version, matchText, source, searchInactive); } CodedNodeSet cns_2 = getCodedNodeSetContainingSourceCode(scheme, version, source, code, maxToReturn, searchInactive); cns = union(cns, cns_2); if (cns != null) { cns_vec.add(cns); } } ResolvedConceptReferencesIterator iterator = new QuickUnionIterator(cns_vec, sortCriteria, null, restrictToProperties, null, resolveConcepts); if (iterator != null) { return new ResolvedConceptReferencesIteratorWrapper(iterator); } } catch (Exception ex) { ex.printStackTrace(); } return null; }
From source file:com.ibm.xsp.webdav.resource.DAVResourceDominoDocuments.java
@SuppressWarnings("deprecation") private void setup(Document curDoc) { try {/*ww w. j a va 2 s.c om*/ // LOGGER.info(getCallingMethod()+":"+"Start setup..."); @SuppressWarnings("rawtypes") Vector allEmbedded = DominoProxy.evaluate("@AttachmentNames", curDoc); // LOGGER.info(getCallingMethod()+":"+"All Embedded computed"); int numOfAttachments = allEmbedded.isEmpty() ? 0 : (allEmbedded.get(0).equals("") ? 0 : allEmbedded.size()); String docID = curDoc.getUniversalID(); this.setDocumentUniqueID(docID); // LOGGER.info("Num of attachments="+new // Integer(numOfAttachments).toString()); boolean readOnly = this.checkReadOnlyAccess(curDoc); this.setReadOnly(readOnly); LOGGER.info("Creation date for " + curDoc.getUniversalID() + " =" + curDoc.getCreated().toString() + "; Time zone=" + curDoc.getCreated().getZoneTime() + "; Local time=" + curDoc.getCreated().getLocalTime()); Date curCreationDate = curDoc.getCreated().toJavaDate(); LOGGER.info("Current date in Java is " + curCreationDate.toString() + "Time zone=" + new Integer(curCreationDate.getTimezoneOffset()).toString() + "; Locale time is:" + curCreationDate.toLocaleString()); if (curDoc.hasItem("DAVCreated")) { // Item davCreated=curDoc.getFirstItem("DAVCreated"); @SuppressWarnings("rawtypes") Vector times = curDoc.getItemValueDateTimeArray("DAVCreated"); if (times != null) { if (times.size() > 0) { Object time = times.elementAt(0); if (time != null) { if (time.getClass().getName().endsWith("DateTime")) { curCreationDate = ((DateTime) time).toJavaDate(); if (curCreationDate == null) { curCreationDate = curDoc.getCreated().toJavaDate(); } } } } } } Date curChangeDate = curDoc.getLastModified().toJavaDate(); if (curDoc.hasItem("DAVModified")) { @SuppressWarnings("rawtypes") Vector times = curDoc.getItemValueDateTimeArray("DAVModified"); if (times != null) { if (times.size() > 0) { Object time = times.elementAt(0); if (time != null) { if (time.getClass().getName().endsWith("DateTime")) { curChangeDate = ((DateTime) time).toJavaDate(); if (curChangeDate == null) { curChangeDate = curDoc.getLastModified().toJavaDate(); } } } } } } this.setCreationDate(curCreationDate); this.setLastModified(curChangeDate); LOGGER.info("Creation date is set to " + this.getCreationDate().toString()); LOGGER.info("Last modified date is set to " + this.getLastModified().toString()); String pubHRef = ((IDAVAddressInformation) this.getRepository()).getPublicHref(); // LOGGER.info("THIS getpublichref="+this.getPublicHref()); String curAttName = null; if (numOfAttachments == 0) { // LOGGER.info(getCallingMethod()+":"+"Start setting resource"); this.setName(docID); String name = curDoc.getItemValueString( ((DAVRepositoryDominoDocuments) (this.getRepository())).getDirectoryField()); this.setName(name); if (this.getPublicHref().equals("")) { // try{ this.setPublicHref(pubHRef + "/" + name); // URLEncoder.encode(name, "UTF-8")); // }catch(UnsupportedEncodingException e){ // LOGGER.error(e); // } } this.setCollection(true); this.setInternalAddress( ((IDAVAddressInformation) this.getRepository()).getInternalAddress() + "/" + docID); this.setResourceType("NotesDocument"); this.setMember(false); this.setContentLength(0L); // this.fetchChildren(); } else { curAttName = allEmbedded.get(0).toString(); // LOGGER.info("Attachment name is "+curAttName); this.setMember(true); this.setResourceType("NotesAttachment"); if (this.getPublicHref().equals("")) { try { this.setPublicHref(pubHRef + "/" + URLEncoder.encode(curAttName, "UTF-8")); } catch (UnsupportedEncodingException e) { LOGGER.error(e); } // this.setPublicHref( pubHRef+"/"+curAttName); } this.setInternalAddress(((IDAVAddressInformation) this.getRepository()).getInternalAddress() + "/" + docID + "/$File/" + curAttName); this.setCollection(false); this.setName(curAttName); EmbeddedObject curAtt = curDoc.getAttachment(curAttName); if (curAtt == null) { // LOGGER.info("Error! Current Embedded is null"); return; } else { // LOGGER.info("Embedded is not null. OK! "); } Long curSize = new Long(curAtt.getFileSize()); this.setContentLength(curSize); } // LOGGER.info("Current res realized! pubHREF="+this.getPublicHref()+"; Internal Address="+this.getInternalAddress()+"; "); } catch (NotesException ne) { LOGGER.error("ERROR! Can not set; " + ne.getMessage()); } }
From source file:org.apache.axis.wsdl.toJava.JavaGeneratorFactory.java
/** * The --all flag is set on the command line (or generateAll(true) is called * on WSDL2Java). Set all symbols as referenced (except nonSOAP bindings * which we don't know how to deal with). *///from w ww . jav a 2s . co m protected void setAllReferencesToTrue() { Iterator it = symbolTable.getHashMap().values().iterator(); while (it.hasNext()) { Vector v = (Vector) it.next(); for (int i = 0; i < v.size(); ++i) { SymTabEntry entry = (SymTabEntry) v.elementAt(i); if ((entry instanceof BindingEntry) && ((BindingEntry) entry).getBindingType() != BindingEntry.TYPE_SOAP) { entry.setIsReferenced(false); } else { entry.setIsReferenced(true); } } } }
From source file:org.jopac2.jbal.iso2709.Unimarc.java
/** * Indicator 1: Title Significance Indicator * /*w w w . j a v a 2 s .c om*/ * This specifies whether the agency preparing the record considers that the title proper as specified in the first $a subfield deserves treatment as an access point. This corresponds to making a title added entry or treating the title as main entry under certain cataloguing codes. * * 0 Title is not significant * This title does not warrant an added entry. * * 1 Title is significant * An access point is to be made from this title. * * For access points for any title other than the first occurring title proper, see RELATED FIELDS below. * * Indicator 2: blank (not defined) * * 200 $a ; $a [] $b . $c = $d : $e / $f ; $g . $h ,. $i * */ public String getTitle() { String r = ""; Tag tag = getFirstTag("200"); if (tag != null) { Vector<Field> a = tag.getFields("a"); if (a != null && a.size() > 0) { r = a.elementAt(0).getContent(); for (int i = 1; i < a.size(); i++) r += " ; " + a.elementAt(i).getContent(); r += Utils.ifExists(" [] ", tag.getField("b")); r += Utils.ifExists(" . ", tag.getField("c")); r += Utils.ifExists(" = ", tag.getField("d")); r += Utils.ifExists(" : ", tag.getField("e")); r += Utils.ifExists(" / ", tag.getField("f")); r += Utils.ifExists(" ; ", tag.getField("g")); r += Utils.ifExists(" . ", tag.getField("h")); r += Utils.ifExists(" , ", tag.getField("i")); } } return Field.printableNSBNSE(r); }
From source file:org.apache.axis.wsdl.toJava.JavaGeneratorFactory.java
/** * Fill in the names of each SymTabEntry with the javaified name. * Note: This method also ensures that anonymous types are * given unique java type names./*from w ww . ja v a 2s .co m*/ * * @param symbolTable */ protected void javifyNames(SymbolTable symbolTable) { int uniqueNum = 0; HashMap anonQNames = new HashMap(); Iterator it = symbolTable.getHashMap().values().iterator(); while (it.hasNext()) { Vector v = (Vector) it.next(); for (int i = 0; i < v.size(); ++i) { SymTabEntry entry = (SymTabEntry) v.elementAt(i); if (entry.getName() != null) { continue; } // Use the type or the referenced type's QName to generate the java name. if (entry instanceof TypeEntry) { uniqueNum = javifyTypeEntryName(symbolTable, (TypeEntry) entry, anonQNames, uniqueNum); } // If it is not a type, then use this entry's QName to // generate its name. else { entry.setName(emitter.getJavaName(entry.getQName())); } } } }
From source file:org.apache.axis.wsdl.toJava.JavaGeneratorFactory.java
/** * setFaultContext:// w w w . j av a2s . c om * Processes the symbol table and sets the COMPLEX_TYPE_FAULT * on each TypeEntry that is a complexType and is referenced in * a fault message. TypeEntries that are the base or derived * from such a TypeEntry are also marked with COMPLEX_TYPE_FAULT. * The containing MessageEntry is marked with cOMPLEX_TYPE_FAULT, and * all MessageEntries for faults are tagged with the * EXCEPTION_CLASS_NAME variable, which indicates the java exception * class name. * * @param symbolTable SymbolTable */ private void setFaultContext(SymbolTable symbolTable) { Iterator it = symbolTable.getHashMap().values().iterator(); while (it.hasNext()) { Vector v = (Vector) it.next(); for (int i = 0; i < v.size(); ++i) { SymTabEntry entry = (SymTabEntry) v.elementAt(i); // Inspect each BindingEntry in the Symbol Table if (entry instanceof BindingEntry) { BindingEntry bEntry = (BindingEntry) entry; HashMap allOpFaults = bEntry.getFaults(); Iterator ops = allOpFaults.values().iterator(); // set the context for all faults for this binding. while (ops.hasNext()) { ArrayList faults = (ArrayList) ops.next(); for (int j = 0; j < faults.size(); ++j) { FaultInfo info = (FaultInfo) faults.get(j); setFaultContext(info, symbolTable); } } } } } }
From source file:org.apache.axis.wsdl.toJava.JavaGeneratorFactory.java
/** * If a binding's type is not TYPE_SOAP, then we don't use that binding * or that binding's portType.// w ww . j a v a 2 s . c o m * * @param symbolTable */ protected void ignoreNonSOAPBindings(SymbolTable symbolTable) { // Look at all uses of the portTypes. If none of the portType's bindings are of type // TYPE_SOAP, then turn off that portType's isReferenced flag. Vector unusedPortTypes = new Vector(); Vector usedPortTypes = new Vector(); Iterator it = symbolTable.getHashMap().values().iterator(); while (it.hasNext()) { Vector v = (Vector) it.next(); for (int i = 0; i < v.size(); ++i) { SymTabEntry entry = (SymTabEntry) v.elementAt(i); if (entry instanceof BindingEntry) { BindingEntry bEntry = (BindingEntry) entry; Binding binding = bEntry.getBinding(); PortType portType = binding.getPortType(); PortTypeEntry ptEntry = symbolTable.getPortTypeEntry(portType.getQName()); if (bEntry.getBindingType() == BindingEntry.TYPE_SOAP) { // If a binding is of type TYPE_SOAP, then mark its portType used // (ie., add it to the usedPortTypes list. If the portType was // previously marked as unused, unmark it (in other words, remove it // from the unusedPortTypes list). usedPortTypes.add(ptEntry); if (unusedPortTypes.contains(ptEntry)) { unusedPortTypes.remove(ptEntry); } } else { bEntry.setIsReferenced(false); // If a binding is not of type TYPE_SOAP, then mark its portType as // unused ONLY if it hasn't already been marked as used. if (!usedPortTypes.contains(ptEntry)) { unusedPortTypes.add(ptEntry); } } } } } // Go through all the portTypes that are marked as unused and set their isReferenced flags // to false. for (int i = 0; i < unusedPortTypes.size(); ++i) { PortTypeEntry ptEntry = (PortTypeEntry) unusedPortTypes.get(i); ptEntry.setIsReferenced(false); } }
From source file:com.ibm.xsp.webdav.resource.DAVResourceDominoDocuments.java
private void setup(IDAVRepository rep, String url, boolean isMember) throws DAVNotFoundException { // Store a link to the repository this.setOwner(rep); try {//from www.j a v a2 s. c o m url = java.net.URLDecoder.decode(url, "UTF-8"); } catch (Exception e) { } // LOGGER.info("DAVResouceDomino for "+url+"; Directory field="+((DAVRepositoryDominoDocuments)(this.getRepository())).getDirectoryField()); try { // url=java.net.URLDecoder.decode(url, "utf-8"); // url=url.replace('+', ' '); } catch (Exception e) { } // The path can't be null and can't be empty. if it is empty we use "/" if (url == null || url.equals("")) { url = new String("/"); } String unid = null; try { unid = this.getNameFromInternalAddress(url); } catch (Exception e) { LOGGER.error(e); } if (isValidUNID(unid) || (url.equals("/"))) { // is a document this.setCollection(true); } else { this.setCollection(false); } // Memorize the url requested try { this.setPublicHref(URLEncoder.encode(url, "UTF-8")); } catch (UnsupportedEncodingException e) { LOGGER.error(e); } this.setPublicHref(url); // Get the file-path and a new file LOGGER.info("Input url=" + url); String fpath = rep.getInternalAddressFromExternalUrl(url, "DAVREsourceDomino-setup"); // Keep the address IDAVAddressInformation repAdr = (IDAVAddressInformation) this.getRepository(); LOGGER.info("-----repositoryInternalAddr=" + repAdr.getInternalAddress()); LOGGER.info("FPATH=" + fpath); LOGGER.info("-----repositorypubhref=" + repAdr.getPublicHref()); LOGGER.info("url=" + url); // if(repAdr.getInternalAddress().equals(fpath) && // (!url.startsWith(repAdr.getPublicHref()))){ // throw new DAVNotFoundException(); // } if (fpath.equals("")) { throw new DAVNotFoundException(); } this.setInternalAddress(fpath); // LOGGER.info("Output url="+fpath); // FIXME XXX TODO Borked code! // Next check -- if Repository and Resource have the same path then the // resource it top level if (fpath.equals(((IDAVAddressInformation) rep).getInternalAddress())) { // LOGGER.info("Repository and Resource address match:"+fpath); this.setName(((IDAVAddressInformation) rep).getName()); // LOGGER.info(this.getName()+" is the repository-resource at "+this.getInternalAddress()); this.setCollection(true); this.setResourceType("DominoRepository"); this.setMember(false); } else { // It is a notes artifact String newName = null; try { newName = this.getNameFromInternalAddress(this.getInternalAddress()); } catch (Exception e) { LOGGER.error(e); } try { newName = java.net.URLDecoder.decode(newName, "utf-8"); } catch (Exception e) { } this.setName(newName); this.setDominoResourceType(); this.validateResourceExists(); String intAddress = this.getInternalAddress(); int lastFile = intAddress.lastIndexOf("/$File/"); if (lastFile > 0) { intAddress = intAddress.substring(0, lastFile); // LOGGER.info("Try resolve doc with internal address="+intAddress); Base notesObj = DominoProxy.resolve(intAddress); if (notesObj == null) { } else { if (notesObj instanceof Document) { Document curDoc = (Document) notesObj; try { this.setDocumentUniqueID(curDoc.getUniversalID()); boolean readOnly = this.checkReadOnlyAccess(curDoc); this.setReadOnly(readOnly); // LOGGER.info("Resolved to info doc "+curDoc.getUniversalID()); Date curCreationDate = curDoc.getCreated().toJavaDate(); if (curDoc.hasItem("DAVCreated")) { @SuppressWarnings("rawtypes") Vector times = curDoc.getItemValueDateTimeArray("DAVCreated"); if (times != null) { Object time = times.elementAt(0); if (time != null) { if (time.getClass().getName().endsWith("DateTime")) { curCreationDate = ((DateTime) time).toJavaDate(); if (curCreationDate == null) { curCreationDate = curDoc.getCreated().toJavaDate(); } } } } } Date curChangeDate = curDoc.getLastModified().toJavaDate(); if (curDoc.hasItem("DAVModified")) { @SuppressWarnings("rawtypes") Vector times = curDoc.getItemValueDateTimeArray("DAVModified"); if (times != null) { Object time = times.elementAt(0); if (time != null) { if (time.getClass().getName().endsWith("DateTime")) { curChangeDate = ((DateTime) time).toJavaDate(); if (curChangeDate == null) { curChangeDate = curDoc.getLastModified().toJavaDate(); } } } } } this.setCreationDate(curCreationDate); this.setLastModified(curChangeDate); EmbeddedObject curAtt = curDoc.getAttachment(this.getName()); // Content length if (curAtt != null) { this.setContentLength(new Long(curAtt.getFileSize()).longValue()); } } catch (NotesException e) { } } else { } } // end else if // TODO: figure out read/write access LOGGER.debug(this.getName() + " is a " + this.getResourceType() + " resource at " + this.getInternalAddress()); } else { Base notesObj = DominoProxy.resolve(intAddress); if (notesObj == null) { } else { if (notesObj instanceof Document) { Document curDoc = (Document) notesObj; try { this.setDocumentUniqueID(curDoc.getUniversalID()); boolean readOnly = this.checkReadOnlyAccess(curDoc); this.setReadOnly(readOnly); String name = curDoc.getItemValueString( ((DAVRepositoryDominoDocuments) (this.getRepository())).getDirectoryField()); this.setName(name); } catch (NotesException ne) { } } } } } this.setMember(isMember); if (!this.isMember()) { // search for members (children) this.fetchChildren(); } }
From source file:org.apache.axis.wsdl.toJava.JavaGeneratorFactory.java
/** * Method determineInterfaceNames//w ww .ja v a 2s . c om * * @param symbolTable */ protected void determineInterfaceNames(SymbolTable symbolTable) { Iterator it = symbolTable.getHashMap().values().iterator(); while (it.hasNext()) { Vector v = (Vector) it.next(); for (int i = 0; i < v.size(); ++i) { SymTabEntry entry = (SymTabEntry) v.elementAt(i); if (entry instanceof BindingEntry) { // The SEI (Service Endpoint Interface) name // is always the portType name. BindingEntry bEntry = (BindingEntry) entry; PortTypeEntry ptEntry = symbolTable .getPortTypeEntry(bEntry.getBinding().getPortType().getQName()); String seiName = getServiceEndpointInterfaceJavaNameHook(ptEntry, bEntry); if (seiName == null) { seiName = ptEntry.getName(); } bEntry.setDynamicVar(JavaBindingWriter.INTERFACE_NAME, seiName); } else if (entry instanceof ServiceEntry) { ServiceEntry sEntry = (ServiceEntry) entry; String siName = getServiceInterfaceJavaNameHook(sEntry); // for derived class if (siName != null) { sEntry.setName(siName); } Service service = sEntry.getService(); Map portMap = service.getPorts(); Iterator portIterator = portMap.values().iterator(); while (portIterator.hasNext()) { Port p = (Port) portIterator.next(); Binding binding = p.getBinding(); BindingEntry bEntry = symbolTable.getBindingEntry(binding.getQName()); // If this isn't a SOAP binding, skip it if (bEntry.getBindingType() != BindingEntry.TYPE_SOAP) { continue; } String portName = getPortJavaNameHook(p.getName()); // for derived class if (portName != null) { bEntry.setDynamicVar(JavaServiceWriter.PORT_NAME + ":" + p.getName(), portName); } } } } } }
From source file:org.fusesource.meshkeeper.distribution.provisioner.embedded.Execute.java
/** * Patch the current environment with the new values from the user. * @return the patched environment./* w ww. j a v a 2s. c o m*/ */ @SuppressWarnings("unchecked") private String[] patchEnvironment() { // On OpenVMS Runtime#exec() doesn't support the environment array, // so we only return the new values which then will be set in // the generated DCL script, inheriting the parent process environment if (Os.isFamily("openvms")) { return env; } Vector<String> osEnv = (Vector<String>) getProcEnvironment().clone(); for (int i = 0; i < env.length; i++) { String keyValue = env[i]; // Get key including "=" String key = keyValue.substring(0, keyValue.indexOf('=') + 1); if (environmentCaseInSensitive) { // Nb: using default locale as key is a env name key = key.toLowerCase(); } int size = osEnv.size(); // Find the key in the current enviroment copy // and remove it. for (int j = 0; j < size; j++) { String osEnvItem = (String) osEnv.elementAt(j); String convertedItem = environmentCaseInSensitive ? osEnvItem.toLowerCase() : osEnvItem; if (convertedItem.startsWith(key)) { osEnv.removeElementAt(j); if (environmentCaseInSensitive) { // Use the original casiness of the key keyValue = osEnvItem.substring(0, key.length()) + keyValue.substring(key.length()); } break; } } // Add the key to the enviromnent copy osEnv.addElement(keyValue); } return (String[]) (osEnv.toArray(new String[osEnv.size()])); }