Example #1
0
 // Returns true if this provider has the same value as is given for the
 // given attribute
 private bool checkAttribute(String servAlg, String attribute, String val)
 {
     String attributeValue = getPropertyIgnoreCase(servAlg + ' ' + attribute);
     if (attributeValue != null)
     {
         if (attribute.equalsIgnoreCase("KeySize"))
         { //$NON-NLS-1$
             if (java.lang.Integer.valueOf(attributeValue).compareTo(
                     java.lang.Integer.valueOf(val)) >= 0)
             {
                 return true;
             }
         }
         else
         { // other attributes
             if (attributeValue.equalsIgnoreCase(val))
             {
                 return true;
             }
         }
     }
     return false;
 }
Example #2
0
 // Searches for the property with the specified key in the provider
 // properties. Key is not case-sensitive.
 //
 // @param prop
 // @return the property value with the specified key value.
 private String getPropertyIgnoreCase(String key)
 {
     String res = getProperty(key);
     if (res != null) {
     return res;
     }
     for (java.util.Enumeration<Object> e = propertyNames(); e.hasMoreElements();) {
     String pname = (String) e.nextElement();
     if (key.equalsIgnoreCase(pname)) {
         return getProperty(pname);
     }
     }
     return null;
 }
Example #3
0
        /**
         * Returns the service with the specified {@code type} implementing the
         * specified {@code algorithm}, or {@code null} if no such implementation
         * exists.
         * <p/>
         * If two services match the requested type and algorithm, the one added
         * with the {@link #putService(Service)} is returned (as opposed to the one
         * added via {@link #put(Object, Object)}.
         *
         * @param type
         *            the type of the service (for example {@code KeyPairGenerator})
         * @param algorithm
         *            the algorithm name (case insensitive)
         * @return the requested service, or {@code null} if no such implementation
         *         exists
         */
        public Provider.Service getService(String type,
                String algorithm)
        {
            lock (this)
            {
                if (type == null || algorithm == null)
                {
                    throw new java.lang.NullPointerException();
                }

                if (type.equals(lastServiceName)
                        && algorithm.equalsIgnoreCase(lastAlgorithm))
                {
                    return returnedService;
                }

                String alg = algorithm.toUpperCase();
                Object o = null;
                if (serviceTable != null)
                {
                    o = serviceTable.get(type, alg);
                }
                if (o == null && aliasTable != null)
                {
                    o = aliasTable.get(type, alg);
                }
                if (o == null)
                {
                    updatePropertyServiceTable();
                }
                if (o == null && propertyServiceTable != null)
                {
                    o = propertyServiceTable.get(type, alg);
                }
                if (o == null && propertyAliasTable != null)
                {
                    o = propertyAliasTable.get(type, alg);
                }

                if (o != null)
                {
                    lastServiceName = type;
                    lastAlgorithm = algorithm;
                    returnedService = (Provider.Service)o;
                    return returnedService;
                }
                return null;
            }
        }
Example #4
0
		private void processDelete(String tableName, IDBResult rows2Delete, int[] cols)
		{
			if ( tableName.equalsIgnoreCase("changed_values") || tableName.equalsIgnoreCase("sources") ||
			     tableName.equalsIgnoreCase("client_info"))
				return;
			
			boolean bProcessTable = tableName.equalsIgnoreCase("object_values");
			boolean bSchemaSrc = false;
			int nSrcID = 0;
			if ( !bProcessTable )
			{
				nSrcID = m_db.getAttrMgr().getSrcIDHasBlobsByName(tableName);
				bProcessTable = nSrcID != 0; 
				bSchemaSrc = bProcessTable;
			}
			
			if ( !bProcessTable)
				return;
		
			if ( !bSchemaSrc && !isChangedCol(cols, 3))//value
				return;
			
			for( ; !rows2Delete.isEnd(); rows2Delete.next() )
			{
				if ( !bSchemaSrc )
				{
					nSrcID = rows2Delete.getIntByIdx(0);
					
					String attrib = rows2Delete.getStringByIdx(1);
					String value = rows2Delete.getStringByIdx(3);

					//if (cols == null) //delete
					//	m_db.getAttrMgr().remove(nSrcID, attrib);
					
				    if ( m_db.getAttrMgr().isBlobAttr(nSrcID, attrib) )
				    	processBlobDelete(nSrcID, attrib, value);
				}else
				{
					Object[] data = rows2Delete.getCurData();
					for ( int i = 0; i < rows2Delete.getColCount(); i++ )
					{
						if (!isChangedCol(cols, i))
							continue;
						
						String attrib = rows2Delete.getColName(i);
						if ( !(data[i] is String ) )
							continue;
						
						String value = (String)data[i];
					    if ( m_db.getAttrMgr().isBlobAttr(nSrcID, attrib) )
					    	processBlobDelete(nSrcID, attrib, value);
					}
				}
			}
		}
Example #5
0
 /// <summary>
 /// Removed the specified name/value pair from the additional HTTP headers.
 /// </summary>
 /// <param name="name">the name of the additional HTTP header</param>
 public void RemoveAdditionalHeader(String name)
 {
     foreach (String key in additionalHeaders_.keySet())
     {
         if (name.equalsIgnoreCase(key))
         {
             name = key;
             break;
         }
     }
     additionalHeaders_.remove(name);
 }
Example #6
0
 /// <summary>
 /// Sets the specified name/value pair in the additional HTTP headers.
 /// </summary>
 /// <param name="name">the name of the additional HTTP header</param>
 /// <param name="value">value the value of the additional HTTP header</param>
 public void SetAdditionalHeader(String name, String value)
 {
     foreach (String key in additionalHeaders_.keySet())
     {
         if (name.equalsIgnoreCase(key))
         {
             name = key;
             break;
         }
     }
     additionalHeaders_.put(name, value);
 }
Example #7
0
 /// <summary>
 /// Returns whether the specified header name is already included in the additional HTTP headers.
 /// </summary>
 /// <param name="name">the name of the additional HTTP header</param>
 /// <returns>true if the specified header name is included in the additional HTTP headers</returns>
 public bool IsAdditionalHeader(String name)
 {
     foreach (String key in additionalHeaders_.keySet())
     {
         if (name.equalsIgnoreCase(key))
         {
             return true;
         }
     }
     return false;
 }