List of usage examples for java.util Vector addAll
public boolean addAll(Collection<? extends E> c)
From source file:org.tinygroup.jspengine.compiler.JspConfig.java
/** * Find a property that best matches the supplied resource. * @param uri the resource supplied.// w w w .jav a 2 s .co m * @return a JspProperty indicating the best match, or some default. */ public JspProperty findJspProperty(String uri) throws JasperException { // JSP Configuration settings do not apply to tag files if (jspProperties == null || uri.endsWith(".tag") || uri.endsWith(".tagx")) { return defaultJspProperty; } String uriPath = null; int index = uri.lastIndexOf('/'); if (index >= 0) { uriPath = uri.substring(0, index + 1); } String uriExtension = null; index = uri.lastIndexOf('.'); if (index >= 0) { uriExtension = uri.substring(index + 1); } Vector includePreludes = new Vector(); Vector includeCodas = new Vector(); JspPropertyGroup isXmlMatch = null; JspPropertyGroup elIgnoredMatch = null; JspPropertyGroup scriptingInvalidMatch = null; JspPropertyGroup trimSpacesMatch = null; JspPropertyGroup poundAllowedMatch = null; JspPropertyGroup pageEncodingMatch = null; Iterator iter = jspProperties.iterator(); while (iter.hasNext()) { JspPropertyGroup jpg = (JspPropertyGroup) iter.next(); JspProperty jp = jpg.getJspProperty(); // (arrays will be the same length) String extension = jpg.getExtension(); String path = jpg.getPath(); if (extension == null) { // exact match pattern: /a/foo.jsp if (!uri.equals(path)) { // not matched; continue; } } else { // Matching patterns *.ext or /p/* if (path != null && uriPath != null && !uriPath.startsWith(path)) { // not matched continue; } if (!extension.equals("*") && !extension.equals(uriExtension)) { // not matched continue; } } // We have a match // Add include-preludes and include-codas if (jp.getIncludePrelude() != null) { includePreludes.addAll(jp.getIncludePrelude()); } if (jp.getIncludeCoda() != null) { includeCodas.addAll(jp.getIncludeCoda()); } // If there is a previous match for the same property, remember // the one that is more restrictive. if (jp.isXml() != null) { isXmlMatch = selectProperty(isXmlMatch, jpg); } if (jp.isELIgnored() != null) { elIgnoredMatch = selectProperty(elIgnoredMatch, jpg); } if (jp.isScriptingInvalid() != null) { scriptingInvalidMatch = selectProperty(scriptingInvalidMatch, jpg); } if (jp.getPageEncoding() != null) { pageEncodingMatch = selectProperty(pageEncodingMatch, jpg); } if (jp.getTrimSpaces() != null) { trimSpacesMatch = selectProperty(trimSpacesMatch, jpg); } if (jp.getPoundAllowed() != null) { poundAllowedMatch = selectProperty(poundAllowedMatch, jpg); } } String isXml = defaultIsXml; String isELIgnored = defaultIsELIgnored; String isScriptingInvalid = defaultIsScriptingInvalid; String trimSpaces = defaultTrimSpaces; String poundAllowed = defaultPoundAllowed; String pageEncoding = null; if (isXmlMatch != null) { isXml = isXmlMatch.getJspProperty().isXml(); } if (elIgnoredMatch != null) { isELIgnored = elIgnoredMatch.getJspProperty().isELIgnored(); } if (scriptingInvalidMatch != null) { isScriptingInvalid = scriptingInvalidMatch.getJspProperty().isScriptingInvalid(); } if (trimSpacesMatch != null) { trimSpaces = trimSpacesMatch.getJspProperty().getTrimSpaces(); } if (poundAllowedMatch != null) { poundAllowed = poundAllowedMatch.getJspProperty().getPoundAllowed(); } if (pageEncodingMatch != null) { pageEncoding = pageEncodingMatch.getJspProperty().getPageEncoding(); } return new JspProperty(isXml, isELIgnored, isScriptingInvalid, trimSpaces, poundAllowed, pageEncoding, includePreludes, includeCodas); }
From source file:org.apache.axis.wsdl.toJava.JavaGeneratorFactory.java
/** * Messages, PortTypes, Bindings, and Services can share the same name. If they do in this * Definition, force their names to be suffixed with _PortType and _Service, respectively. * * @param symbolTable/*from ww w . j a v a 2 s. c om*/ */ protected void resolveNameClashes(SymbolTable symbolTable) { // Keep a list of anonymous types so we don't try to resolve them twice. HashSet anonTypes = new HashSet(); List collisionCandidates = new ArrayList(); // List of vector of SymbolTable entry List localParts = new ArrayList(); // all localparts in all symboltable entries for (Iterator i = symbolTable.getHashMap().keySet().iterator(); i.hasNext();) { QName qName = (QName) i.next(); String localPart = qName.getLocalPart(); if (!localParts.contains(localPart)) localParts.add(localPart); } Map pkg2NamespacesMap = emitter.getNamespaces().getPkg2NamespacesMap(); for (Iterator i = pkg2NamespacesMap.values().iterator(); i.hasNext();) { Vector namespaces = (Vector) i.next(); // namepaces mapped to same package // Combine entry vectors, which have the same entry name, into a new entry vector. for (int j = 0; j < localParts.size(); j++) { Vector v = new Vector(); for (int k = 0; k < namespaces.size(); k++) { QName qName = new QName((String) namespaces.get(k), (String) localParts.get(j)); if (symbolTable.getHashMap().get(qName) != null) { v.addAll((Vector) symbolTable.getHashMap().get(qName)); } } if (v.size() > 0) { collisionCandidates.add(v); } } } Iterator it = collisionCandidates.iterator(); while (it.hasNext()) { Vector v = new Vector((Vector) it.next()); // New vector we can temporarily add to it // Remove MessageEntries since they are not mapped int index = 0; while (index < v.size()) { if (v.elementAt(index) instanceof MessageEntry) { // Need to resolve a Exception message. MessageEntry msgEntry = (MessageEntry) v.elementAt(index); if (msgEntry.getDynamicVar(EXCEPTION_CLASS_NAME) == null) { v.removeElementAt(index); } else { index++; } } else { index++; } } if (v.size() > 1) { boolean resolve = true; // Common Special Case: // If a Type and Element have the same QName, and the Element // references the Type, then they are the same class so // don't bother mangling. if (v.size() == 2 && ((v.elementAt(0) instanceof Element && v.elementAt(1) instanceof Type) || (v.elementAt(1) instanceof Element && v.elementAt(0) instanceof Type))) { Element e; if (v.elementAt(0) instanceof Element) { e = (Element) v.elementAt(0); } else { e = (Element) v.elementAt(1); } BooleanHolder forElement = new BooleanHolder(); QName eType = Utils.getTypeQName(e.getNode(), forElement, false); if ((eType != null) && !forElement.value) { resolve = false; } } // Other Special Case: // If the names are already different, no mangling is needed. if (resolve) { resolve = false; // Assume false String name = null; for (int i = 0; (i < v.size()) && !resolve; ++i) { SymTabEntry entry = (SymTabEntry) v.elementAt(i); if ((entry instanceof MessageEntry) || (entry instanceof BindingEntry)) { // Need to resolve a exception class name String exceptionClassName = (String) entry.getDynamicVar(EXCEPTION_CLASS_NAME); if (exceptionClassName != null) { if (name == null) { name = exceptionClassName; } else if (name.equals(exceptionClassName)) { resolve = true; } } } else if (name == null) { name = entry.getName(); } else if (name.equals(entry.getName())) { resolve = true; // Need to do resolution } } } // Full Mangle if resolution is necessary. if (resolve) { boolean firstType = true; for (int i = 0; i < v.size(); ++i) { SymTabEntry entry = (SymTabEntry) v.elementAt(i); if (entry instanceof Element) { entry.setName(mangleName(entry.getName(), ELEMENT_SUFFIX)); // If this global element was defined using // an anonymous type, then need to change the // java name of the anonymous type to match. QName anonQName = new QName(entry.getQName().getNamespaceURI(), SymbolTable.ANON_TOKEN + entry.getQName().getLocalPart()); TypeEntry anonType = symbolTable.getType(anonQName); if (anonType != null) { anonType.setName(entry.getName()); anonTypes.add(anonType); } } else if (entry instanceof TypeEntry) { // Search all other types for java names that match this one. // The sameJavaClass method returns true if the java names are // the same (ignores [] ). if (firstType) { firstType = false; Iterator types = symbolTable.getTypeIndex().values().iterator(); while (types.hasNext()) { TypeEntry type = (TypeEntry) types.next(); if ((type != entry) && (type.getBaseType() == null) && sameJavaClass(entry.getName(), type.getName())) { v.add(type); } } } // If this is an anonymous type, it's name was resolved in // the previous if block. Don't reresolve it. if (!anonTypes.contains(entry)) { // In case that other entry in name collision among // PortTypeEntry, ServiceEntry and BindingEntry boolean needResolve = false; // check collision of TypeEntry with PortTypeEntry, ServiceEtnry and/or BindingEntry for (int j = 0; j < v.size(); j++) { SymTabEntry e = (SymTabEntry) v.elementAt(j); if ((e instanceof PortTypeEntry || e instanceof ServiceEntry || e instanceof BindingEntry)) { needResolve = true; break; } } if (!needResolve) { continue; } // Appended Suffix for avoiding name collisions (JAX-RPC 1.1) Boolean isComplexTypeFault = (Boolean) entry.getDynamicVar(COMPLEX_TYPE_FAULT); if ((isComplexTypeFault != null) && isComplexTypeFault.booleanValue()) { entry.setName(mangleName(entry.getName(), EXCEPTION_SUFFIX)); } else { entry.setName(mangleName(entry.getName(), TYPE_SUFFIX)); } // should update the class name of ElementEntry which references this type entry Map elementIndex = symbolTable.getElementIndex(); List elements = new ArrayList(elementIndex.values()); for (int j = 0; j < elementIndex.size(); j++) { TypeEntry te = (TypeEntry) elements.get(j); TypeEntry ref = te.getRefType(); if (ref != null && entry.getQName().equals(ref.getQName())) { te.setName(entry.getName()); } } // Need to resolve a complex-type exception message. if ((isComplexTypeFault != null) && isComplexTypeFault.booleanValue()) { // SHOULD update the exception class name of a referencing message entry. List messageEntries = symbolTable.getMessageEntries(); for (int j = 0; j < messageEntries.size(); j++) { MessageEntry messageEntry = (MessageEntry) messageEntries.get(j); Boolean isComplexTypeFaultMsg = (Boolean) messageEntry .getDynamicVar(COMPLEX_TYPE_FAULT); if ((isComplexTypeFaultMsg != null) && (isComplexTypeFaultMsg.booleanValue())) { QName exceptionDataType = (QName) messageEntry .getDynamicVar(EXCEPTION_DATA_TYPE); if (((TypeEntry) entry).getQName().equals(exceptionDataType)) { String className = (String) messageEntry .getDynamicVar(EXCEPTION_CLASS_NAME); messageEntry.setDynamicVar(EXCEPTION_CLASS_NAME, className + EXCEPTION_SUFFIX); } } } } } } else if (entry instanceof PortTypeEntry) { entry.setName(mangleName(entry.getName(), PORT_TYPE_SUFFIX)); // "_Port" --> "_PortType" for JAX-RPC 1.1 } else if (entry instanceof ServiceEntry) { entry.setName(mangleName(entry.getName(), SERVICE_SUFFIX)); } else if (entry instanceof MessageEntry) { Boolean complexTypeFault = (Boolean) entry.getDynamicVar(COMPLEX_TYPE_FAULT); if ((complexTypeFault == null) || !complexTypeFault.booleanValue()) { String exceptionClassName = (String) entry.getDynamicVar(EXCEPTION_CLASS_NAME); entry.setDynamicVar(EXCEPTION_CLASS_NAME, exceptionClassName + EXCEPTION_SUFFIX); } } // else if (entry instanceof MessageEntry) { // we don't care about messages // } else if (entry instanceof BindingEntry) { BindingEntry bEntry = (BindingEntry) entry; // If there is no literal use, then we never see a // class named directly from the binding name. They // all have suffixes: Stub, Skeleton, Impl. // If there IS literal use, then the SDI will be // named after the binding name, so there is the // possibility of a name clash. if (bEntry.hasLiteral()) { entry.setName(mangleName(entry.getName(), BINDING_SUFFIX)); } } } } } } }
From source file:org.agnitas.beans.impl.MailingImpl.java
@Override public Vector<String> scanForLinks(ApplicationContext con) throws Exception { Vector<String> addedLinks = new Vector<String>(); MailingComponent tmpComp = null;// w ww.j ava2 s . c o m DynamicTag dyntag = null; DynamicTagContent dyncontent = null; searchPos = 0; Iterator<MailingComponent> itComponents = this.components.values().iterator(); while (itComponents.hasNext()) { tmpComp = itComponents.next(); if (tmpComp.getType() == MailingComponent.TYPE_TEMPLATE) { addedLinks.addAll(this.scanForLinks(tmpComp.getEmmBlock(), con)); } } Iterator<DynamicTag> itDynTag = this.dynTags.values().iterator(); while (itDynTag.hasNext()) { dyntag = (DynamicTag) itDynTag.next(); Iterator<DynamicTagContent> it2 = dyntag.getDynContent().values().iterator(); while (it2.hasNext()) { dyncontent = it2.next(); addedLinks.addAll(this.scanForLinks(dyncontent.getDynContent(), con)); } } return addedLinks; }
From source file:org.agnitas.beans.impl.MailingImpl.java
public Vector<String> scanForComponents(ApplicationContext con) throws Exception { Vector<String> addedTags = new Vector<String>(); MailingComponent tmpComp = null;//from w ww . j a v a2 s .co m DynamicTag dyntag = null; DynamicTagContent dyncontent = null; searchPos = 0; Set<MailingComponent> componentsToAdd = new HashSet<MailingComponent>(); Iterator<MailingComponent> itComponents = this.components.values().iterator(); while (itComponents.hasNext()) { tmpComp = itComponents.next(); if (tmpComp.getType() == MailingComponent.TYPE_TEMPLATE) { addedTags.addAll(this.scanForComponents(tmpComp.getEmmBlock(), con, componentsToAdd)); } } addComponents(componentsToAdd); componentsToAdd.clear(); Iterator<DynamicTag> itDynTag = this.dynTags.values().iterator(); while (itDynTag.hasNext()) { dyntag = (DynamicTag) itDynTag.next(); Iterator<DynamicTagContent> it2 = dyntag.getDynContent().values().iterator(); while (it2.hasNext()) { dyncontent = it2.next(); addedTags.addAll(this.scanForComponents(dyncontent.getDynContent(), con, componentsToAdd)); } } addComponents(componentsToAdd); return addedTags; }
From source file:opendap.threddsHandler.ThreddsCatalogUtil.java
private Vector<String> getDataAccessURLs(String catalogUrlString, Element catalog, SERVICE service, boolean recurse) throws InterruptedException { Vector<String> serviceURLs = new Vector<String>(); try {/*from www.ja v a 2 s .c o m*/ URL catalogURL = new URL(catalogUrlString); String serverURL = getServerUrlString(catalogURL); String msg; HashMap<String, Element> services = collectServices(catalog, service); msg = "#### collectServices Found services:\n"; for (String srvcName : services.keySet()) msg += "#### Service Name: " + srvcName + "\n" + xmlo.outputString(services.get(srvcName)) + "\n"; log.debug(msg); Element dataset; Iterator i = catalog.getChildren(THREDDS.DATASET, THREDDS.NS).iterator(); while (i.hasNext()) { dataset = (Element) i.next(); collectDatasetAccessUrls(dataset, services, null, serverURL, serviceURLs); } log.debug("#### Accumulated " + serviceURLs.size() + " access URLs."); if (serverURL != null && recurse) { String href; Element catalogRef; String newCatalogURL; i = catalog.getDescendants(new ElementFilter("catalogRef", THREDDS.NS)); while (i.hasNext()) { catalogRef = (Element) i.next(); href = catalogRef.getAttributeValue("href", XLINK.NS); newCatalogURL = getCatalogURL(catalogUrlString, href); serviceURLs.addAll(getDataAccessURLs(newCatalogURL, service, recurse)); } } } catch (MalformedURLException e) { log.error("Unable to load THREDDS catalog: " + catalogUrlString + " msg: " + e.getMessage()); } return serviceURLs; }
From source file:hudson.model.AbstractProject.java
protected List<Action> createTransientActions() { Vector<Action> ta = new Vector<Action>(); for (JobProperty<? super P> p : getAllProperties()) ta.addAll(p.getJobActions((P) this)); for (TransientProjectActionFactory tpaf : TransientProjectActionFactory.all()) ta.addAll(Util.fixNull(tpaf.createFor(this))); // be defensive against null return ta;//from w w w. jav a 2 s. c o m }
From source file:com.globalsight.everest.usermgr.UserManagerLocal.java
/** * Get all active and created users./* www . j ava 2 s. c o m*/ * * @return a Vector of User objects * @exception UserManagerException * - Component related exception. * @exception java.rmi.RemoteException * - Network related exception. */ public Vector getUsersFromAllCompany() throws RemoteException, UserManagerException { Vector users = new Vector(); String hql = "from UserImpl u where u.state != :state1 and u.state != :state2 and u.type != :type"; Map map = new HashMap(); map.put("state1", User.State.DELETED); map.put("state2", User.State.DEACTIVE); map.put("type", User.UserType.ANONYMOUS); users.addAll(HibernateUtil.search(hql, map)); return users; }
From source file:com.globalsight.everest.usermgr.UserManagerLocal.java
/** * Gets all users including inactive ones from specified company. *///from www . j ava 2s. c om public Vector<User> getUsersFromCompany(String companyId) throws RemoteException, UserManagerException { String companyName = CompanyWrapper.getCompanyNameById(companyId); String errorMsgKey = UserManagerException.MSG_GET_USERS_ERROR; Vector users = new Vector(); String hql = "from UserImpl u where u.state != :state1 and u.state != :state2 and u.type != :type and u.companyName = :companyName"; Map map = new HashMap(); map.put("state1", User.State.DELETED); map.put("state2", User.State.DEACTIVE); map.put("type", User.UserType.ANONYMOUS); map.put("companyName", companyName); users.addAll(HibernateUtil.search(hql, map)); return users; }
From source file:opendap.threddsHandler.ThreddsCatalogUtil.java
private void collectDatasetAccessUrls(Element dataset, HashMap<String, Element> services, String inheritedServiceName, String baseServerURL, Vector<String> datasetURLs) throws InterruptedException { String urlPath;//from w w w .j av a 2s .co m String serviceName; String s; Element metadata, dset, access; String datasetName; /* Iterator i; */ log.debug("inheritedServiceName: " + inheritedServiceName); serviceName = dataset.getAttributeValue("serviceName"); urlPath = dataset.getAttributeValue("urlPath"); metadata = dataset.getChild("metadata", THREDDS.NS); datasetName = dataset.getAttributeValue("name"); if (metadata != null && metadata.getAttributeValue("inherited").equalsIgnoreCase("true")) { log.debug("Found inherited metadata"); s = metadata.getChildText("serviceName", THREDDS.NS); if (s != null) { inheritedServiceName = s; log.debug("Updated inheritedServiceName to: " + inheritedServiceName); } } if (urlPath != null) { log.debug("<dataset> has urlPath attribute: " + urlPath); if (serviceName == null) { log.debug("<dataset> missing serviceName attribute. Checking for child element..."); serviceName = dataset.getChildText("serviceName", THREDDS.NS); } if (serviceName == null) { log.debug("<dataset> missing serviceName childElement. Checking for inherited serviceName..."); serviceName = inheritedServiceName; } if (serviceName != null) { log.debug("<dataset> has serviceName: " + serviceName); datasetURLs.addAll(getAccessURLs(urlPath, serviceName, services, baseServerURL)); } } Iterator i = dataset.getChildren("access", THREDDS.NS).iterator(); while (i.hasNext()) { access = (Element) i.next(); log.debug("Located thredds:access element in dataset '" + datasetName + "'"); datasetURLs.addAll(getAccessURLs(access, services, baseServerURL)); } i = dataset.getChildren(THREDDS.DATASET, THREDDS.NS).iterator(); while (i.hasNext()) { dset = (Element) i.next(); collectDatasetAccessUrls(dset, services, inheritedServiceName, baseServerURL, datasetURLs); } }
From source file:org.fao.geonet.kernel.EditLib.java
/** * For each container element - descend and collect children. * @param md/* www . java 2 s . c o m*/ * @return */ private Vector<Object> getContainerChildren(Element md) { Vector<Object> result = new Vector<Object>(); List chChilds = md.getChildren(); for (Object chChild1 : chChilds) { Element chChild = (Element) chChild1; String chName = chChild.getName(); if (chName.contains(Edit.RootChild.CHOICE) || chName.contains(Edit.RootChild.GROUP) || chName.contains(Edit.RootChild.SEQUENCE)) { List<Object> moreChChilds = getContainerChildren(chChild); result.addAll(moreChChilds); } else { result.add(chChild.clone()); } } return result; }