T getKey(const QString &provider, const I &in, const SecureArray &passphrase, ConvertResult *result) { T k; // single if(!provider.isEmpty()) { Provider *p = providerForName(provider); if(!p) return k; k = G::getKey(p, in, passphrase, result); } // all else { ProviderList pl = allProviders(); for(int n = 0; n < pl.count(); ++n) { ConvertResult r; k = G::getKey(pl[n], in, passphrase, &r); if(result) *result = r; if(!k.isNull()) break; if(r == ErrorPassphrase) // don't loop if we get this break; } } return k; }
QList<T> getList(const QString &provider) { QList<T> list; // single if(!provider.isEmpty()) { Provider *p = providerForName(provider); if(p) list = G::getList(p); } // all else { ProviderList pl = allProviders(); for(int n = 0; n < pl.count(); ++n) { QList<T> other = G::getList(pl[n]); for(int k = 0; k < other.count(); ++k) { // only add what we don't have in the list if(!list.contains(other[k])) list += other[k]; } } } return list; }
Provider *providerForName(const QString &name) { ProviderList pl = allProviders(); for(int n = 0; n < pl.count(); ++n) { if(pl[n]->name() == name) return pl[n]; } return 0; }
Provider *providerForGroupSet(DLGroupSet set) { ProviderList pl = allProviders(); for(int n = 0; n < pl.count(); ++n) { if(Getter_GroupSet::getList(pl[n]).contains(set)) return pl[n]; } return 0; }
Provider *providerForPBE(PBEAlgorithm alg) { ProviderList pl = allProviders(); for(int n = 0; n < pl.count(); ++n) { if(Getter_PBE::getList(pl[n]).contains(alg)) return pl[n]; } return 0; }
void removeDisabledProviders( ProviderList &providers, const ProviderRefTimeList &reftimes ) { ProviderRefTimeList::const_iterator rit; ProviderList::iterator it = providers.begin(); WEBFW_USE_LOGGER( "handler" ); while( it != providers.end() ) { rit = reftimes.find( it->providerWithPlacename() ); if( rit != reftimes.end() && rit->second.disabled ) { WEBFW_LOG_DEBUG("removeDisabledProviders: removing provider: " << it->providerWithPlacename() ); it = providers.erase( it ); } else { ++ it; } } }
MetaModelConfList configureMetaModelConf( const wdb2ts::config::ActionParam ¶ms ) { const string META_MODEL_KEY("meta_model-"); MetaModelConfList metaModelConf; WEBFW_USE_LOGGER( "main" ); string::size_type i; for( wdb2ts::config::ActionParam::const_iterator it = params.begin(); it!=params.end(); ++it ) { i=it->first.find( META_MODEL_KEY ); if( i != string::npos && i==0 ) { string provider=it->first; provider.erase(0, META_MODEL_KEY.size() ); //miutil::replace( provider, "_", " "); ProviderList pvList = ProviderList::decode( provider ); MetaModelConf conf; if( conf.parseConf( it->second.asString() ) ){ for( ProviderList::iterator pit = pvList.begin(); pit != pvList.end(); ++pit ) metaModelConf[pit->providerWithPlacename()] = conf; }else { WEBFW_LOG_ERROR( "Failed to parse value for: " << it->first << " (" << it->second << ")." ); } } } std::ostringstream logMsg; for( MetaModelConfList::iterator metaIt = metaModelConf.begin(); metaIt != metaModelConf.end(); ++metaIt ) logMsg << "Meta: " << metaIt->first << ": " << metaIt->second << endl; WEBFW_LOG_DEBUG( logMsg.str() ); return metaModelConf; }
Provider *providerForIOType(PKey::Type type, const PKeyContext *prefer = 0) { Provider *preferProvider = 0; if(prefer) { preferProvider = prefer->provider(); if(prefer && prefer->supportedIOTypes().contains(type)) return preferProvider; } ProviderList pl = allProviders(); for(int n = 0; n < pl.count(); ++n) { if(preferProvider && pl[n] == preferProvider) continue; if(Getter_IOType::getList(pl[n]).contains(type)) return pl[n]; } return 0; }
Provider *providerForPBE(PBEAlgorithm alg, PKey::Type ioType, const PKeyContext *prefer = 0) { Provider *preferProvider = 0; if(prefer) { preferProvider = prefer->provider(); if(prefer->supportedPBEAlgorithms().contains(alg) && prefer->supportedIOTypes().contains(ioType)) return preferProvider; } ProviderList pl = allProviders(); for(int n = 0; n < pl.count(); ++n) { if(preferProvider && pl[n] == preferProvider) continue; if(Getter_PBE::getList(pl[n]).contains(alg) && Getter_IOType::getList(pl[n]).contains(ioType)) return pl[n]; } return 0; }
QList<T> getList(const QString &provider) { QList<T> list; // single if(!provider.isEmpty()) { Provider *p = providerForName(provider); if(p) list = G::getList(p); } // all else { ProviderList pl = allProviders(); for(int n = 0; n < pl.count(); ++n) list += G::getList(pl[n]); } return list; }