private static java.security.Provider getProvider(String engine, String alg, String mech) //throws NoSuchAlgorithmException { java.util.Map <String, String> map = new java.util.HashMap <String, String>(); map.put(engine + "." + alg, ""); map.put(engine + "." + alg + " " + "MechanismType", mech); java.security.Provider[] providers = java.security.Security.getProviders(map); if (providers == null) { if (mech.equals("DOM")) { // look for providers without MechanismType specified map.clear(); map.put(engine + "." + alg, ""); providers = java.security.Security.getProviders(map); if (providers != null) { return(providers[0]); } } throw new java.security.NoSuchAlgorithmException("Algorithm type " + alg + " not available"); } return(providers[0]); }
static public java.util.HashMap ConstructJavaMap(IEnumerable<KeyValuePair<string,Analyzer>> kvpCollection) { var map = new java.util.HashMap(); foreach (var kvp in kvpCollection) map.put(kvp.Key, kvp.Value); return map; }
/// <summary> /// 全部监控的获取 /// </summary> /// <param name="page"></param> public void GetCameras(int page = 1) { string cameraP = "/artemis/api/resource/v2/camera/search"; string body_c = "{\"pageNo\":" + page + ",\"pageSize\": 100,\"orderBy\": \"name\",\"orderType\": \"desc\"}"; java.util.Map path_c = new java.util.HashMap(); path_c.put("https://", cameraP); string result_c = ArtemisHttpUtil.doPostStringArtemis(path_c, body_c, null, "*/*", "application/json", null); var camera = JsonConvert.DeserializeObject <Camera.Camera>(result_c); LogHelper.WriteLog(typeof(string), "监控查询code:" + camera.code); //Console.WriteLine("监控查询code:" + camera.code); if (camera.data.total == 0) { return; } var clist = camera.data.list; cameraList.AddRange(clist); var camera_total = camera.data.total; if ((camera_total - page * 100) % 100 > 0) { LogHelper.WriteLog(typeof(string), "开始迭代"); //Console.WriteLine("开始迭代"); page++; GetCameras(page); } }
// The activity manager dispatched a broadcast to a registered // receiver in this process, but before it could be delivered the // receiver was unregistered. Acknowledge the broadcast on its // behalf so that the system's broadcast sequence can continue. public android.app.IServiceConnection getServiceDispatcher(android.content.ServiceConnection c, android.content.Context context, android.os.Handler handler, int flags) { lock (mServices) { android.app.LoadedApk.ServiceDispatcher sd = null; java.util.HashMap <android.content.ServiceConnection, android.app.LoadedApk.ServiceDispatcher > map = mServices.get(context); if (map != null) { sd = map.get(c); } if (sd == null) { sd = new android.app.LoadedApk.ServiceDispatcher(c, context, handler, flags); if (map == null) { map = new java.util.HashMap <android.content.ServiceConnection, android.app.LoadedApk .ServiceDispatcher>(); mServices.put(context, map); } map.put(c, sd); } else { sd.validate(context, handler); } return(sd.getIServiceConnection()); } }
/** * Returns the array of providers which meet the user supplied string * filter. The specified filter must be supplied in one of two formats: * <nl> * <li> CRYPTO_SERVICE_NAME.ALGORITHM_OR_TYPE</li> * <p/> * (for example: "MessageDigest.SHA") * <li> CRYPTO_SERVICE_NAME.ALGORITHM_OR_TYPE</li> * ATTR_NAME:ATTR_VALUE * <p/> * (for example: "Signature.MD2withRSA KeySize:512") * </nl> * * @param filter * case-insensitive filter. * @return the providers which meet the user supplied string filter {@code * filter}. A {@code null} value signifies that none of the * installed providers meets the filter specification. * @throws InvalidParameterException * if an unusable filter is supplied. * @throws NullPointerException * if {@code filter} is {@code null}. */ public static Provider[] getProviders(String filter) { if (filter == null) { throw new java.lang.NullPointerException("The filter is null"); //$NON-NLS-1$ } if (filter.length() == 0) { throw new InvalidParameterException("The filter is not in the required format"); //$NON-NLS-1$ } java.util.HashMap <String, String> hm = new java.util.HashMap <String, String>(); int i = filter.indexOf(':'); if ((i == filter.length() - 1) || (i == 0)) { throw new InvalidParameterException("The filter is not in the required format"); //$NON-NLS-1$ } if (i < 1) { hm.put(filter, ""); //$NON-NLS-1$ } else { hm.put(filter.substring(0, i), filter.substring(i + 1)); } return(getProviders(hm)); }
private void readObject(java.io.ObjectInputStream inJ) {//throws IOException, ClassNotFoundException { inJ.defaultReadObject(); maps[0] = new java.util.HashMap <Object, Object>(); maps[1] = new java.util.HashMap <Object, Object>(); java.util.Map <Object, Object> map = (java.util.Map <Object, Object>)inJ.readObject(); putAll(map); }
/** * Create a new <code>SimpleKeyedObjectPool</code> using * the specified <code>factory</code> to create new instances. * capping the number of "sleeping" instances to <code>max</code>, * and initially allocating a container capable of containing * at least <code>init</code> instances. * * @param factory the {@link KeyedPoolableObjectFactory} used to populate the pool * @param max cap on the number of "sleeping" instances in the pool * @param init initial size of the pool (this specifies the size of the container, * it does not cause the pool to be pre-populated.) */ public StackKeyedObjectPool(KeyedPoolableObjectFactory <K, V> factory, int max, int init) { _factory = factory; _maxSleeping = (max < 0 ? DEFAULT_MAX_SLEEPING : max); _initSleepingCapacity = (init < 1 ? DEFAULT_INIT_SLEEPING_CAPACITY : init); _pools = new java.util.HashMap <K, java.util.Stack <V> >(); _activeCount = new java.util.HashMap <K, java.lang.Integer>(); }
public AnalyzerFactory(ResourceLoader resourceLoader) { _tokenizerFactory = new WhitespaceTokenizerFactory(); _lowerCaseFactory = new LowerCaseFilterFactory(); _synonymFactory = new SynonymFilterFactory(); { var args = new java.util.HashMap(); args.put("ignoreCase", "true"); args.put("expand", "false"); args.put("synonyms", "synonyms.txt"); _synonymFactory.init(args); ((ResourceLoaderAware)_synonymFactory).inform(resourceLoader); } _commonGramsFactory = new CommonGramsFilterFactory(); { var args = new java.util.HashMap(); args.put("ignoreCase", "true"); _commonGramsFactory.init(args); ((ResourceLoaderAware)_commonGramsFactory).inform(resourceLoader); } _commonGramsQueryFactory = new CommonGramsQueryFilterFactory(); { var args = new java.util.HashMap(); args.put("ignoreCase", "true"); _commonGramsQueryFactory.init(args); ((ResourceLoaderAware)_commonGramsQueryFactory).inform(resourceLoader); } _wordDelimiterFactory = new WordDelimiterFilterFactory(); { var args = new java.util.HashMap(); args.put("catenateWords", "1"); args.put("catenateNumbers", "1"); args.put("protected", "protwords.txt"); _wordDelimiterFactory.init(args); ((ResourceLoaderAware)_wordDelimiterFactory).inform(resourceLoader); } _stemmerFactory = new KStemFilterFactory(); { var args = new java.util.HashMap(); args.put("protected", "protwords.txt"); _stemmerFactory.init(args); ((ResourceLoaderAware)_stemmerFactory).inform(resourceLoader); } _edgeNGramFactory = new EdgeNGramTokenFilterFactory(); { var args = new java.util.HashMap(); args.put("side", "FRONT"); args.put("minGramSize", 2); _edgeNGramFactory.init(args); ((ResourceLoaderAware)_edgeNGramFactory).inform(resourceLoader); } }
public virtual int playSilence(long arg0, int arg1, java.util.HashMap arg2) { global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv; if (!IsClrObject) { return(@__env.CallIntMethod(this.JvmHandle, global::android.speech.tts.TextToSpeech._playSilence7329, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2))); } else { return(@__env.CallNonVirtualIntMethod(this.JvmHandle, global::android.speech.tts.TextToSpeech.staticClass, global::android.speech.tts.TextToSpeech._playSilence7329, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2))); } }
public virtual int synthesizeToFile(java.lang.String arg0, java.util.HashMap arg1, java.lang.String arg2) { global::MonoJavaBridge.JNIEnv @__env = global::MonoJavaBridge.JNIEnv.ThreadEnv; if (!IsClrObject) { return(@__env.CallIntMethod(this.JvmHandle, global::android.speech.tts.TextToSpeech._synthesizeToFile7335, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2))); } else { return(@__env.CallNonVirtualIntMethod(this.JvmHandle, global::android.speech.tts.TextToSpeech.staticClass, global::android.speech.tts.TextToSpeech._synthesizeToFile7335, global::MonoJavaBridge.JavaBridge.ConvertToValue(arg0), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg1), global::MonoJavaBridge.JavaBridge.ConvertToValue(arg2))); } }
public static void InitializeGrammarManager(int customerId) { if (!GrammarManager.IsInitialized) { InitializeGrammarManager(); } else { Dictionary <int, java.util.HashMap> reservedWordDataHashMapByCustomer = GrammarManager.GetReservedWordDataHashMapDictionary(); Dictionary <int, string[]> frequentWordArrayByCustomer = GrammarManager.GetFrequentWordArrayDictionary(); List <WordTransformationModel> transformationWordsList = new WordTransformationProvider().SelectAllItems(customerId); List <FrequentWordModel> frequentWords = new FrequentWordProvider().SelectAllItems(customerId); string[] frequentWordList = frequentWords.Select(p => p.Text).ToArray(); if (frequentWordArrayByCustomer.ContainsKey(customerId)) { frequentWordArrayByCustomer[customerId] = frequentWordList; } else { frequentWordArrayByCustomer.Add(customerId, frequentWordList); } var groupedList = transformationWordsList.GroupBy(p => p.FromWord); java.util.HashMap map = new java.util.HashMap(); foreach (var groupItem in groupedList) { string key = groupItem.Key; foreach (var item in groupItem) { map.put(key, item.ToWord); } } if (reservedWordDataHashMapByCustomer.ContainsKey(customerId)) { reservedWordDataHashMapByCustomer[customerId] = map; } else { reservedWordDataHashMapByCustomer.Add(customerId, map); } GrammarManager.SetFrequentWordArrayDictionary(frequentWordArrayByCustomer); GrammarManager.SetReservedWordDataHashMapDictionary(reservedWordDataHashMapByCustomer); } }
static Color() { sColorNameMap = new java.util.HashMap <string, int>(); sColorNameMap.put("black", BLACK); sColorNameMap.put("darkgray", DKGRAY); sColorNameMap.put("gray", GRAY); sColorNameMap.put("lightgray", LTGRAY); sColorNameMap.put("white", WHITE); sColorNameMap.put("red", RED); sColorNameMap.put("green", GREEN); sColorNameMap.put("blue", BLUE); sColorNameMap.put("yellow", YELLOW); sColorNameMap.put("cyan", CYAN); sColorNameMap.put("magenta", MAGENTA); }
public object VideoUrl(string indexCode) { //ArtemisConfig.host = "10.172.33.2"; // 代理API网关nginx服务器ip端口 //ArtemisConfig.appKey = "27628571"; // 秘钥appkey //ArtemisConfig.appSecret = "TJzjgMqgM41EezwD36aV";// 秘钥appSecret //获取所有组织 string videoP = "/artemis/api/video/v1/cameras/previewURLs"; string body = "{\"cameraIndexCode\": \"" + indexCode + "\",\"streamType\": 0,\"protocol\": \"hls\",\"transmode\": 1,\"expand\": \"transcode=0\"}"; java.util.Map path = new java.util.HashMap(); path.put("https://", videoP); string result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, "*/*", "application/json", null); var vdata = JsonConvert.DeserializeObject <SKVideo>(result); return(Ok(new { vdata, indexCode })); }
/** * Remove all mappings from this map. */ public override void clear() { if (fast) { lock (this) { map = new java.util.HashMap <Object, Object>(); } } else { lock (map) { map.clear(); } } }
public org.openrdf.query.GraphQueryResult evaluate() { IGraph g = this.EvaluateQuery(); SesameMapping mapping = new SesameMapping(g, new dotSesame.impl.GraphImpl()); IEnumerable <dotSesame.Statement> stmts = from t in g.Triples select SesameConverter.ToSesame(t, mapping); DotNetEnumerableWrapper wrapper = new DotNetEnumerableWrapper(stmts); java.util.HashMap map = new java.util.HashMap(); foreach (String prefix in g.NamespaceMap.Prefixes) { map.put(prefix, g.NamespaceMap.GetNamespaceUri(prefix).ToString()); } dotSesameQuery.impl.GraphQueryResultImpl results = new org.openrdf.query.impl.GraphQueryResultImpl(map, wrapper); return(results); }
public object ToVideoAction(string cameraIndexCode, int number, string command) { if (string.IsNullOrEmpty(cameraIndexCode) || (number != 1 && number != 0) || string.IsNullOrEmpty(command)) { return("参数有误:cic=" + cameraIndexCode + ";num=" + number + ";comm=" + command); } string videoA = "/artemis/api/video/v1/ptz/controlling"; string body = "{\"cameraIndexCode\": \"" + cameraIndexCode + "\",\"action\":" + number + ",\"command\": \"" + command + "\",\"speed\": 20}"; java.util.Map path = new java.util.HashMap(); path.put("https://", videoA); string result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, "*/*", "application/json", null); var data = JsonConvert.DeserializeObject <SKVideoActionResult>(result); return(Ok(new { data, cameraIndexCode, number, command, result })); }
public static void InitializeGrammarManager() { int randomCustomerId = 0; if (!GrammarManager.IsInitialized) { List <CustomerModel> customers = new CustomerProvider().SelectAllItems(); Dictionary <int, java.util.HashMap> reservedWordDataHashMapByCustomer = new Dictionary <int, java.util.HashMap>(); Dictionary <int, string[]> frequentWordArrayByCustomer = new Dictionary <int, string[]>(); foreach (var customer in customers) { List <WordTransformationModel> transformationWordsList = new WordTransformationProvider().SelectAllItems(customer.Id); List <FrequentWordModel> frequentWords = new FrequentWordProvider().SelectAllItems(customer.Id); string[] frequentWordList = frequentWords.Select(p => p.Text).ToArray(); frequentWordArrayByCustomer.Add(customer.Id, frequentWordList); var groupedList = transformationWordsList.GroupBy(p => p.FromWord); java.util.HashMap map = new java.util.HashMap(); foreach (var groupItem in groupedList) { string key = groupItem.Key; foreach (var item in groupItem) { map.put(key, item.ToWord); } } reservedWordDataHashMapByCustomer.Add(customer.Id, map); randomCustomerId = customer.Id; } GrammarManager.SetFrequentWordArrayDictionary(frequentWordArrayByCustomer); GrammarManager.SetReservedWordDataHashMapDictionary(reservedWordDataHashMapByCustomer); GrammarManager.Instance.ParseSentence("başla", randomCustomerId); } }
public void testCheckInternalReferences() { string adl = System.IO.File.ReadAllText(@"..\..\..\..\java-libs\adl-parser\src\test\resources\adl-test-car.use_node.test.adl"); se.acode.openehr.parser.ADLParser parser = new se.acode.openehr.parser.ADLParser(adl); org.openehr.am.archetype.Archetype archetype = parser.parse(); se.acode.openehr.parser.ArchetypeValidator validator = new se.acode.openehr.parser.ArchetypeValidator(archetype); java.util.Map expected = new java.util.HashMap(); // wrong target path expected.put("/wheels[at0005]/parts", "/engine[at0001]/parts[at0002]"); // wrong type expected.put("/wheels[at0006]/parts", "/wheels[at0001]/parts[at0002]"); //Assert.AreEqual(expected, validator.checkInternalReferences()); }
/** * Copy all of the mappings from the specifiedjava.util.Map<Object,Object>to this one, replacing * any mappings with the same keys. * * @param in thejava.util.Map<Object,Object>whose mappings are to be copied */ public override void putAll(java.util.Map <Object, Object> inJ) { if (fast) { lock (this) { java.util.HashMap <Object, Object> temp = (java.util.HashMap <Object, Object>)map.clone(); temp.putAll(inJ); map = temp; } } else { lock (map) { map.putAll(inJ); } } }
public java.util.Map <AttributedCharacterIteratorNS.Attribute, System.Object> getAttributes() { java.util.Map <AttributedCharacterIteratorNS.Attribute, System.Object> result = new java.util.HashMap <AttributedCharacterIteratorNS.Attribute, System.Object>();//(attrString.attributeMap.size() * 4 / 3) + 1); java.util.Iterator <java.util.MapNS.Entry <AttributedCharacterIteratorNS.Attribute, java.util.List <IAC_Range> > > it = attrString.attributeMap .entrySet().iterator(); while (it.hasNext()) { java.util.MapNS.Entry <AttributedCharacterIteratorNS.Attribute, java.util.List <IAC_Range> > entry = it.next(); if (attributesAllowed == null || attributesAllowed.contains(entry.getKey())) { System.Object value = currentValue(entry.getValue()); if (value != null) { result.put(entry.getKey(), value); } } } return(result); }
/** * Remove any mapping for this key, and return any previously * mapped value. * * @param key the key whose mapping is to be removed * @return the value removed, or null */ public override Object remove(Object key) { if (fast) { lock (this) { java.util.HashMap <Object, Object> temp = (java.util.HashMap <Object, Object>)map.clone(); Object result = temp.remove(key); map = temp; return(result); } } else { lock (map) { return(map.remove(key)); } } }
public virtual bool retainAll(java.util.Collection <Object> o) { if (root.fast) { lock (root) { java.util.HashMap <Object, Object> temp = (java.util.HashMap <Object, Object>)root.map.clone(); bool r = get(temp).retainAll(o); root.map = temp; return(r); } } else { lock (root.map) { return(get(root.map).retainAll(o)); } } }
// system crashed, nothing we can do //Slog.i(TAG, "Receiver registrations: " + mReceivers); // system crashed, nothing we can do //Slog.i(TAG, "Service registrations: " + mServices); public android.content.IIntentReceiver getReceiverDispatcher(android.content.BroadcastReceiver r, android.content.Context context, android.os.Handler handler, android.app.Instrumentation instrumentation, bool registered) { lock (mReceivers) { android.app.LoadedApk.ReceiverDispatcher rd = null; java.util.HashMap <android.content.BroadcastReceiver, android.app.LoadedApk.ReceiverDispatcher > map = null; if (registered) { map = mReceivers.get(context); if (map != null) { rd = map.get(r); } } if (rd == null) { rd = new android.app.LoadedApk.ReceiverDispatcher(r, context, handler, instrumentation , registered); if (registered) { if (map == null) { map = new java.util.HashMap <android.content.BroadcastReceiver, android.app.LoadedApk .ReceiverDispatcher>(); mReceivers.put(context, map); } map.put(r, rd); } } else { rd.validate(context, handler); } rd.mForgotten = false; return(rd.getIIntentReceiver()); } }
/// <summary> /// 停车场节点信息 /// </summary> public void Parking(int page = 1) { //获取停车库节点信息 string parknodesurl = "/artemis/api/resource/v1/park/search"; string pnBody = "{\"pageSize\": 20,\"pageNo\": " + page + "}"; java.util.Map path_pn = new java.util.HashMap(); path_pn.put("https://", parknodesurl); string result_pn = ArtemisHttpUtil.doPostStringArtemis(path_pn, pnBody, null, "*/*", "application/json", null); var parknodes_d = JsonConvert.DeserializeObject <ParkNodes>(result_pn); Console.WriteLine("停车场节点查询code:" + parknodes_d.code); parknodes.AddRange(parknodes_d.data.list); var pn_total = parknodes_d.data.total; if ((pn_total - page * 20) % 20 > 0) { Console.WriteLine("开始迭代"); page++; Parking(page); } }
public void setClientInfo(java.util.Properties props) { java.util.HashMap <String, java.sql.ClientInfoStatus> errors = new java.util.HashMap <String, java.sql.ClientInfoStatus>(); java.util.Enumeration <String> names = props.keys(); String name = null; while (names.hasMoreElements()) { try { name = names.nextElement(); this.setClientInfo(name, props.get(name)); } catch (java.sql.SQLClientInfoException) { errors.put(name, java.sql.ClientInfoStatus.REASON_UNKNOWN); } } if (0 != errors.size()) { throw new java.sql.SQLClientInfoException(errors); } }
/// <summary> /// 通过海康平台api获取监控在线离线的状态 /// </summary> /// <param name="indexCode"></param> /// <returns></returns> public string GetJianKState(string indexCode) { LogHelper.WriteLog(typeof(string), "获取监控状态"); string onlineP = "/artemis/api/resource/v1/cameras/indexCode"; string body_o = "{\"cameraIndexCode\": \"" + indexCode + "\"}"; java.util.Map path_o = new java.util.HashMap(); path_o.put("https://", onlineP); string result_o = ArtemisHttpUtil.doPostStringArtemis(path_o, body_o, null, "*/*", "application/json", null); var online_d = JsonConvert.DeserializeObject <JianKongXQ>(result_o); LogHelper.WriteLog(typeof(string), online_d.ToString()); LogHelper.WriteLog(typeof(string), "在线状态查询code:" + online_d.code); if (online_d.data != null) { return(online_d.data.status == 1 ? "在线" : "离线"); } else { return("未知"); } }
/// <summary> /// 获取监控的在线状态 /// </summary> /// <param name="indexCode"></param> /// <returns>1在线,0不在线</returns> public string GetOnlineState(string indexCode) { Console.WriteLine("获取监控状态"); string onlineP = "/artemis/api/nms/v1/online/camera/get"; string body_o = "{\"indexCodes\": [\"" + indexCode + "\"]}"; java.util.Map path_o = new java.util.HashMap(); path_o.put("https://", onlineP); string result_o = ArtemisHttpUtil.doPostStringArtemis(path_o, body_o, null, "*/*", "application/json", null); var online_d = JsonConvert.DeserializeObject <Online.Online>(result_o); //Console.WriteLine(indexCode + "在线状态查询code:" + online_d.code); LogHelper.WriteLog(typeof(string), indexCode + "在线状态查询code:" + online_d.code); if (online_d.data.list.Count > 0) { return(online_d.data.list[0].online == 1 ? "在线" : "离线"); } else { return("未知"); } }
/// <summary> /// 停车场车位信息 /// </summary> /// <param name="indexcode"></param> public void ParkingCarport(string indexcode, HaikanSmartTownCockpit.WatchDog.sqjz.model2.List data) { string carportUrl = "/artemis/api/pms/v1/park/remainSpaceNum"; string cpbody = "{\"parkSyscode\": \"" + indexcode + "\"}"; java.util.Map path_cp = new java.util.HashMap(); path_cp.put("https://", carportUrl); string result_cp = ArtemisHttpUtil.doPostStringArtemis(path_cp, cpbody, null, "*/*", "application/json", null); var parkcarport_cp = JsonConvert.DeserializeObject <Carport>(result_cp); var carport = parkcarport_cp.data[0]; if (_dbContext2.ParkingLot.Any(x => x.ParkingIndexCode == data.indexCode && x.IsDeleted == 0)) { var entity = _dbContext2.ParkingLot.FirstOrDefault(x => x.ParkingIndexCode == data.indexCode && x.IsDeleted == 0); entity.Zchewei = carport.totalPlace.ToString(); entity.Schewei = carport.leftPlace.ToString(); entity.Ychewei = (carport.totalPlace - carport.leftPlace).ToString(); } else { ParkingLot lot = new ParkingLot() { ParkingLotUuid = Guid.NewGuid(), ParkingLotName = data.name, ParkingIndexCode = data.indexCode, IsDeleted = 0, Zchewei = carport.totalPlace.ToString(), Schewei = carport.leftPlace.ToString(), Ychewei = (carport.totalPlace - carport.leftPlace).ToString(), AddTime = DateTime.Now.ToString("yyyy-MM-dd"), }; _dbContext2.ParkingLot.Add(lot); } var num = _dbContext2.SaveChanges(); Console.WriteLine("添加结果:" + num); }
/// <summary> /// 获取海康平台上所有的监控 /// </summary> /// <param name="page"></param> public void Jiankong(int page = 1) { string regionP = "/artemis/api/resource/v1/cameras"; string body_r = "{\"pageNo\":" + page + ",\"pageSize\": 2000}"; java.util.Map path_r = new java.util.HashMap(); path_r.put("https://", regionP); string result_r = ArtemisHttpUtil.doPostStringArtemis(path_r, body_r, null, "*/*", "application/json", null); var region_d = JsonConvert.DeserializeObject <JianKong>(result_r); LogHelper.WriteLog(typeof(string), "区域查询code:" + region_d.code); jiankong.AddRange(region_d.data.list); var region_total = region_d.data.total; if ((region_total - page * 2000) % 2000 > 0) { LogHelper.WriteLog(typeof(string), "开始迭代"); page++; Jiankong(page); } }
/** * Returns the array of providers which meet the user supplied string * filter. The specified filter must be supplied in one of two formats: * <nl> * <li> CRYPTO_SERVICE_NAME.ALGORITHM_OR_TYPE</li> * <p/> * (for example: "MessageDigest.SHA") * <li> CRYPTO_SERVICE_NAME.ALGORITHM_OR_TYPE</li> * ATTR_NAME:ATTR_VALUE * <p/> * (for example: "Signature.MD2withRSA KeySize:512") * </nl> * * @param filter * case-insensitive filter. * @return the providers which meet the user supplied string filter {@code * filter}. A {@code null} value signifies that none of the * installed providers meets the filter specification. * @throws InvalidParameterException * if an unusable filter is supplied. * @throws NullPointerException * if {@code filter} is {@code null}. */ public static Provider[] getProviders(String filter) { if (filter == null) { throw new java.lang.NullPointerException("The filter is null"); //$NON-NLS-1$ } if (filter.length() == 0) { throw new InvalidParameterException("The filter is not in the required format"); //$NON-NLS-1$ } java.util.HashMap<String, String> hm = new java.util.HashMap<String, String>(); int i = filter.indexOf(':'); if ((i == filter.length() - 1) || (i == 0)) { throw new InvalidParameterException("The filter is not in the required format"); //$NON-NLS-1$ } if (i < 1) { hm.put(filter, ""); //$NON-NLS-1$ } else { hm.put(filter.substring(0, i), filter.substring(i + 1)); } return getProviders(hm); }
/** * Returns a {@link Map} mapping each unique element in the given * {@link Collection} to an {@link Integer} representing the number * of occurrences of that element in the {@link Collection}. * <p> * Only those elements present in the collection will appear as * keys in the map. * * @param coll the collection to get the cardinality map for, must not be null * @return the populated cardinality map */ public static java.util.Map<Object, Object> getCardinalityMap(java.util.Collection<Object> coll) { java.util.Map<Object, Object> count = new java.util.HashMap<Object, Object>(); for (java.util.Iterator<Object> it = coll.iterator(); it.hasNext(); ) { Object obj = it.next(); java.lang.Integer c = (java.lang.Integer)(count.get(obj)); if (c == null) { count.put(obj, INTEGER_ONE); } else { count.put(obj, new java.lang.Integer(c.intValue() + 1)); } } return count; }
static Color() { sColorNameMap = new java.util.HashMap<string, int>(); sColorNameMap.put("black", BLACK); sColorNameMap.put("darkgray", DKGRAY); sColorNameMap.put("gray", GRAY); sColorNameMap.put("lightgray", LTGRAY); sColorNameMap.put("white", WHITE); sColorNameMap.put("red", RED); sColorNameMap.put("green", GREEN); sColorNameMap.put("blue", BLUE); sColorNameMap.put("yellow", YELLOW); sColorNameMap.put("cyan", CYAN); sColorNameMap.put("magenta", MAGENTA); }
internal override object[] GetDeclaredAnnotations() { java.util.HashMap targetMap = new java.util.HashMap(); targetMap.put("value", new java.lang.annotation.ElementType[] { java.lang.annotation.ElementType.METHOD }); java.util.HashMap retentionMap = new java.util.HashMap(); retentionMap.put("value", java.lang.annotation.RetentionPolicy.RUNTIME); return new object[] { java.lang.reflect.Proxy.newProxyInstance(null, new java.lang.Class[] { typeof(java.lang.annotation.Target) }, new sun.reflect.annotation.AnnotationInvocationHandler(typeof(java.lang.annotation.Target), targetMap)), java.lang.reflect.Proxy.newProxyInstance(null, new java.lang.Class[] { typeof(java.lang.annotation.Retention) }, new sun.reflect.annotation.AnnotationInvocationHandler(typeof(java.lang.annotation.Retention), retentionMap)) }; }
internal override object[] GetDeclaredAnnotations() { // note that AttributeUsageAttribute.Inherited does not map to java.lang.annotation.Inherited AttributeTargets validOn = GetAttributeUsage().ValidOn; List<java.lang.annotation.ElementType> targets = new List<java.lang.annotation.ElementType>(); if ((validOn & (AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Delegate | AttributeTargets.Assembly)) != 0) { targets.Add(java.lang.annotation.ElementType.TYPE); } if ((validOn & AttributeTargets.Constructor) != 0) { targets.Add(java.lang.annotation.ElementType.CONSTRUCTOR); } if ((validOn & AttributeTargets.Field) != 0) { targets.Add(java.lang.annotation.ElementType.FIELD); } if ((validOn & AttributeTargets.Method) != 0) { targets.Add(java.lang.annotation.ElementType.METHOD); } if ((validOn & AttributeTargets.Parameter) != 0) { targets.Add(java.lang.annotation.ElementType.PARAMETER); } java.util.HashMap targetMap = new java.util.HashMap(); targetMap.put("value", targets.ToArray()); java.util.HashMap retentionMap = new java.util.HashMap(); retentionMap.put("value", java.lang.annotation.RetentionPolicy.RUNTIME); return new object[] { java.lang.reflect.Proxy.newProxyInstance(null, new java.lang.Class[] { typeof(java.lang.annotation.Target) }, new sun.reflect.annotation.AnnotationInvocationHandler(typeof(java.lang.annotation.Target), targetMap)), java.lang.reflect.Proxy.newProxyInstance(null, new java.lang.Class[] { typeof(java.lang.annotation.Retention) }, new sun.reflect.annotation.AnnotationInvocationHandler(typeof(java.lang.annotation.Retention), retentionMap)) }; }
// Misc //----------------------------------------------------------------------- /** * Inverts the supplied map returning a new HashMap such that the keys of * the input are swapped with the values. * <p> * This operation assumes that the inverse mapping is well defined. * If the input map had multiple entries with the same value mapped to * different keys, the returned map will map one of those keys to the * value, but the exact key which will be mapped is undefined. * * @param map the map to invert, may not be null * @return a new HashMap containing the inverted data * @throws NullPointerException if the map is null */ public static java.util.Map<Object, Object> invertMap(java.util.Map<Object, Object> map) { java.util.HashMap<Object, Object> outJ = new java.util.HashMap<Object, Object>(map.size()); for (java.util.Iterator<java.util.MapNS.Entry<Object, Object>> it = map.entrySet().iterator(); it.hasNext(); ) { java.util.MapNS.Entry<Object, Object> entry = it.next(); outJ.put(entry.getValue(), entry.getKey()); } return outJ; }
// Update provider Services if the properties was changed private void updatePropertyServiceTable() { Object _key; Object _value; Provider.Service s; String serviceName; String algorithm; if (changedProperties == null || changedProperties.isEmpty()) { return; } java.util.Iterator <java.util.MapNS.Entry <String, String> > it = changedProperties.entrySet().iterator(); for (; it.hasNext();) { java.util.MapNS.Entry <String, String> entry = it.next(); _key = entry.getKey(); _value = entry.getValue(); if (_key == null || _value == null || !(_key is String) || !(_value is String)) { continue; } String key = (String)_key; String value = (String)_value; if (key.startsWith("Provider")) { // Provider service type is reserved //$NON-NLS-1$ continue; } int i; if (key.startsWith("Alg.Alias.")) { // Alg.Alias.<crypto_service>.<aliasName>=<stanbdardName> //$NON-NLS-1$ String aliasName; String service_alias = key.substring(10); i = service_alias.indexOf('.'); serviceName = service_alias.substring(0, i); aliasName = service_alias.substring(i + 1); algorithm = value; String algUp = algorithm.toUpperCase(); Object o = null; if (propertyServiceTable == null) { propertyServiceTable = new TwoKeyHashMap <String, String, Service>(128); } else { o = propertyServiceTable.get(serviceName, algUp); } if (o != null) { s = (Provider.Service)o; s.aliases.add(aliasName); if (propertyAliasTable == null) { propertyAliasTable = new TwoKeyHashMap <String, String, Service>(256); } propertyAliasTable.put(serviceName, aliasName.toUpperCase(), s); } else { String className = (String)changedProperties .get(serviceName + "." + algorithm); //$NON-NLS-1$ if (className != null) { java.util.ArrayList <String> l = new java.util.ArrayList <String>(); l.add(aliasName); s = new Provider.Service(this, serviceName, algorithm, className, l, new java.util.HashMap <String, String>()); propertyServiceTable.put(serviceName, algUp, s); if (propertyAliasTable == null) { propertyAliasTable = new TwoKeyHashMap <String, String, Service>(256); } propertyAliasTable.put(serviceName, aliasName .toUpperCase(), s); } } continue; } int j = key.indexOf('.'); if (j == -1) { // unknown format continue; } i = key.indexOf(' '); if (i == -1) { // <crypto_service>.<algorithm_or_type>=<className> serviceName = key.substring(0, j); algorithm = key.substring(j + 1); String alg = algorithm.toUpperCase(); Object o = null; if (propertyServiceTable != null) { o = propertyServiceTable.get(serviceName, alg); } if (o != null) { s = (Provider.Service)o; s.className = value; } else { s = new Provider.Service(this, serviceName, algorithm, value, new java.util.ArrayList <String>(), new java.util.HashMap <String, String>()); if (propertyServiceTable == null) { propertyServiceTable = new TwoKeyHashMap <String, String, Service>(128); } propertyServiceTable.put(serviceName, alg, s); } } else { // <crypto_service>.<algorithm_or_type> // <attribute_name>=<attrValue> serviceName = key.substring(0, j); algorithm = key.substring(j + 1, i); String attribute = key.substring(i + 1); String alg = algorithm.toUpperCase(); Object o = null; if (propertyServiceTable != null) { o = propertyServiceTable.get(serviceName, alg); } if (o != null) { s = (Provider.Service)o; s.attributes.put(attribute, value); } else { String className = (String)changedProperties .get(serviceName + "." + algorithm); //$NON-NLS-1$ if (className != null) { java.util.HashMap <String, String> m = new java.util.HashMap <String, String>(); m.put(attribute, value); s = new Provider.Service(this, serviceName, algorithm, className, new java.util.ArrayList <String>(), m); if (propertyServiceTable == null) { propertyServiceTable = new TwoKeyHashMap <String, String, Service>(128); } propertyServiceTable.put(serviceName, alg, s); } } } } servicesChanged(); changedProperties.clear(); }
/** * Creates a new HashMap using data copied from a ResourceBundle. * * @param resourceBundle the resource bundle to convert, may not be null * @return the hashmap containing the data * @throws NullPointerException if the bundle is null */ public static java.util.Map<Object, Object> toMap(java.util.ResourceBundle resourceBundle) { java.util.Enumeration<Object> enumeration = resourceBundle.getKeys(); java.util.Map<Object, Object> map = new java.util.HashMap<Object,Object>(); while (enumeration.hasMoreElements()) { String key = (String)enumeration.nextElement(); Object value = resourceBundle.getObject(key); map.put(key, value); } return map; }
public org.openrdf.query.GraphQueryResult evaluate() { IGraph g = this.EvaluateQuery(); SesameMapping mapping = new SesameMapping(g, new dotSesame.impl.GraphImpl()); IEnumerable<dotSesame.Statement> stmts = from t in g.Triples select SesameConverter.ToSesame(t, mapping); DotNetEnumerableWrapper wrapper = new DotNetEnumerableWrapper(stmts); java.util.HashMap map = new java.util.HashMap(); foreach (String prefix in g.NamespaceMap.Prefixes) { map.put(prefix, g.NamespaceMap.GetNamespaceUri(prefix).ToString()); } dotSesameQuery.impl.GraphQueryResultImpl results = new org.openrdf.query.impl.GraphQueryResultImpl(map, wrapper); return results; }
// The activity manager dispatched a broadcast to a registered // receiver in this process, but before it could be delivered the // receiver was unregistered. Acknowledge the broadcast on its // behalf so that the system's broadcast sequence can continue. public android.app.IServiceConnection getServiceDispatcher(android.content.ServiceConnection c, android.content.Context context, android.os.Handler handler, int flags) { lock (mServices) { android.app.LoadedApk.ServiceDispatcher sd = null; java.util.HashMap<android.content.ServiceConnection, android.app.LoadedApk.ServiceDispatcher > map = mServices.get(context); if (map != null) { sd = map.get(c); } if (sd == null) { sd = new android.app.LoadedApk.ServiceDispatcher(c, context, handler, flags); if (map == null) { map = new java.util.HashMap<android.content.ServiceConnection, android.app.LoadedApk .ServiceDispatcher>(); mServices.put(context, map); } map.put(c, sd); } else { sd.validate(context, handler); } return sd.getIServiceConnection(); } }
/** * Construct an emptyjava.util.Map<Object,Object>with the specified capacity. * * @param capacity the initial capacity of the empty map */ public FastHashMap(int capacity) : base() { this.map = new java.util.HashMap <Object, Object>(capacity); }
public java.util.Map<AttributedCharacterIteratorNS.Attribute, System.Object> getAttributes() { java.util.Map<AttributedCharacterIteratorNS.Attribute, System.Object> result = new java.util.HashMap<AttributedCharacterIteratorNS.Attribute, System.Object>();//(attrString.attributeMap.size() * 4 / 3) + 1); java.util.Iterator<java.util.MapNS.Entry<AttributedCharacterIteratorNS.Attribute, java.util.List<IAC_Range>>> it = attrString.attributeMap .entrySet().iterator(); while (it.hasNext()) { java.util.MapNS.Entry<AttributedCharacterIteratorNS.Attribute, java.util.List<IAC_Range>> entry = it.next(); if (attributesAllowed == null || attributesAllowed.contains(entry.getKey())) { System.Object value = currentValue(entry.getValue()); if (value != null) { result.put(entry.getKey(), value); } } } return result; }
// system crashed, nothing we can do //Slog.i(TAG, "Receiver registrations: " + mReceivers); // system crashed, nothing we can do //Slog.i(TAG, "Service registrations: " + mServices); public android.content.IIntentReceiver getReceiverDispatcher(android.content.BroadcastReceiver r, android.content.Context context, android.os.Handler handler, android.app.Instrumentation instrumentation, bool registered) { lock (mReceivers) { android.app.LoadedApk.ReceiverDispatcher rd = null; java.util.HashMap<android.content.BroadcastReceiver, android.app.LoadedApk.ReceiverDispatcher > map = null; if (registered) { map = mReceivers.get(context); if (map != null) { rd = map.get(r); } } if (rd == null) { rd = new android.app.LoadedApk.ReceiverDispatcher(r, context, handler, instrumentation , registered); if (registered) { if (map == null) { map = new java.util.HashMap<android.content.BroadcastReceiver, android.app.LoadedApk .ReceiverDispatcher>(); mReceivers.put(context, map); } map.put(r, rd); } } else { rd.validate(context, handler); } rd.mForgotten = false; return rd.getIIntentReceiver(); } }
//throws NoSuchAlgorithmException private static java.security.Provider getProvider(String engine, String alg, String mech) { java.util.Map<String, String> map = new java.util.HashMap<String, String>(); map.put(engine + "." + alg, ""); map.put(engine + "." + alg + " " + "MechanismType", mech); java.security.Provider[] providers = java.security.Security.getProviders(map); if (providers == null) { if (mech.equals("DOM")) { // look for providers without MechanismType specified map.clear(); map.put(engine + "." + alg, ""); providers = java.security.Security.getProviders(map); if (providers != null) { return providers[0]; } } throw new java.security.NoSuchAlgorithmException("Algorithm type " + alg + " not available"); } return providers[0]; }
/// <summary>Read a HashMap object from an XmlPullParser.</summary> /// <remarks> /// Read a HashMap object from an XmlPullParser. The XML data could /// previously have been generated by writeMapXml(). The XmlPullParser /// must be positioned <em>after</em> the tag that begins the map. /// </remarks> /// <param name="parser">The XmlPullParser from which to read the map data.</param> /// <param name="endTag">Name of the tag that will end the map, usually "map".</param> /// <param name="name"> /// An array of one string, used to return the name attribute /// of the map's tag. /// </param> /// <returns>HashMap The newly generated map.</returns> /// <seealso cref="readMapXml(java.io.InputStream)">readMapXml(java.io.InputStream)</seealso> /// <exception cref="org.xmlpull.v1.XmlPullParserException"></exception> /// <exception cref="System.IO.IOException"></exception> public static java.util.HashMap<object, object> readThisMapXml(org.xmlpull.v1.XmlPullParser parser, string endTag, string[] name) { java.util.HashMap<object, object> map = new java.util.HashMap<object, object>(); int eventType = parser.getEventType(); do { if (eventType == org.xmlpull.v1.XmlPullParserClass.START_TAG) { object val = readThisValueXml(parser, name); if (name[0] != null) { //System.out.println("Adding to map: " + name + " -> " + val); map.put(name[0], val); } else { throw new org.xmlpull.v1.XmlPullParserException("Map value without name attribute: " + parser.getName()); } } else { if (eventType == org.xmlpull.v1.XmlPullParserClass.END_TAG) { if (parser.getName().Equals(endTag)) { return map; } throw new org.xmlpull.v1.XmlPullParserException("Expected " + endTag + " end tag at: " + parser.getName()); } } eventType = parser.next(); } while (eventType != org.xmlpull.v1.XmlPullParserClass.END_DOCUMENT); throw new org.xmlpull.v1.XmlPullParserException("Document ended before " + endTag + " end tag"); }
static void Main(string[] args) { bool mergedOutput = true; string projectDir = System.IO.Directory.GetParent( System.IO.Directory.GetParent( Environment.CurrentDirectory.ToString()).ToString()).ToString() + "\\"; string saveToPathPrefix = projectDir + @"OUT_MailMergeField"; // Programmatically configure Common Logging // (alternatively, you could do it declaratively in app.config) NameValueCollection commonLoggingproperties = new NameValueCollection(); commonLoggingproperties["showDateTime"] = "false"; commonLoggingproperties["level"] = "INFO"; LogManager.Adapter = new Common.Logging.Simple.ConsoleOutLoggerFactoryAdapter(commonLoggingproperties); ILog log = LogManager.GetCurrentClassLogger(); log.Info("Hello from Common Logging"); // Necessary, if slf4j-api and slf4j-NetCommonLogging are separate DLLs ikvm.runtime.Startup.addBootClassPathAssembly( System.Reflection.Assembly.GetAssembly( typeof(org.slf4j.impl.StaticLoggerBinder))); // Configure to find docx4j.properties // .. add as URL the dir containing docx4j.properties (not the file itself!) Plutext.PropertiesConfigurator.setDocx4jPropertiesDir(projectDir + @"src\samples\resources\"); // Create a docx4j docx WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage(); org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart(); documentPart.addObject(addParagraphWithMergeField("Hallo, MERGEFORMAT: ", " MERGEFIELD kundenname \\* MERGEFORMAT ", "«Kundenname»")); documentPart.addObject(addParagraphWithMergeField("Hallo, lower: ", " MERGEFIELD kundenname \\* Lower ", "«Kundenname»")); documentPart.addObject(addParagraphWithMergeField("Hallo, firstcap: ", " MERGEFIELD kundenname \\* FirstCap MERGEFORMAT ", "«Kundenname»")); documentPart.addObject(addParagraphWithMergeField("Hallo, random case: ", " MERGEFIELD KunDenName \\* MERGEFORMAT ", "«Kundenname»")); documentPart.addObject(addParagraphWithMergeField("Hallo, all caps: ", " MERGEFIELD KUNDENNAME \\* Upper MERGEFORMAT ", "«Kundenname»")); // " MERGEFIELD yourdate \@ "dddd, MMMM dd, yyyy" " //documentPart.addObject(addParagraphWithMergeField("Date example", " MERGEFIELD yourdate \\@ 'dddd, MMMM dd, yyyy' ", "«Kundenname»")); // FIXME .. doesn't work via .NET. Why? documentPart.addObject(addParagraphWithMergeField("Number example: ", " MERGEFIELD yournumber \\# $#,###,### ", "«Kundenname»")); // .. or alternatively, load existing //string template = @"C:\Users\jharrop\Documents\tmp-test-docx\HelloWorld.docx"; //WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage // .load(new java.io.File(template)); //Console.WriteLine(documentPart.getXML()); java.util.List data = new java.util.ArrayList(); // TODO: make more .NET friendly // Instance 1 java.util.Map map = new java.util.HashMap(); map.put( new DataFieldName("KundenNAme"), "Daffy duck"); map.put( new DataFieldName("Kundenname"), "Plutext"); map.put(new DataFieldName("Kundenstrasse"), "Bourke Street"); // To get dates right, make sure you have docx4j property docx4j.Fields.Dates.DateFormatInferencer.USA // set to true or false as appropriate. It defaults to non-US. map.put(new DataFieldName("yourdate"), "15/4/2013"); map.put(new DataFieldName("yournumber"), "2456800"); data.add(map); // Instance 2 map = new java.util.HashMap(); map.put( new DataFieldName("Kundenname"), "Jason"); map.put(new DataFieldName("Kundenstrasse"), "Collins Street"); map.put(new DataFieldName("yourdate"), "12/10/2013"); map.put(new DataFieldName("yournumber"), "1234800"); data.add(map); if (mergedOutput) { /* * This is a "poor man's" merge, which generates the mail merge * results as a single docx, and just hopes for the best. * Images and hyperlinks should be ok. But numbering * will continue, as will footnotes/endnotes. * * If your resulting documents aren't opening in Word, then * you probably need MergeDocx to perform the merge. */ // How to treat the MERGEFIELD, in the output? org.docx4j.model.fields.merge.MailMerger.setMERGEFIELDInOutput(org.docx4j.model.fields.merge.MailMerger.OutputField.KEEP_MERGEFIELD); // log.Debug(XmlUtils.marshaltoString(wordMLPackage.getMainDocumentPart().getJaxbElement(), true, true)); WordprocessingMLPackage output = org.docx4j.model.fields.merge.MailMerger.getConsolidatedResultCrude(wordMLPackage, data, true); // log.Info(XmlUtils.marshaltoString(output.getMainDocumentPart().getJaxbElement(), true, true)); SaveFromJavaUtils.save(output, saveToPathPrefix + ".docx"); } else { // Need to keep thane MERGEFIELDs. If you don't, you'd have to clone the docx, and perform the // merge on the clone. For how to clone, see the MailMerger code, method getConsolidatedResultCrude org.docx4j.model.fields.merge.MailMerger.setMERGEFIELDInOutput(org.docx4j.model.fields.merge.MailMerger.OutputField.KEEP_MERGEFIELD); for (int i = 0; i < data.size(); i++ ) { java.util.Map thismap = (java.util.Map)data.get(i); org.docx4j.model.fields.merge.MailMerger.performMerge(wordMLPackage, thismap, true); SaveFromJavaUtils.save(wordMLPackage, saveToPathPrefix + "_" + i + ".docx"); } } log.Info("Done! Saved to " + saveToPathPrefix); }
/// <summary> /// Sets the /// <see cref="Filter">Filter</see> /// to by this LayoutInflater. If a view is attempted to be inflated /// which is not allowed by the /// <see cref="Filter">Filter</see> /// , the /// <see cref="inflate(int, ViewGroup)">inflate(int, ViewGroup)</see> /// call will /// throw an /// <see cref="InflateException">InflateException</see> /// . This filter will replace any previous filter set on this /// LayoutInflater. /// </summary> /// <param name="filter"> /// The Filter which restricts the set of Views that are allowed to be inflated. /// This filter will replace any previous filter set on this LayoutInflater. /// </param> public virtual void setFilter(android.view.LayoutInflater.Filter filter) { mFilter = filter; if (filter != null) { mFilterMap = new java.util.HashMap<string, bool>(); } }
private void readObject(java.io.ObjectInputStream inJ) { //throws IOException, ClassNotFoundException { inJ.defaultReadObject(); maps[0] = new java.util.HashMap<Object, Object>(); maps[1] = new java.util.HashMap<Object, Object>(); java.util.Map<Object, Object> map = (java.util.Map<Object, Object>)inJ.readObject(); putAll(map); }
// Update provider Services if the properties was changed private void updatePropertyServiceTable() { Object _key; Object _value; Provider.Service s; String serviceName; String algorithm; if (changedProperties == null || changedProperties.isEmpty()) { return; } java.util.Iterator<java.util.MapNS.Entry<String, String>> it = changedProperties.entrySet().iterator(); for (; it.hasNext(); ) { java.util.MapNS.Entry<String, String> entry = it.next(); _key = entry.getKey(); _value = entry.getValue(); if (_key == null || _value == null || !(_key is String) || !(_value is String)) { continue; } String key = (String)_key; String value = (String)_value; if (key.startsWith("Provider")) { // Provider service type is reserved //$NON-NLS-1$ continue; } int i; if (key.startsWith("Alg.Alias.")) { // Alg.Alias.<crypto_service>.<aliasName>=<stanbdardName> //$NON-NLS-1$ String aliasName; String service_alias = key.substring(10); i = service_alias.indexOf('.'); serviceName = service_alias.substring(0, i); aliasName = service_alias.substring(i + 1); algorithm = value; String algUp = algorithm.toUpperCase(); Object o = null; if (propertyServiceTable == null) { propertyServiceTable = new TwoKeyHashMap<String, String, Service>(128); } else { o = propertyServiceTable.get(serviceName, algUp); } if (o != null) { s = (Provider.Service)o; s.aliases.add(aliasName); if (propertyAliasTable == null) { propertyAliasTable = new TwoKeyHashMap<String, String, Service>(256); } propertyAliasTable.put(serviceName, aliasName.toUpperCase(), s); } else { String className = (String)changedProperties .get(serviceName + "." + algorithm); //$NON-NLS-1$ if (className != null) { java.util.ArrayList<String> l = new java.util.ArrayList<String>(); l.add(aliasName); s = new Provider.Service(this, serviceName, algorithm, className, l, new java.util.HashMap<String, String>()); propertyServiceTable.put(serviceName, algUp, s); if (propertyAliasTable == null) { propertyAliasTable = new TwoKeyHashMap<String, String, Service>(256); } propertyAliasTable.put(serviceName, aliasName .toUpperCase(), s); } } continue; } int j = key.indexOf('.'); if (j == -1) { // unknown format continue; } i = key.indexOf(' '); if (i == -1) { // <crypto_service>.<algorithm_or_type>=<className> serviceName = key.substring(0, j); algorithm = key.substring(j + 1); String alg = algorithm.toUpperCase(); Object o = null; if (propertyServiceTable != null) { o = propertyServiceTable.get(serviceName, alg); } if (o != null) { s = (Provider.Service)o; s.className = value; } else { s = new Provider.Service(this, serviceName, algorithm, value, new java.util.ArrayList<String>(), new java.util.HashMap<String, String>()); if (propertyServiceTable == null) { propertyServiceTable = new TwoKeyHashMap<String, String, Service>(128); } propertyServiceTable.put(serviceName, alg, s); } } else { // <crypto_service>.<algorithm_or_type> // <attribute_name>=<attrValue> serviceName = key.substring(0, j); algorithm = key.substring(j + 1, i); String attribute = key.substring(i + 1); String alg = algorithm.toUpperCase(); Object o = null; if (propertyServiceTable != null) { o = propertyServiceTable.get(serviceName, alg); } if (o != null) { s = (Provider.Service)o; s.attributes.put(attribute, value); } else { String className = (String)changedProperties .get(serviceName + "." + algorithm); //$NON-NLS-1$ if (className != null) { java.util.HashMap<String, String> m = new java.util.HashMap<String, String>(); m.put(attribute, value); s = new Provider.Service(this, serviceName, algorithm, className, new java.util.ArrayList<String>(), m); if (propertyServiceTable == null) { propertyServiceTable = new TwoKeyHashMap<String, String, Service>(128); } propertyServiceTable.put(serviceName, alg, s); } } } } servicesChanged(); changedProperties.clear(); }
public static void Main(string[] args) { // if jsc added manifest, this could be run with jvm also. // Error: Could not find or load main class com.twilio.exe // META-INF/MANIFEST.MF // Main-Class: //Closing partial types... //0bb8:02:01 0024:0001 __clr__com.twilio define jsc.meta::ScriptCoreLib.Desktop.JVM.JVMLauncher //0bb8:02:01 0025:0002 __clr__com.twilio define jsc.meta::ScriptCoreLib.Desktop.JVM.JVMLauncher+ //0bb8:02:01 0025:0003 __clr__com.twilio define jsc.meta::ScriptCoreLib.Desktop.JVM.JVMLauncher+ //0bb8:02:01 RewriteToAssembly error: System.InvalidOperationException: ---> System.ArgumentException: Duplicate type name within an assembly. // at System.Reflection.Emit.TypeBuilder.DefineType(RuntimeModule module, String fullname, Int32 tkParent, TypeAttributes attributes, Int32 tk // at System.Reflection.Emit.TypeBuilder.Init(String fullname, TypeAttributes attr, Type parent, Type[] interfaces, ModuleBuilder module, Pack // at System.Reflection.Emit.TypeBuilder.DefineNestedType(String name, TypeAttributes attr, Type parent, Type[] interfaces) // at jsc.meta.Commands.Rewrite.RewriteToAssembly.CopyTypeDefinition.DefineType(TypeBuilder _DeclaringType, String TypeName, Type BaseType, Ty // at jsc.meta.Commands.Rewrite.RewriteToAssembly.CopyTypeDefinition.Invoke() // --- End of inner exception stack trace --- // at jsc.meta.Commands.Rewrite.RewriteToAssembly.CopyTypeDefinition.Invoke() // at jsc.meta.Commands.Rewrite.RewriteToAssembly.<>c__DisplayClass434.<InternalInvoke>b__3b1(Type SourceType) // http://www.twilio.com/docs/quickstart/java/sms // http://www.twilio.com/docs/quickstart/java/sms/sending-via-rest try { var ACCOUNT_SID = "AC123"; var AUTH_TOKEN = "456bef"; var client = new com.twilio.sdk.TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN); var account = client.getAccount(); var smsFactory = account.getSmsFactory(); var smsParams = new java.util.HashMap(); smsParams.put("To", "+14105551234"); smsParams.put("From", "(410) 555-6789"); // Replace with a valid phone // number in your account smsParams.put("Body", "Where's Wallace?"); var sms = smsFactory.create(smsParams); } catch (Exception ex) { System.Console.WriteLine("error: " + new { ex.Message, ex.StackTrace }); } // error: { Message = AccountSid 'AC123' is not valid. It should be the 34 character unique identifier starting with 'AC', StackTrace = java.lang.IllegalArgumentException: AccountSid 'AC123' is not valid. It should be the 34 character unique identifier starting with 'AC' // at com.twilio.sdk.TwilioRestClient.validateAccountSid(TwilioRestClient.java:181) // at com.twilio.sdk.TwilioRestClient.<init>(TwilioRestClient.java:129) // at com.twilio.sdk.TwilioRestClient.<init>(TwilioRestClient.java:110) // at com.twilio.Program.main(Program.java:40) // } //jvm: java.lang.Object //clr: System.Object // 002e log4j-1.2.16 create org.apache.log4j.ConsoleAppender //System.TypeLoadException: Derived method 'append' in type 'org.apache.log4j.ConsoleAppender' from assembly 'log4j-1.2.16, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' cannot reduce access. // servlet-api-2.3 000d Create javax.servlet.ServletRequestWrapper //System.TypeLoadException: Method 'getLocalAddr' in type 'javax.servlet.ServletRequestWrapper' from assembly 'servlet-api-2.3, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation. // at System.Reflection.Emit.TypeBuilder.TermCreateClass(RuntimeModule module, Int32 tk, ObjectHandleOnStack type) // at System.Reflection.Emit.TypeBuilder.CreateTypeNoLock() // at System.Reflection.Emit.TypeBuilder.CreateType() // at jsc.meta.Library.CreateToJARImportNatives.<>c__DisplayClass8a.<>c__DisplayClassec.<InternalImplementation>b__7b(TypeBuilder SourceTypeBuilder) in x:\jsc.internal.svn\compiler\jsc.internal\jsc.internal\meta\Library\CreateToJARImportNatives.cs:line 2387 // SourceTypeName = "javax.net.ssl.SSLSession" // SourceTypeName = "java.lang.AutoCloseable" // SourceMethods.Length = 0x0000001b // Reflector_Type_GetImplicitAbstractMethods ("jvm: " + typeof(object)).WriteAndWaitAtCLR(); }