/* (non-Javadoc)
@see com.ibm.jaggr.service.impl.modulebuilder.javascript.JavaScriptModuleBuilder#getCacheKeyGenerator()
329318
@Override
	public List<ICacheKeyGenerator> getCacheKeyGenerators(IAggregator aggregator) {
		// Return a provisional cache key generator
		ArrayList<ICacheKeyGenerator> keyGens = new ArrayList<ICacheKeyGenerator>();
		keyGens.addAll(super.getCacheKeyGenerators(aggregator));
		keyGens.add(new CacheKeyGenerator(null, true));
		return keyGens;
	}
1175195
private Object onTableGenerator(EntityMetadata m, Client<?> client, IdDiscriptor keyValue, Object e)
    {
        Object tablegenerator = getAutoGenClazz(client);   
        if (tablegenerator instanceof TableGenerator)
        {
            Object generatedId = ((TableGenerator) tablegenerator).generate(keyValue.getTableDiscriptor(),
                    (ClientBase) client, m.getIdAttribute().getJavaType().getSimpleName());
            try
            {
                generatedId = PropertyAccessorHelper.fromSourceToTargetClass(m.getIdAttribute().getJavaType(),
                        generatedId.getClass(), generatedId);
                PropertyAccessorHelper.setId(e, m, generatedId);
                return generatedId;
            }
            catch (IllegalArgumentException iae)
            {
                log.error("Unknown integral data type for ids : " + m.getIdAttribute().getJavaType());
                throw new KunderaException("Unknown integral data type for ids : " + m.getIdAttribute().getJavaType(),
                        iae);
            }
        }
        throw new IllegalArgumentException(GenerationType.class.getSimpleName() + "." + GenerationType.TABLE
                + " Strategy not supported by this client :" + client.getClass().getName());
    }
931152
public static JawrCacheManager getCacheManager(JawrConfig config, String resourceType) {

		String cacheMgrAttributeName = CACHE_ATTR_PREFIX + resourceType.toUpperCase() + CACHE_ATTR_SUFFIX;
		JawrCacheManager cacheManager = (JawrCacheManager) config.getContext().getAttribute(cacheMgrAttributeName);
		if (cacheManager == null) {
			String cacheManagerClass = config.getProperty(CACHE_PROPERTY_NAME, BasicCacheManager.class.getName());
			cacheManager = (JawrCacheManager) ClassLoaderResourceUtils.buildObjectInstance(cacheManagerClass,
					new Object[] { config });
			config.getContext().setAttribute(cacheMgrAttributeName, cacheManager);
		}
		return cacheManager;
	}
713728
FieldDescriptor getFieldDescriptor(TypeCache.CachedType<?> cachedType, String signature) {
        FieldDescriptor fieldDescriptor = cachedType.getField(signature);
        if (fieldDescriptor == null) {
            fieldDescriptor = scannerContext.getStore().create(FieldDescriptor.class);
            fieldDescriptor.setSignature(signature);
            cachedType.addMember(signature, fieldDescriptor);
        }
        return fieldDescriptor;
    }
955369
public static KeyGenerator getKeyGenerator(String algorithm) {
		final Provider provider = GlobalBouncyCastleProvider.INSTANCE.getProvider();

		KeyGenerator generator;
		try {
			generator = (null == provider) //
					? KeyGenerator.getInstance(getMainAlgorithm(algorithm)) //
					: KeyGenerator.getInstance(getMainAlgorithm(algorithm), provider);
		} catch (NoSuchAlgorithmException e) {
			throw new CryptoException(e);
		}
		return generator;
	}
338060
protected final PainGeneratorIf getPainGenerator() {
        if (this.generator == null) {
            try {
                this.generator = PainGeneratorFactory.get(this, this.getPainVersion());
            } catch (Exception e) {
                String msg = HBCIUtils.getLocMsg("EXCMSG_JOB_CREATE_ERR", this.getPainJobName());
                throw new HBCI_Exception(msg, e);
            }

        }
        return this.generator;
    }
533858
public static NumberGenerator get(final UUID _uuid)
        throws CacheReloadException
    {
        final Cache<UUID, NumberGenerator> cache = InfinispanCache.get().<UUID, NumberGenerator>getCache(
                        NumberGenerator.UUIDCACHE);
        if (!cache.containsKey(_uuid)) {
            NumberGenerator.getNumberGeneratorFromDB(NumberGenerator.SQL_UUID, String.valueOf(_uuid));
        }
        return cache.get(_uuid);
    }
14226
private String buildObjectKey(final Object object) {

        String objectKey = null;
        final Class<?> objectClass = object.getClass();

        final KeyGenerator typeGenerator = objectClass.getAnnotation(KeyGenerator.class);
        if (typeGenerator == null) {
            objectKey = generateAggregatedKey(object);
        } else {
            objectKey = generateTypeKey(object, typeGenerator);
        }

        // If no Type keyGenerator neither Method Generator were used, use the default toString method
        if (objectKey == null) {
            objectKey = object.toString();
        }

        return objectKey;
    }
259207
<E> Node generate(E entity, PersistenceDelegator delegator, PersistenceCache pc, NodeState state)
    {

        EntityMetadata entityMetadata = KunderaMetadataManager.getEntityMetadata(delegator.getKunderaMetadata(),
                entity.getClass());

        if (!new NullOrInvalidEntityRule<E>(entityMetadata).validate(entity))
        {
            Object entityId = onPreChecks(entity, delegator);

            // TODO::check for composite key.
            Node node = builder.buildNode(entity, delegator, entityId, state);

            node = traverseNode(entity, delegator, pc, entityId, node);

            return node;
        }

        return null;
    }
331586
public static IdGenerator getInstance(long nodeId) {
        IdGenerator idGen = cache.get(nodeId);
        if (idGen == null) {
            idGen = new IdGenerator(nodeId);
            idGen.init();
            IdGenerator existing = cache.putIfAbsent(nodeId, idGen);
            idGen = existing != null ? existing : idGen;
        }
        return idGen;
    }
388460
public static <K, V> KeyAffinityService<K> newKeyAffinityService(Cache<K, V> cache, Executor ex, KeyGenerator<K> keyGenerator, int keyBufferSize) {
      return newKeyAffinityService(cache, ex, keyGenerator, keyBufferSize, true);
   }
207167
KeyPair generateKeyPair(int keySize) throws Exception {
        KeyPairGenerator generator = KeyPairGenerator.getInstance(KEY_GENERATION_ALGORITHM, PROVIDER_NAME);
        generator.initialize(keySize, new SecureRandom());
        return generator.generateKeyPair();
    }
290097
public CacheKeyTO getCacheKey(Object target, String methodName, Object[] arguments, String keyExpression,
                                  String hfieldExpression, Object result, boolean hasRetVal) {
        String key = null;
        String hfield = null;
        if (null != keyExpression && keyExpression.trim().length() > 0) {
            try {
                key = scriptParser.getDefinedCacheKey(keyExpression, target, arguments, result, hasRetVal);
                if (null != hfieldExpression && hfieldExpression.trim().length() > 0) {
                    hfield = scriptParser.getDefinedCacheKey(hfieldExpression, target, arguments, result, hasRetVal);
                }
            } catch (Exception ex) {
                log.error(ex.getMessage(), ex);
            }
        } else {
            key = CacheUtil.getDefaultCacheKey(target.getClass().getName(), methodName, arguments);
        }
        if (null == key || key.trim().isEmpty()) {
            throw new IllegalArgumentException("cache key for " + target.getClass().getName() + "." + methodName + " is empty");
        }
        return new CacheKeyTO(config.getNamespace(), key, hfield);
    }
618187
@Override
    public String getCacheDigest(String cacheInstance, boolean useMemoryCacheDigest,
                                 boolean cacheIDOnly, boolean debug) throws javax.management.AttributeNotFoundException { // LI4337-17

        if (tc.isEntryEnabled()) {
            Tr.entry(tc, "getCacheDigest: cacheInstance=" + cacheInstance + " useMemoryCacheDigest=" + useMemoryCacheDigest +
                         " cacheIDOnly=" + cacheIDOnly + " debug=" + debug);
        }
        // Get the cache for this cacheInstance
        DCache cache1 = getCache(cacheInstance);

        // Get the message digest
        getMessageDigestMD5();

        // Calculate total hashcode for cache ids and cache value in memory cache  
        int totalHashcode = cache1.getMemoryCacheHashcode(debug, !cacheIDOnly);

        if (cacheIDOnly == true) {
            // Calculate total hashcode for cache ids in PushPullTable  
            totalHashcode += cache1.getCacheIdsHashcodeInPushPullTable(debug);
        }

        if (useMemoryCacheDigest == false) {
            // Calculate total hashcode for cache ids and cache value in disk cache  
            try {
                totalHashcode += cache1.getDiskCacheHashcode(debug, !cacheIDOnly);
            } catch (DynamicCacheException e) {
                Tr.error(tc, "DYNA1053E", new Object[] { DynaCacheConstants.MBEAN_GET_CACHE_DIGEST, e.getMessage() });
                throw new AttributeNotFoundException(e.getMessage());
            }
        }

        // Convert hashcode to MD5 digest
        String md5Hash = MessageDigestUtility.processMessageDigestForData(MBeans.messageDigestMD5, totalHashcode);

        if (tc.isEntryEnabled()) {
            Tr.exit(tc, "getCacheDigest: Exiting. Entire cache hash in MD5 is " + md5Hash + " for cacheInstance = " + cacheInstance);
        }
        return md5Hash;
    }
732541
@Override
    public Serializable generateKey(final MethodInvocation methodInvocation) {
        //Determine the tareted CachableMethod
        final CachableMethod cachableMethod = this.resolveCacheableMethod(methodInvocation);

        //Use the resolved cachableMethod to determine the seed Map and then get the hash of the key elements
        final Object[] methodArguments = methodInvocation.getArguments();
        final Map<String, Object> seed = this.getSeed(methodArguments, cachableMethod);
        final Integer keyHashCode = this.getKeyHash(seed);

        //If no code generated return null
        if (keyHashCode == null) {
            if (this.logger.isDebugEnabled()) {
                this.logger.debug("No cache key generated for MethodInvocation='" + methodInvocation + "'");
            }
            return null;
        }

        //Calculate the hashCode and checkSum
        final HashCodeCalculator hashCodeCalculator = new HashCodeCalculator();
        hashCodeCalculator.append(keyHashCode);

        //Assemble the serializable key object
        final long checkSum = hashCodeCalculator.getCheckSum();
        final int hashCode = hashCodeCalculator.getHashCode();
        final HashCodeCacheKey hashCodeCacheKey = new HashCodeCacheKey(checkSum, hashCode);

        if (this.logger.isDebugEnabled()) {
            this.logger.debug("Generated cache key '" + hashCodeCacheKey + "' for MethodInvocation='" + methodInvocation + "'");
        }
        return hashCodeCacheKey;
    }
560595
public Key getKey() {
		if(key != null) {
			return key;
		} else if(keySpec != null && secretKeyFactory != null) {
			try {
				return key = secretKeyFactory.generateSecret(keySpec);
			} catch (InvalidKeySpecException e) {
				throw new RuntimeException(e);
			}
		}
		throw new IllegalStateException("Cannot produce key");
	}
1173726
public IdGenerator getIdGenerator(GenerationType generationType, String name) {
		return getIdGenerator(generationType, name, getIdGenerators());
	}