All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alachisoft.ncache.client.internal.caching.InprocCache Maven / Gradle / Ivy

package com.alachisoft.ncache.client.internal.caching;

//  Copyright (c) 2018 Alachisoft
//
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License

import Alachisoft.NCache.Caching.*;
import Alachisoft.NCache.Caching.AutoExpiration.*;
import Alachisoft.NCache.Caching.AutoExpiration.DependencyHelper;
import Alachisoft.NCache.Caching.Cache;
import Alachisoft.NCache.Caching.Messaging.Message;
import Alachisoft.NCache.Common.*;
import Alachisoft.NCache.Common.BitSet;
import Alachisoft.NCache.Common.DataReader.*;
import Alachisoft.NCache.Common.DataStructures.EnumerationDataChunk;
import Alachisoft.NCache.Common.DataStructures.EnumerationPointer;
import Alachisoft.NCache.Common.DataTypes.Counter.CounterGetOperation;
import Alachisoft.NCache.Common.DataTypes.Counter.CounterOperation;
import Alachisoft.NCache.Common.DataTypes.Dictionary.DictionaryAddOperation;
import Alachisoft.NCache.Common.DataTypes.Dictionary.DictionaryContainsOperation;
import Alachisoft.NCache.Common.DataTypes.Dictionary.DictionaryGetOperation;
import Alachisoft.NCache.Common.DataTypes.Dictionary.DictionaryRemoveOperation;
import Alachisoft.NCache.Common.DataTypes.HashSet.*;
import Alachisoft.NCache.Common.DataTypes.List.*;
import Alachisoft.NCache.Common.DataTypes.Queue.QueueDequeueOperation;
import Alachisoft.NCache.Common.DataTypes.Queue.QueueEnqueueOperation;
import Alachisoft.NCache.Common.DataTypes.Queue.QueuePeekOperation;
import Alachisoft.NCache.Common.DataTypes.Queue.QueueSearchOperation;
import Alachisoft.NCache.Common.DataTypes.Responses.GetCollectionChunkResponseBase;
import Alachisoft.NCache.Common.Enum.*;
import Alachisoft.NCache.Common.ErrorHandling.ErrorCodes;
import Alachisoft.NCache.Common.ErrorHandling.ErrorMessages;
import Alachisoft.NCache.Common.Enum.SubscriptionType;
import Alachisoft.NCache.Common.Enum.TopicOperationType;
import Alachisoft.NCache.Common.Enum.UserObjectType;
import Alachisoft.NCache.Common.Extensibility.Client.RPC.PartitioningStrategy;
import Alachisoft.NCache.Common.JSON.ExtendedJsonValueBase;
import Alachisoft.NCache.Common.Logger.ILogger;
import Alachisoft.NCache.Common.Util.HashtableUtil;
import Alachisoft.NCache.Config.NewDom.Notifications;
import Alachisoft.NCache.Management.*;
import Alachisoft.NCache.Common.DataTypes.*;
import com.alachisoft.ncache.client.*;
import com.alachisoft.ncache.client.datastructures.DataStructureAttributes;
import com.alachisoft.ncache.client.internal.communication.Connection;
import com.alachisoft.ncache.client.internal.communication.ModuleOperation;
import com.alachisoft.ncache.client.internal.messaging.ReceivedMessages;
import com.alachisoft.ncache.client.internal.util.ConversionUtil;
import com.alachisoft.ncache.client.util.SerializationUtil;
import com.alachisoft.ncache.common.monitoring.MetricsTransporter;
import com.alachisoft.ncache.runtime.CacheItemPriority;
import com.alachisoft.ncache.runtime.caching.*;
import com.alachisoft.ncache.runtime.caching.messaging.TopicPriority;
import com.alachisoft.ncache.runtime.dependencies.CacheDependency;
import com.alachisoft.ncache.runtime.events.DataTypeEventDataFilter;
import com.alachisoft.ncache.runtime.events.EventDataFilter;
import com.alachisoft.ncache.runtime.events.EventType;
import com.alachisoft.ncache.runtime.events.ListenerType;
import com.alachisoft.ncache.runtime.exceptions.*;
import com.alachisoft.ncache.runtime.exceptions.SecurityException;
import com.alachisoft.ncache.runtime.exceptions.runtime.OperationNotSupportedRuntimeException;
import com.alachisoft.ncache.runtime.util.NCDateTime;
import com.alachisoft.ncache.runtime.util.TimeSpan;
import com.alachisoft.ncache.serialization.core.io.ICompactSerializable;
import com.alachisoft.ncache.serialization.standard.CompactBinaryFormatter;
import tangible.RefObject;

import java.io.IOException;
import java.net.UnknownHostException;
import java.text.ParseException;
import java.util.*;
//C# TO JAVA CONVERTER NOTE: There is no Java equivalent to C# namespace aliases:
//using Messaging = Alachisoft.NCache.Caching.Messaging;

public final class InprocCache extends CacheImplBase
{

    /**  Underlying implementation of NCache.
     */
    public  Alachisoft.NCache.Caching.Cache _nCache;

    public CacheConfig _config;

    /**  Reference count of the cache.
     */
    public int _refCount;

    /**
     */
    private CompactCacheEntry _entry;

    /** Serialization context (actually name of the cache.)used for Compact Framework
     */
    private String _serializationContext;

    /**  Contains callback ids and associated callbacks
     */
    private ResourcePool _callbackIDsMap;

    /**  Initial values for CustomRemovedCallback and CustomUpdateCallback ids.
     */
    private short _rcbInitialVal = 0;
    private short _ucbInitialVal = 1000;
    private short _aiacbInitialVal = 2000;
    private short _aiucbInitialVal = 3000;
    private short _aircbInitialVal = 4000;
    private short _acccbInitialVal = 5000;

    private long _compressionThresholdSize;
    private boolean _compressionEnabled;

    private String _userId;
    //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
//ORIGINAL LINE: private byte[] _password = null;
    private byte[] _password = null;

    private CacheImpl _parent;

    ///#region    /                 --- Fields & Events ---           /

    /**
     Used in the  parameter in an Insert method call to
     indicate the item should never expire. This field is read-only.

     When used, this field sets the  parameter equal
     to , which is a constant representing the largest possible
      value, 12/31/9999 11:59:59 PM.
     The following example demonstrates how to use the  field to disable
     absolute expirations when inserting an item in the .
     

     NCache.Cache.Insert("DSN", connectionString, null, Cache.NoAbsoluteExpiration, TimeSpan.FromSeconds(10));

     
     
     */
    public static final java.util.Date NoAbsoluteExpiration = CacheImpl.NoAbsoluteExpiration;

    /**
     Used as the  parameter in an Insert method call
     to disable sliding expirations. This field is read-only.

     When used, this field sets the  parameter equal to the 
     field, which has a constant value of zero. The cached item then expires
     in accordance with the  parameter.
     The following example demonstrates how to use the Insert method to add an item to the
     @see cref="Cache"/> object using the  field.
     

     NCache.Cache.Insert("DSN", connectionString, null, DateTime.Now.AddMinutes(2), Cache.NoSlidingExpiration);

     
     
     */
    public static final TimeSpan NoSlidingExpiration = TimeSpan.Zero;


    ///#endregion


    private com.alachisoft.ncache.serialization.util.TypeInfoMap _typeMap;

    private String _monitoringSessionId;
    private String _cacheConfigId;


    @Override
    public String getMonitoringSessionId()
    {
        return null;
    }

    @Override
    public String getCacheConfigId()
    {
        return null;
    }

    @Override
    boolean isInproc() {
        return true;
    }

    @Override
    protected com.alachisoft.ncache.serialization.util.TypeInfoMap getTypeMap()
    {
        return _typeMap;
    }
    @Override
    protected void setTypeMap(com.alachisoft.ncache.serialization.util.TypeInfoMap value)
    {
        _typeMap = value;
    }

    @Override
    public long getCompressionThreshold()
    {
        return _compressionThresholdSize;
    }
    @Override
    protected void setCompressionThreshold(long value)
    {
        _compressionThresholdSize = value;
    }

    @Override
    public boolean getCompressionEnabled() {
        return false;
    }

    @Override
    protected void setCompressionEnabled(boolean value) {

    }

    @Override
    protected void registerCacheClientConnectivityEvent() throws CacheException {

    }

    @Override
    protected void unregisterCacheClientConnectivityEvent() throws CacheException {

    }

    @Override
    void registerCacheStoppedEvent() throws CacheException {

    }

    @Override
    void unregisterCacheStoppedEvent() throws CacheException {

    }

    @Override
    void registerClearEvent() throws CacheException {

    }

    @Override
    void unregisterClearEvent() throws CacheException {

    }


    @Override
    protected boolean getSerializationEnabled()
    {
        return false;
    }

    /**
     Initializes a new instance of the Cache class.

     @param objectCache
     @param config
     */
    public InprocCache(Cache objectCache, CacheConfig config, CacheImpl parent, String userId, String password) throws OperationFailedException {
        super();
        _nCache = objectCache;

        this.setTypeMap(_nCache.GetTypeInfoMap());
        this.setCompressionThreshold(_nCache.getCompressThresholdSize());
        this.setCompressionEnabled(false); //we do not require compression in inproc Cache

        _config = config;
        _parent = parent;
        _parent.setSerializationFormat(_nCache.getSerializationFormat());

        if (_nCache != null)
        {
            _nCache.OnClientConnected(getClientID(), _config.getCacheId());
            _serializationContext = _nCache.getName(); //Sets the serialization context.
        }

        AddRef();
        _userId = userId;
        if (password != null)
        {
            _password = Alachisoft.NCache.Common.EncryptionUtil.Encrypt(password);
        }


    }

    /**
     Finalizer for this object.
     */
    protected void finalize() throws Throwable
    {
        dispose(false);
    }

    public void AddRef()
    {
        synchronized (this)
        {
            _refCount++;
        }
    }

    @Override
    public boolean getEncryptionEnabled()
    {
        return false;
    }
    @Override
    public void setEncryptionEnabled(boolean value)
    {

    }

    @Override
    public ILogger getNCacheLog() {
        return null;
    }

    @Override
    protected void registerCustomEventListener(CustomListener listener) throws GeneralFailureException, OperationFailedException, AggregateException, SecurityException, ConfigurationException, ConnectionException, Exception {

    }

    @Override
    protected void registerCacheEventlistener(CacheListener listener, EnumSet registerAgainst) throws GeneralFailureException, OperationFailedException, AggregateException, SecurityException, ConfigurationException, ConnectionException, StreamNotFoundException, StreamException, StreamAlreadyLockedException, LicensingException, OperationNotSupportedException, CommandException {

    }

    @Override
    protected void registerCacheStatusEventlistener(CacheStatusEventListener listener, EnumSet registerAgainst) throws GeneralFailureException, OperationFailedException, AggregateException, SecurityException, ConfigurationException, ConnectionException, StreamNotFoundException, StreamException, StreamAlreadyLockedException, LicensingException, OperationNotSupportedException, CommandException {

    }

    @Override
    protected void unregisterCacheEventlistener(CacheListener listener, EnumSet unregisterAgainst) throws GeneralFailureException, OperationFailedException, AggregateException, SecurityException, ConfigurationException, ConnectionException, StreamNotFoundException, StreamException, StreamAlreadyLockedException, LicensingException, OperationNotSupportedException, CommandException {

    }

    @Override
    protected void unregisterCacheStatusEventlistener(CacheStatusEventListener listener, EnumSet unregisterAgainst) throws GeneralFailureException, OperationFailedException, AggregateException, SecurityException, ConfigurationException, ConnectionException, StreamNotFoundException, StreamException, StreamAlreadyLockedException, LicensingException, OperationNotSupportedException, CommandException {

    }

    @Override
    protected void unregisterCustomEventListener(CustomListener listener) throws GeneralFailureException, OperationFailedException, AggregateException, SecurityException, ConfigurationException, ConnectionException, Exception {

    }

    ///#region    /                 --- IDisposable ---           /

    /**
     Performs application-defined tasks associated with freeing, releasing, or
     resetting unmanaged resources.

     @param disposing
     The behavior of this method depends upon the cache's sharing mode (inproc/outproc)
     specified in the configuration.
     

If the application uses the cache in inproc mode, calling Dispose closes the cache and releases the resources used by it. If in a cluster the calling node leaves the cluster as well.

If the application uses the cache in outproc mode, calling Dispose releases the reference to the cache object. The cache itself remains operational and cluster remains intact.

*/ private void DisposeInternal(boolean disposing) { synchronized (this) { _refCount--; if (_refCount > 0) { return; } else if (_refCount < 0) { _refCount = 0; } // remove from the cache table. synchronized (CacheManager.getCaches()) { if (_config != null) { CacheManager.getCaches().removeCache(_config.getCacheId()); } } if (_config != null && _config.getUseInProc()) { if (_nCache != null) { _nCache.dispose(); } } _nCache = null; } } /** Decerements the reference count of the cache and performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. The behavior of this method depends upon the cache's sharing mode (inproc/outproc) specified in the configuration.

If the application uses the cache in inproc mode, calling Dispose closes the cache and releases the resources used by it. If in a cluster the calling node leaves the cluster as well.

If the application uses the cache in outproc mode, calling Dispose releases the reference to the cache object. The cache itself remains operational and cluster remains intact.

*/ @Override public void dispose(boolean disposing) { DisposeInternal(true); } @Override public Object getItem(String key) throws Exception { return null; } @Override protected Vector getCallbackQueue() { return null; } @Override public void setItem(String key, Object value) { } ///#endregion /** Acquire a lock on an item in cache. @param key key of cached item to be locked. @param lockTimeout TimeSpan after which the lock is automatically released. @param lockHandle An instance of that will be filled in with the lock information if lock is acquired successfully. @return Whether or not lock was acquired successfully. Following example demonstrates how to lock a cached item. ... LockHandle lockHandle = new LockHandle(); bool locked = theCache.lock("cachedItemKey", new TimeSpan(0,0,10), out lockHandle); ... */ @Override public boolean lock(String key, TimeSpan lockTimeout, LockHandle lockHandle) throws CacheException { Object lockId = null; java.util.Date lockDate = new java.util.Date(); RefObject lockHandleRef=new RefObject(lockHandle); if (_nCache != null) { tangible.RefObject tempRef_lockId = new tangible.RefObject(lockId); tangible.RefObject tempRef_lockDate = new tangible.RefObject(lockDate); boolean result = _nCache.Lock(key, lockTimeout, tempRef_lockId, tempRef_lockDate, new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation)); lockId = tempRef_lockId.argvalue; lockDate = tempRef_lockDate.argvalue; lockHandleRef.argvalue = new LockHandle(lockId == null ? null : (String)((lockId instanceof String) ? lockId : null), lockDate); return result; } return false; } @Override public boolean isLocked(String key, LockHandle lockHandle1) throws CacheException { tangible.RefObject lockHandle=new tangible.RefObject(lockHandle1); if (_nCache != null) { Object lockId = null; java.util.Date lockDate = new java.util.Date(0); if (lockHandle.argvalue == null) { lockHandle.argvalue = new LockHandle(); } tangible.RefObject tempRef_lockId = new tangible.RefObject(lockId); tangible.RefObject tempRef_lockDate = new tangible.RefObject(lockDate); boolean result = _nCache.IsLocked(key, tempRef_lockId, tempRef_lockDate, new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation)); lockId = tempRef_lockId.argvalue; lockDate = tempRef_lockDate.argvalue; lockHandle.argvalue.setLockId( lockId == null ? "" : (String)((lockId instanceof String) ? lockId : null)); lockHandle.argvalue.setLockDate(lockDate); return result; } return false; } @Override public void closeStream(String key, String lockHandle) throws Exception { } @Override public int readFromStream(RefObject buffer, String key, String lockHandle, int offset, int streamOffset, int length) throws Exception { return 0; } @Override public void writeToStream(String key, String lockHandle, byte[] buffer, int srcOffset, int dstOffset, int length) throws Exception { } @Override public long getStreamLength(String key, String lockHandle) throws Exception { return 0; } @Override public HashMap getEncryptionInfo() { return null; } /** Forcefully unlocks a locked cached item. @param key key of a cached item to be unlocked Following example demonstrates how to unlock a cached item. ... theCache.Unlock("cachedItemKey"); ... */ @Override public void unlock(String key) throws CacheException { if (_nCache != null) { _nCache.Unlock(key, null, true, new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation)); } } /** Unlocks a locked cached item if the correct lock-id is specified. @param key key of a cached item to be unlocked @param lockHandle An instance of that was generated when lock was acquired. Following example demonstrates how to unlock a cached item. ... theCache.Unlock("cachedItemKey", lockHandle); ... */ @Override public void unlock(String key, String lockId) throws CacheException { if (_nCache != null) { boolean isPreemtive = false; if (lockId == null) { isPreemtive = true; } _nCache.Unlock(key, lockId, isPreemtive, new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation)); } } ///#region / --- Count --- / /** Gets the number of items stored in the cache. This property can be useful when monitoring your application's performance or when using ASP.NET tracing functionality.

Note: In a partitioned cluster this operation is an expensive one as it might result in network calls. It is therefore advised to use this property only when required.

Note: If exceptions are enabled through the setting, this property throws exception in case of failure.

The number of items stored in the cache. */ @Override public long getCount() throws CacheException { if (_nCache != null) { return _nCache.getCount(); } return 0; } @Override public void makeTargetCacheActivePassive(boolean makeActive) throws GeneralFailureException, SecurityException, OperationFailedException, AggregateException, ConnectionException, Exception { } /** Gets the name of the cache. */ @Override public String getName() { if (_nCache != null) { return _nCache.getName(); } return null; } @Override protected String getBridgeTargetCacheUniqueID() { return null; } @Override protected void setBridgeTargetCacheUniqueID(String value) { } ///#endregion ///#region / --- Clear --- / /** Removes all elements from the . In most of the cases this method's implementation is close to O(1).

Note: If exceptions are enabled through the setting, this property throws exception in case of failure.

The following example demonstrates how to check for containment of an item in the . NCache.Cache.Clear(); Or simply in a class deriving from or . Cache.Clear(); */ @Override public void clear(BitSet flagMap, short onDsClearedCallback, String providerName) throws OperationFailedException { if (_nCache == null) { return; } CallbackEntry notification = null; if (onDsClearedCallback != -1) notification = new CallbackEntry(getClientID(), (short)-1, (short)-1, (short)-1, (short)-1, onDsClearedCallback, EventDataFilter.None, EventDataFilter.DataWithMetadata); OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); operationContext.Add(OperationContextFieldName.WriteThruProviderName, providerName); _nCache.Clear(flagMap, notification, operationContext); } @Override public void clearAsync(BitSet flagMap, short onDsClearedCallback, boolean isAsync, String providerName) throws OperationFailedException, GeneralFailureException, AggregateException, SecurityException, ConnectionException, Exception { } @Override public void clearAsync(BitSet flagMap, short onAsyncCacheClearCallback, short onDsClearedCallback, boolean isAsync, String providerName) throws OperationFailedException, GeneralFailureException, AggregateException, SecurityException, ConnectionException, Exception { } /** Removes all elements from the asynchronously. ///#endregion ///#region / --- Contains --- / /** Determines whether the cache contains a specific key. @param key The key to locate in the . @return true if the contains an element with the specified key; otherwise, false. In most of the cases this method's implementation is close to O(1).

Note: In a partitioned cluster this operation is an expensive one as it might result in network calls. It is therefore advised to use this property only when required.

Note: If exceptions are enabled through the setting, this property throws exception in case of failure.

@exception ArgumentNullException contains a null reference (Nothing in Visual Basic). @exception ArgumentException is not serializable. The following example demonstrates how to check for containment of an item in the . if(NCache.Cache.Contains("MyTextBox.Value")) { Response.Write("Item found!"); } Or simply in a class deriving from or . if(Cache.Contains("MyTextBox.Value")) { Response.Write("Item found!"); } */ @Override public boolean contains(String key) throws OperationFailedException { if (key == null) { throw new IllegalArgumentException("key"); } return _nCache.Contains(key, new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation)); } @Override public java.util.Map containsBulk(String[] keys) throws CacheException { if (keys == null) { throw new IllegalArgumentException("keys"); } HashMap keysFound = _nCache.Contains(keys, new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation)); return HashtableUtil.extractKeyStatus(keysFound, keys); } ///#endregion /** Broadcasts a custom application defined event. @param notifId Application specific notification code/id @param data Application specific data In most of the cases this method's implementation is close to O(1).

Note: If exceptions are enabled through the setting, this property throws exception in case of failure.

Note: Custom event notifications can not be disabled through configuration.

The following example demonstrates how to raise a custom application defined event. NCache.Cache.RaiseCustomEvent(MyNotificationCodes.ConsumeItem, new ItemData(DateTime.Now)); Or simply in a class deriving from or . Cache.RaiseCustomEvent(MyNotificationCodes.ConsumeItem, new ItemData(DateTime.Now)); */ @Override public void raiseCustomEvent(Object notifId, Object data) throws CacheException { _nCache.SendNotification(notifId, data); } @Override public void registerKeyNotificationListener(String key, short updateCallbackid, short removeCallbackid, boolean notifyOnItemExpiration) throws CacheException { } @Override public boolean subscribe(String topicName, String subscriptionName, SubscriptionType subscriptionType, long creationTime, long expiration, SubscriptionPolicyType subscriptionPolicyType) throws CacheException { return false; } @Override public long getMessageCount(String topicName) { return 0; } public String openStream(String key, StreamMode mode, String group, Date absExpiration, TimeSpan slidingExpiration, CacheDependency dependency, CacheItemPriority priority) throws GeneralFailureException, OperationFailedException, AggregateException, SecurityException, ConfigurationException, StreamAlreadyLockedException, StreamCloseException, StreamInvalidLockException, StreamException, StreamNotFoundException, ConnectionException, Exception { return null; } @Override public void registerKeyNotificationListener(String key, short callbackRef, short callbackRef1, EventDataFilter dataFilter, boolean notifyOnItemExpiration) throws CacheException { } @Override public void registerKeyNotificationListener(String[] keys, short callbackRef, short callbackRef1, EventDataFilter dataFilter, boolean notifyOnItemExpiration) throws CacheException { } /** @param key @param value */ private void ValidateKeyValue(String key, Object value) { java.lang.Class type = ICompactSerializable.class; if (key == null) { throw new IllegalArgumentException("key"); } if (value == null) { throw new IllegalArgumentException("value"); } } /** Create a CompactEntry object @param key @param value @param dependency @param absoluteExpiration @param slidingExpiration @param priority @param onRemoveCallback @param isResyncExpiredItems @param group @param subGroup @return */ //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: private object MakeCompactEntry(string key, object value, Alachisoft.NCache.Caching.AutoExpiration.ExpirationHint dependency, CacheSyncDependency syncDependency, DateTime absoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority, short onRemoveCallback, short onUpdateCallback, short onAsyncOperationCompleteCallback, short DsCallback, bool isResyncExpiredItems, string group, string subGroup, Hashtable queryInfo, BitSet Flag, object lockId, ulong version, LockAccessType accessType, string providerName, string resyncProviderName, EventDataFilter updateCallbackFilter, EventDataFilter removeCallabackFilter, string clientId) private Object MakeCompactEntry(String key, Object value, Alachisoft.NCache.Caching.AutoExpiration.ExpirationHint dependency, CacheSyncDependency syncDependency, java.util.Date absoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority, short onRemoveCallback, short onUpdateCallback, short onAsyncOperationCompleteCallback, short DsCallback, boolean isResyncExpiredItems, String group, HashMap queryInfo, BitSet Flag, Object lockId, long version, Alachisoft.NCache.Common.Locking.LockAccessType accessType, String providerName, String resyncProviderName, EventDataFilter updateCallbackFilter, EventDataFilter removeCallabackFilter, String clientId) throws ParseException { Notifications notification = null; //we create a user binary object. if (this.getSerializationEnabled()) { value = Alachisoft.NCache.Common.Caching.UserBinaryObject .createUserBinaryObject((byte[])value); } ////muds: ////we can not specify both tags and groups for the same cache item. //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: byte expType = CacheHelper.EvaluateExpirationParameters(absoluteExpiration, slidingExpiration); byte expType = CacheHelper.EvaluateExpirationParameters(absoluteExpiration, slidingExpiration); int options = 0; if (expType < 2) { options = expType; } if (isResyncExpiredItems) { int isResync = isResyncExpiredItems?1:0; isResync = isResync << 1; options = options | isResync; } int prio = priority.value(); prio += 2; prio = (prio << 2); options = options | prio; long expiration = expType == 1 ? absoluteExpiration.getTime() : slidingExpiration.getTotalTicks(); ExpirationHint hint = (dependency == null) ? null : dependency; Alachisoft.NCache.Caching.CacheSynchronization.CacheSyncDependency syncDep = null; if (syncDependency != null) { try { SyncCache syncCache = new SyncCache(syncDependency.getCacheId(), syncDependency.getServer(), syncDependency.getPort(), true); syncDep =new Alachisoft.NCache.Caching.CacheSynchronization.CacheSyncDependency( syncDependency.getCacheId(), syncDependency.getKey(), syncCache); } catch (RuntimeException e) { throw e; } } Object entry = new CompactCacheEntry(key, value, hint, syncDep, expiration, (byte) options, null, group, queryInfo, Flag, lockId, version, accessType, providerName, resyncProviderName); return entry; } ///#region / --- Add --- / @Override public boolean setAttributes(String key, CacheItemAttributes attributes) throws CacheException { if (key == null) { throw new IllegalArgumentException("key"); } if (attributes == null) { throw new IllegalArgumentException("attributes"); } ExpirationHint hint = Alachisoft.NCache.Caching.AutoExpiration.DependencyHelper.GetExpirationHint(attributes.getDependency(), attributes.getAbsoluteExpiration(), CacheImpl.NoSlidingExpiration); return _nCache.AddExpirationHint(key, hint, new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation)); } @Override public boolean getOrCreate(String topicName, tangible.RefObject priority, TopicOperationType type) throws CacheException { return false; } @Override public void acknowledgeMessageReceipt(Map> topicWiseMessageIds) throws Exception { } /** Add dependency to the cache item. @param key key used to reference the required object @param dependency CacheDependency to be added @param isResyncRequired Boolean value indicating whether Resync is required or not @return True if operations succeeded else false */ @Override public boolean addDependency(String key, CacheDependency dependency, boolean isResyncRequired) throws CacheException { ExpirationHint hint = Alachisoft.NCache.Caching.AutoExpiration.DependencyHelper.GetExpirationHint(dependency); if (isResyncRequired && hint != null) { hint.SetBit(ExpirationHint.NEEDS_RESYNC); } return _nCache.AddExpirationHint(key, hint, new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation)); } @Override public boolean addDependency(String key, CacheSyncDependency syncDependency) throws Exception { Alachisoft.NCache.Caching.CacheSynchronization.CacheSyncDependency syncDep = null; if (syncDependency != null) { try { SyncCache syncCache = new SyncCache(syncDependency.getCacheId(), syncDependency.getServer(), syncDependency.getPort(), true); syncDep = new Alachisoft.NCache.Caching.CacheSynchronization.CacheSyncDependency( syncDependency.getCacheId(), syncDependency.getKey(), syncCache); } catch (RuntimeException e) { return false; } return _nCache.AddSyncDependency(key, syncDep, new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation)); } return false; } /** Function that choose the appropriate function of NCache's Cache, that need to be called according to the data provided to it. */ @Override public CacheItemVersion add(String key, Object value, CacheDependency dependency, CacheSyncDependency syncDependency, java.util.Date absoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority, short onRemoveCallback, short onUpdateCallback, short onDsItemAddedCallback, boolean isResyncExpiredItems, String group, java.util.HashMap queryInfo, BitSet flagMap, String providerName, String resyncProviderName, EventDataFilter itemUpdateDataFilter, EventDataFilter itemRemovedDataFilter, long size, boolean encryptionEnabled , String clientId, String typeName) throws OperationFailedException { ExpirationHint hint = Alachisoft.NCache.Caching.AutoExpiration.DependencyHelper.GetExpirationHint( dependency); java.util.Hashtable queryInfoDic = (java.util.Hashtable)((queryInfo.get("query-info") instanceof java.util.Hashtable) ? queryInfo.get("query-info") : null); if (queryInfoDic != null) { Iterator queryInfoEnum = queryInfoDic.entrySet().iterator(); while (queryInfoEnum.hasNext()) { Object pair=queryInfoEnum.next(); java.util.ArrayList valuesEnum = (java.util.ArrayList)pair; for (int i = 0; i < valuesEnum.size(); i++) { if (valuesEnum.get(i) instanceof java.util.Date) { valuesEnum.set(i, ((java.util.Date)valuesEnum.get(i)).getTime()); } } } } Object entry = null; try { entry = MakeCompactEntry(key, value, hint, syncDependency, absoluteExpiration, slidingExpiration, priority, (short)onRemoveCallback, (short)onUpdateCallback, (short)-1,onDsItemAddedCallback, isResyncExpiredItems, group, queryInfo, flagMap, null, 0, Alachisoft.NCache.Common.Locking.LockAccessType .IGNORE_LOCK, providerName, resyncProviderName, itemUpdateDataFilter, itemRemovedDataFilter, clientId); } catch (ParseException e) { throw new OperationFailedException(e); } //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: UInt64 itemVersion = (ulong)(DateTime.UtcNow - Common.Util.Time.ReferenceTime).TotalMilliseconds; long itemVersion = (NCDateTime.getUTCNow().getTime() - Time.ReferenceTime.getTime()); OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); operationContext.Add(OperationContextFieldName.RaiseCQNotification, true); operationContext.Add(OperationContextFieldName.ValueDataSize, size); operationContext.Add(OperationContextFieldName.ItemVersion, itemVersion); _nCache.AddEntry(entry, operationContext); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: itemVersion = (ulong)operationContext.GetValueByField(OperationContextFieldName.ItemVersion); CacheItemVersion cacheitemVersion =new CacheItemVersion((long)operationContext.GetValueByField(OperationContextFieldName.ItemVersion)); return cacheitemVersion; } /** Add array of to the cache. @param keys The cache keys used to reference the items. @param items The items that are to be stored @param group The data group of the item @param subGroup Sub group of the group @return keys that are added or that already exists in the cache and their status. If CacheItem contains invalid values the related exception is thrown. See for invalid property values and related exceptions The following example demonstrates how to add items to the cache with an absolute expiration 2 minutes from now, a priority of high, and that notifies the application when the item is removed from the cache. First create a CacheItems. string keys = {"ORD_23", "ORD_67"}; CacheItem items = new CacheItem[2] items[0] = new CacheItem(new Order()); items[0].AbsoluteExpiration = DateTime.Now.AddMinutes(2); items[0].Priority = CacheItemPriority.High; items[0].ItemRemoveCallback = onRemove; items[1] = new CacheItem(new Order()); items[1].AbsoluteExpiration = DateTime.Now.AddMinutes(2); items[1].Priority = CacheItemPriority.Low; items[1].ItemRemoveCallback = onRemove; Then add CacheItem to the cache NCache.Cache.Add(keys, items, "Customer", "Orders"); Or simply in a class deriving from or . Cache.Add(keys, items, "Customer", "Orders"); */ //ORIGINAL LINE: public override IDictionary Add(string[] keys, CacheItem[] items, short onDataSourceItemsAdded, string providerName, long[] sizes, bool encryptionEnabled, string clientId, short itemUpdatedCallback, short itemRemovedCallback, EventDataFilter updateCallbackFilter, EventDataFilter removeCallabackFilter, bool returnVersions, out IDictionary itemVersions, CallbackType callbackType = CallbackType.PushBasedNotification) @Override public java.util.HashMap add(String[] keys, CacheItem[] items, short onDataSourceItemsAdded, String providerName, long[] sizes, boolean encryptionEnabled, String clientId, short itemUpdatedCallback, short itemRemovedCallback, EventDataFilter updateCallbackFilter, EventDataFilter removeCallabackFilter, boolean returnVersions, java.util.Map itemVersions, ListenerType listenerType) throws OperationFailedException { if (_nCache == null) { return null; } ExpirationHint hint = null; Object[] entries = new Object[items.length]; for (int i = 0; i < items.length; i++) { String key = keys[i]; CacheItem item = items[i]; hint = DependencyHelper.GetExpirationHint( item.getDependency()); java.util.Hashtable queryInfoDic = (java.util.Hashtable)((CacheItemWrapperInternal.getQueryInfo(item).get("query-info") instanceof java.util.Hashtable) ? CacheItemWrapperInternal.getQueryInfo(item).get("query-info") : null); if (queryInfoDic != null) { Iterator queryInfoEnum = queryInfoDic.entrySet().iterator(); while (queryInfoEnum.hasNext()) { java.util.ArrayList valuesEnum = (java.util.ArrayList)queryInfoEnum.next(); for (int j = 0; j < valuesEnum.size(); j++) { if (valuesEnum.get(j) instanceof java.util.Date) { valuesEnum.set(j, ((java.util.Date)valuesEnum.get(j)).getTime()); } } } } try { boolean ResyncOnExpire= false; if(item.getResyncOptions() != null) ResyncOnExpire = item.getResyncOptions().getResyncOnExpiration(); String ResyncProvider= null; if(item.getResyncOptions() != null) ResyncProvider = item.getResyncOptions().getProviderName(); entries[i] = MakeCompactEntry(key, item.getValue(null), hint, item.getSyncDependency(), ConversionUtil.getAbsoluteExpiration(item.getExpiration()), ConversionUtil.getSlidingExpiration(item.getExpiration()), item.getCacheItemPriority(), itemRemovedCallback, itemUpdatedCallback, (short) -1, onDataSourceItemsAdded, ResyncOnExpire, item.getGroup(), CacheItemWrapperInternal.getQueryInfo(item), CacheItemWrapperInternal.getFlagValue(item), null, 0, Alachisoft.NCache.Common.Locking.LockAccessType .IGNORE_LOCK, providerName, ResyncProvider, CacheItemWrapperInternal.getItemUpdatedDataFilter(item), CacheItemWrapperInternal.getItemRemovedDataFilter(item), clientId); } catch (ParseException e) { throw new OperationFailedException(e); } } OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); if (providerName != null) { operationContext.Add(OperationContextFieldName.WriteThruProviderName, providerName); } operationContext.Add(OperationContextFieldName.WriteThru, CacheItemWrapperInternal.getFlagValue(items[0]).IsBitSet((byte) BitSetConstants.WriteThru)); operationContext.Add(OperationContextFieldName.WriteBehind, CacheItemWrapperInternal.getFlagValue(items[0]).IsBitSet((byte) BitSetConstants.WriteBehind)); operationContext.Add(OperationContextFieldName.RaiseCQNotification, true); operationContext.Add(OperationContextFieldName.ValueDataSize, sizes); try { return _nCache.AddEntries(entries, itemVersions, operationContext); } catch (Exception e) { throw new OperationFailedException(e); } } @Override public Object addAsync(String key, Object value, CacheDependency dependency, CacheSyncDependency syncDependency, Date absoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority, short onRemoveCallback, short onUpdateCallback, short onAsyncItemAddCallback, short dsItemAddedCallback, boolean isResyncExpiredItems, String group, HashMap queryInfo, BitSet flagMap, String providerName, String resyncProviderName, EventDataFilter itemUpdateDataFilter, EventDataFilter itemRemovedDataFilter, long size, String clientId, short updateCallbackId, short removeCallbackId, short dsItemAddedCallbackId) throws Exception { return null; } ///#region / --- Get --- / /** Retrieves the specified item from the Cache object. If the object is read thru the data source, put is against the given group and sub group. @param key The identifier for the cache item to retrieve. @param group Group of the object. @param subGroup Sub group of the group. @return The retrieved cache item, or a null reference (Nothing in Visual Basic) if the key is not found. @exception ArgumentNullException contains a null reference (Nothing in Visual Basic). @exception ArgumentException is not serializable. @exception ArgumentNullException contains a null reference (Nothing in Visual Basic).

Note: If exceptions are enabled through the setting, this property throws exception in case of failure.

Note: The group and subGroup parameters are used only if the object is read thru the data source. Otherwise the object will be returned from the cache whether it belongs to the given group and sub group or not.

The following example demonstrates how to retrieve the value cached for an ASP.NET text box server control. NCache.Cache.Get("MyTextBox.Value", "Customer", null); Or simply in a class deriving from or . Cache.Get("MyTextBox.Value", "Customer", null); */ @Override public CompressedValueEntry get(String key, BitSet flagMap, String group, CacheItemVersion version, LockHandle lockHandle, TimeSpan lockTimeout, Alachisoft.NCache.Common.Locking.LockAccessType accessType, ReadThruOptions readOption) throws OperationFailedException, GeneralFailureException, AggregateException, SecurityException, ConfigurationException, CommandException, StreamException, StreamAlreadyLockedException, LicensingException, OperationNotSupportedException, StreamNotFoundException { if (_nCache == null) { return null; } if (_nCache != null) { OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); operationContext.Add(OperationContextFieldName.ReadThru, readOption); tangible.RefObject tempRef_itemVersion = new tangible.RefObject(version.getVersion()); tangible.RefObject tempRef_lockId = new tangible.RefObject(lockHandle.getLockId()); tangible.RefObject tempRef_lockDate = new tangible.RefObject(lockHandle.getLockDate()); CompressedValueEntry cmpEntry = _nCache.GetGroup(key, flagMap, group,null, tempRef_itemVersion, tempRef_lockId, tempRef_lockDate, lockTimeout, accessType,readOption, readOption.getProviderName(),operationContext); version.setVersion( tempRef_itemVersion.argvalue); lockHandle.setLockId((String)tempRef_lockId.argvalue); lockHandle.setLockDate( tempRef_lockDate.getValue()); if (cmpEntry != null && cmpEntry.getValue() != null) { //muds: //in case of inproc local cache we will get the user object directly... //therefore, we need to confirm if the value is user binary object or not... if (cmpEntry.getValue() instanceof Alachisoft.NCache.Common.Caching.UserBinaryObject ) { if (cmpEntry.getValue() instanceof Alachisoft.NCache.Common.Caching.UserBinaryObject ) { Alachisoft.NCache.Common.Caching.UserBinaryObject ubObject = (Alachisoft.NCache.Common.Caching.UserBinaryObject )((cmpEntry.getValue() instanceof Alachisoft.NCache.Common.Caching.UserBinaryObject ) ? cmpEntry.getValue() : null); Object deserialized = ubObject.getFullObject(); if (deserialized instanceof byte[]) { try { deserialized = CompactBinaryFormatter.fromByteBuffer((byte[])deserialized, this._serializationContext); } catch (IOException | ClassNotFoundException e) { //ignore this exception like in dotnet } } cmpEntry.setValue(deserialized); } } } if (lockHandle == null) { lockHandle= new LockHandle(); } cmpEntry.setValue(CacheHelper.getObjectOrInitializedCollection(key, cmpEntry.getType(), cmpEntry.getValue(), _parent,null)); return cmpEntry; } return null; } @Override public HashMap getByTag(Tag[] tags, TagComparisonType comaprisonType) throws OperationFailedException, GeneralFailureException, AggregateException, SecurityException, IllegalArgumentException, ConnectionException, Exception { return null; } private ReadThruOptions ConvertToReadThruOperation(ReadThruOptions readoption) { if (readoption == null) { return new ReadThruOptions(ReadMode.None); } return new ReadThruOptions((ReadMode)readoption.getReadMode(), readoption.getProviderName()); } @Override public void removeByTag(Tag[] tags, TagComparisonType comarisonType) throws OperationNotSupportedException, OperationFailedException { if (_nCache == null) { return; } OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); operationContext.Add(OperationContextFieldName.RaiseCQNotification, true); _nCache.RemoveByTag(CacheHelper.getTags(tags), comarisonType, operationContext); } @Override public java.util.Collection getKeysByTag(Tag[] tags, TagComparisonType comparisonType) throws OperationNotSupportedException { throw new OperationNotSupportedException(ErrorCodes.ClientCache.InprocCacheNotSuportedInJavaClient, ErrorMessages.getErrorMessage(ErrorCodes.ClientCache.InprocCacheNotSuportedInJavaClient)); } /** Retrieves the keys of items in a group or sub group. @param group The group whose keys are to be returned. @param subGroup The sub group of the group foe which keys are to be returned. @return The list of keys of a group or a sub group. @exception ArgumentNullException contains a null reference (Nothing in Visual Basic).

If only group is specified, keys for the group and all the sub groups of the group are returned. If both the group and sub group are specified. Only the keys related to the sub group are returned.

Note: If exceptions are enabled through the setting, this property throws exception in case of failure.

The following example demonstrates how to retrieve the value cached for an ASP.NET text box server control. ArrayList list = NCache.Cache.Get("Customer", "Orders"); Or simply in a class deriving from or . ArrayList list = Cache.Get("Customer", "Orders"); */ @Override public java.util.ArrayList getGroupKeys(String group) throws OperationNotSupportedException { throw new OperationNotSupportedException(ErrorCodes.ClientCache.InprocCacheNotSuportedInJavaClient, ErrorMessages.getErrorMessage(ErrorCodes.ClientCache.InprocCacheNotSuportedInJavaClient)); } @Override public HashMap getGroupData(String group) throws OperationFailedException, GeneralFailureException, AggregateException, SecurityException, ConnectionException, Exception { return null; } /** Retrieves the object from the cache for the given keys as key value pairs @param keys The keys against which items are to be fetched. @return The retrieved cache items. @exception ArgumentNullException contains a null reference (Nothing in Visual Basic). @exception ArgumentException is not serializable.

Note: If exceptions are enabled through the setting, this property throws exception in case of failure.

The following example demonstrates how to retrieve the value cached for an ASP.NET text box server control. NCache.Cache.Get(keys); Or simply in a class deriving from or . Cache.Get(keys); */ @Override public java.util.Map get(String[] keys, BitSet flagMap, ReadThruOptions readOptions) throws OperationFailedException { if (_nCache != null) { OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); ReadThruOptions readOption = new ReadThruOptions(readOptions.getReadMode(), readOptions.getProviderName()); operationContext.Add(OperationContextFieldName.ReadThru, readOption); java.util.Map items = (java.util.Map)_nCache.GetBulk(keys, flagMap, readOptions.getProviderName(), operationContext); if (items != null) { java.util.HashMap returnItems = new java.util.HashMap(); HashMap finalReturnItems = returnItems; items.forEach((key, value) -> { CompressedValueEntry cmpEntry = (CompressedValueEntry)((value instanceof CompressedValueEntry) ? value : null); if (cmpEntry != null && cmpEntry.value != null) { if (cmpEntry.value instanceof Alachisoft.NCache.Common.Caching.UserBinaryObject ) { Alachisoft.NCache.Common.Caching.UserBinaryObject ubObject = (Alachisoft.NCache.Common.Caching.UserBinaryObject )((cmpEntry.value instanceof Alachisoft.NCache.Common.Caching.UserBinaryObject ) ? cmpEntry.value : null); cmpEntry.value = ubObject.getFullObject(); } } }); returnItems=finalReturnItems; return CacheHelper.bulkGetObjectOrInitializedCollection(returnItems, _parent); } } return null; } @Override public Object getCacheItem(String key, BitSet flagMap, String group, CacheItemVersion version, LockHandle lockHandle, TimeSpan lockTimeout, Alachisoft.NCache.Common.Locking.LockAccessType accessType, ReadThruOptions readOption) throws OperationFailedException { if (lockHandle== null) { lockHandle = new LockHandle(); } Object lockId = lockHandle.getLockId(); if (version == null) { version = new CacheItemVersion(); } java.util.Date lockDate = new java.util.Date(0); CacheEntry entry = null; try { OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); operationContext.Add(OperationContextFieldName.ReadThru, readOption); operationContext.Add(OperationContextFieldName.GenerateQueryInfo, true); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: ulong ver = version.Version; long ver = version.getVersion(); tangible.RefObject tempRef_lockId = new tangible.RefObject(lockId); tangible.RefObject tempRef_lockDate = new tangible.RefObject(lockDate); tangible.RefObject tempRef_ver = new tangible.RefObject(ver); Object tempVar=_nCache.GetCacheEntry(key, group, null, tempRef_lockId, tempRef_lockDate, lockTimeout, tempRef_ver,accessType, operationContext); lockId = tempRef_lockId.argvalue; lockDate = tempRef_lockDate.argvalue; ver = tempRef_ver.argvalue; entry = (CacheEntry)((tempVar instanceof CacheEntry) ? tempVar : null); if (entry != null) { if (entry.getValue() instanceof Alachisoft.NCache.Common.Caching.UserBinaryObject ) { entry.setValue(((Alachisoft.NCache.Common.Caching.UserBinaryObject )entry.getValue()).getFullObject()); } version.setVersion(entry.getVersion()); if(entry.getPriority() == CacheItemPriority.Default){ entry.setPriority(CacheItemPriority.getValueFromString(_nCache.getConfiguration().getEvictionPolicy().getDefaultPriority())); } } lockHandle.setLockId(lockId == null ? null : (String)((lockId instanceof String) ? lockId : null)); lockHandle.setLockDate(lockDate); return entry; } finally { } } @Override public java.util.Map getCacheItemBulk(String[] keys, BitSet flagMap, ReadThruOptions readOption) { if (_nCache != null) { OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); operationContext.Add(OperationContextFieldName.ReadThru, readOption); java.util.Map items = _nCache.getBulkCache(keys, flagMap, readOption, operationContext); java.util.Hashtable retItems = null; return retItems; } return null; } @Override public void InvalidateReaders(String toString) { } @Override public void setCompressionThresholdSize(long compressionThreshold) { } @Override public void registerHashmapChangedEvent(Connection connection) throws AggregateException, SecurityException, GeneralFailureException, OperationFailedException, ConfigurationException, StreamNotFoundException, StreamException, StreamAlreadyLockedException, LicensingException, OperationNotSupportedException, CommandException { } @Override public void getTypeInfoMap(Connection connection) throws AggregateException, InternalCommandException, GeneralFailureException, OperationFailedException, SecurityException, OperationNotSupportedException, StreamException, ConfigurationException, LicensingException, StreamNotFoundException, StreamAlreadyLockedException, CommandException { } @Override public void getThresholdSize(Connection connection) throws AggregateException, InternalCommandException, GeneralFailureException, OperationFailedException, OperationNotSupportedException, StreamException, SecurityException, LicensingException, ConfigurationException, StreamNotFoundException, StreamAlreadyLockedException, CacheException { } @Override public void getExpirationFromServer(Connection connection) throws AggregateException, InternalCommandException, GeneralFailureException, OperationFailedException, OperationNotSupportedException, StreamException, SecurityException, LicensingException, ConfigurationException, StreamNotFoundException, StreamAlreadyLockedException, CommandException { } @Override public void getSerializationFormat(Connection connection) throws AggregateException, InternalCommandException, GeneralFailureException, OperationFailedException, SecurityException, OperationNotSupportedException, StreamException, ConfigurationException, LicensingException, StreamNotFoundException, StreamAlreadyLockedException, CommandException { } @Override public void getCompactTypesFromServer(Connection connection) throws AggregateException, InternalCommandException, GeneralFailureException, OperationFailedException, SecurityException, OperationNotSupportedException, StreamException, ConfigurationException, LicensingException, StreamNotFoundException, StreamAlreadyLockedException, CommandException { } @Override public void getEncryptionKeyFromServer(Connection connection) throws AggregateException, InternalCommandException, GeneralFailureException, OperationFailedException, OperationNotSupportedException, StreamException, SecurityException, LicensingException, ConfigurationException, StreamNotFoundException, StreamAlreadyLockedException, CommandException { } @Override public void reRegisterGeneralNotification(Connection connection) throws AggregateException, SecurityException, GeneralFailureException, OperationFailedException, ConfigurationException, StreamNotFoundException, StreamException, StreamAlreadyLockedException, LicensingException, OperationNotSupportedException, CommandException { } @Override public void ExecuteModuleOperation(ModuleOperation operation) { } @Override public PartitioningStrategy getPartitioningStrategy() { return null; } @Override public boolean checkSecurityAuthorization(String cacheId, byte[] password, String userId) throws OperationFailedException, SecurityException, AggregateException, GeneralFailureException, CommandException, StreamNotFoundException, OperationNotSupportedException, StreamException, ConfigurationException, LicensingException, StreamAlreadyLockedException { return false; } @Override public Map publishMessage(String topicName, Map keyMessageBulk, boolean notifyDeliveryFailure) throws OperationFailedException, LicensingException, CommandException, StreamAlreadyLockedException, GeneralFailureException, OperationNotSupportedException, SecurityException, StreamException, ConfigurationException, StreamNotFoundException, AggregateException { return null; } @Override public void addCollectionNotificationListener(String collectionName, short addCallbackId, short updateCallbackId, short removeCallbackId, DataTypeEventDataFilter dataFilter, DistributedDataStructure dataType, boolean notifyOnItemExpiration) throws OperationFailedException, LicensingException, CommandException { } @Override public void removeCollectionNotificationListener(String collectionName, short addCallbackId, short updateCallbackId, short removeCallbackId, EventTypeInternal eventType, DistributedDataStructure dataType) throws OperationFailedException, LicensingException, CommandException { } ///#endregion ///#region / --- Insert --- / /** Function that choose the appropriate function of NCache's Cache, that need to be called according to the data provided to it. */ //ORIGINAL LINE: public override CacheItemVersion Insert(string key, object value, CacheDependency dependency, CacheSyncDependency syncDependency, DateTime absoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority, short onRemoveCallback, short onUpdateCallback, short onDsItemUpdateCallback, bool isResyncExpiredItems, string group, string subGroup, Hashtable queryInfo, BitSet flagMap, object lockId, CacheItemVersion version, Alachisoft.NCache.Common.Locking.LockAccessType accessType, string providerName, string resyncProviderName, EventDataFilter updateCallbackFilter, EventDataFilter removeCallabackFilter, long size, bool encryptionEnabled, string clientId, string typeName, CallbackType callbackType = CallbackType.PushBasedNotification) @Override public CacheItemVersion insert(String key, Object value, CacheDependency dependency, CacheSyncDependency syncDependency, java.util.Date absoluteExpiration, TimeSpan slidingExpiration, CacheItemPriority priority, short onRemoveCallback, short onUpdateCallback, short onDsItemUpdateCallback, boolean isResyncExpiredItems, String group, java.util.HashMap queryInfo, BitSet flagMap, String lockId, CacheItemVersion version, Alachisoft.NCache.Common.Locking.LockAccessType accessType, String providerName, String resyncProviderName, EventDataFilter updateCallbackFilter, EventDataFilter removeCallabackFilter, long size, boolean encryptionEnabled, String clientId, String typeName, ListenerType callbackType) throws CacheException { ExpirationHint hint = Alachisoft.NCache.Caching.AutoExpiration.DependencyHelper.GetExpirationHint( dependency); java.util.Hashtable queryInfoDic = (java.util.Hashtable)((queryInfo.get("query-info") instanceof java.util.Hashtable) ? queryInfo.get("query-info") : null); if (queryInfoDic != null) { Iterator queryInfoEnum = queryInfoDic.entrySet().iterator(); while (queryInfoEnum.hasNext()) { java.util.ArrayList valuesEnum = (java.util.ArrayList)queryInfoEnum.next(); for (int i = 0; i < valuesEnum.size(); i++) { if (valuesEnum.get(i) instanceof java.util.Date) { valuesEnum.set(i, ((java.util.Date)valuesEnum.get(i)).getTime()); } } } } Object entry = null; try { entry = MakeCompactEntry(key, value, hint, syncDependency, absoluteExpiration, slidingExpiration, priority, onRemoveCallback, onUpdateCallback, (short) -1, onDsItemUpdateCallback, isResyncExpiredItems, group, queryInfo, flagMap, lockId, version == null ? 0 : version.getVersion(), accessType, providerName, resyncProviderName, updateCallbackFilter, removeCallabackFilter, clientId); } catch (ParseException e) { throw new OperationFailedException(e); } OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); operationContext.Add(OperationContextFieldName.RaiseCQNotification, true); operationContext.Add(OperationContextFieldName.ValueDataSize, size); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: UInt64 itemVersionOperation; long itemVersionOperation; if (version == null) { //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: itemVersionOperation = (ulong)(DateTime.UtcNow - Common.Util.Time.ReferenceTime).TotalMilliseconds; itemVersionOperation = (long)(NCDateTime.getUTCNow().getTime()- Time.ReferenceTime.getTime()); } else { itemVersionOperation = version.getVersion(); } operationContext.Add(OperationContextFieldName.ItemVersion, itemVersionOperation); //C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java: //ORIGINAL LINE: ulong itemVersion = _nCache.InsertEntry(entry, operationContext); long itemVersion = 0; try { itemVersion = _nCache.InsertEntry(entry, operationContext); } catch (Exception e) { throw new OperationFailedException(e); } return new CacheItemVersion(itemVersion); } /** Insert list of to the cache @param keys The cache keys used to reference the items. @param items The items that are to be stored @param group The group with which this object is associated @param subGroup The subGroup of the group @return returns keys that are added or updated successfully and their status. If CacheItem contains invalid values the related exception is thrown. See for invalid property values and related exceptions The following example demonstrates how to assign an item high priority when you insert it into your application's object.

Note: For more information about how to use this method with the delegate, see .

First create CacheItems. string[] keys = {"SQLDSN", "ORADSN"}; CacheItem items[] = new CacheItem[2]; items[0] = new CacheItem(sqlConnectionString); item.AbsoluteExpiration = DateTime.Now.AddMinutes(2); item.SlidingExpiration = TimeSpan.Zero; item.Priority = CacheItemPriority.High; item.ItemRemoveCallback = onRemove; items[1] = new CacheItem(oraConnectionString); item.AbsoluteExpiration = DateTime.Now.AddMinutes(1); item.SlidingExpiration = TimeSpan.Zero; item.Priority = CacheItemPriority.Low; item.ItemRemoveCallback = onRemove; Then insert CacheItems to the cache NCache.Cache.Insert(keys, items, "Connection", null); Or simply in a class deriving from or . Cache.Insert(keys, items, "Connection", null);
*/ //ORIGINAL LINE: public override IDictionary Insert(string[] keys, CacheItem[] items, short onDsItemsUpdatedCallback, string providerName, long[] sizes, bool encryptionEnabled, string clientId, short itemUpdatedCallback, short itemRemovedCallback, EventDataFilter updateCallbackFilter, EventDataFilter removeCallabackFilter, bool returnVersions, out IDictionary itemVersions, CallbackType callbackType = CallbackType.PushBasedNotification) @Override public java.util.HashMap insert(String[] keys, CacheItem[] items, short onDsItemsUpdatedCallback, String providerName, long[] sizes, boolean encryptionEnabled, String clientId, short itemUpdatedCallback, short itemRemovedCallback, EventDataFilter updateCallbackFilter, EventDataFilter removeCallabackFilter, boolean returnVersions, java.util.Map itemVersions, ListenerType callbackType) throws CacheException { if (_nCache == null) { return null; } Object[] entries = new Object[items.length]; ExpirationHint hint = null; for (int i = 0; i < items.length; i++) { String key = keys[i]; CacheItem item = items[i]; hint = Alachisoft.NCache.Caching.AutoExpiration.DependencyHelper.GetExpirationHint(item.getDependency()); if (itemRemovedCallback == -1) { if (CacheItemWrapperInternal.getCacheItemRemovedListener(item) != null) { removeCallabackFilter = CacheItemWrapperInternal.getItemRemovedDataFilter(item); short[] callbackIds = _parent.getEventManager().registerSelectiveEvent(CacheItemWrapperInternal.getCacheItemRemovedListener(item), EnumSet.of(com.alachisoft.ncache.runtime.events.EventType.ItemRemoved), removeCallabackFilter, callbackType); if (callbackIds != null && callbackIds.length > 1) { itemRemovedCallback = callbackIds[1]; } } } if (itemUpdatedCallback == -1) { if (CacheItemWrapperInternal.getCacheItemUpdatedListener(item)!= null) { updateCallbackFilter = CacheItemWrapperInternal.getItemUpdatedDataFilter(item); short[] callbackIds = _parent.getEventManager().registerSelectiveEvent(CacheItemWrapperInternal.getCacheItemUpdatedListener(item), EnumSet.of(EventType.ItemUpdated), updateCallbackFilter, callbackType); if (callbackIds != null && callbackIds.length > 0) { itemUpdatedCallback = callbackIds[0]; } } } java.util.Hashtable queryInfoDic = (java.util.Hashtable)((CacheItemWrapperInternal.getQueryInfo(item).get("query-info") instanceof java.util.Hashtable) ? CacheItemWrapperInternal.getQueryInfo(item).get("query-info") : null); if (queryInfoDic != null) { Iterator queryInfoEnum = queryInfoDic.entrySet().iterator(); while (queryInfoEnum.hasNext()) { java.util.ArrayList valuesEnum = (java.util.ArrayList)queryInfoEnum.next(); for (int j = 0; j < valuesEnum.size(); j++) { if (valuesEnum.get(j) instanceof java.util.Date) { valuesEnum.set(j, ((java.util.Date)valuesEnum.get(j)).getTime()); } } } } try { boolean ResyncOnExpire= false; if(item.getResyncOptions() != null) ResyncOnExpire = item.getResyncOptions().getResyncOnExpiration(); String ResyncProvider= null; if(item.getResyncOptions() != null) ResyncProvider = item.getResyncOptions().getProviderName(); entries[i] = MakeCompactEntry(key, item.getValue(null), hint, item.getSyncDependency(), ConversionUtil.getAbsoluteExpiration(item.getExpiration()), ConversionUtil.getSlidingExpiration(item.getExpiration()), item.getCacheItemPriority(), itemRemovedCallback, itemRemovedCallback, (short) -1, onDsItemsUpdatedCallback, ResyncOnExpire, item.getGroup(), CacheItemWrapperInternal.getQueryInfo(item), CacheItemWrapperInternal.getFlagValue(item), null, 0, Alachisoft.NCache.Common.Locking.LockAccessType .IGNORE_LOCK, providerName, ResyncProvider, CacheItemWrapperInternal.getItemUpdatedDataFilter(item), CacheItemWrapperInternal.getItemRemovedDataFilter(item), clientId); } catch (ParseException e) { throw new OperationFailedException(e); } } OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); operationContext.Add(OperationContextFieldName.WriteThru, CacheItemWrapperInternal.getFlagValue(items[0]).IsBitSet((byte) BitSetConstants.WriteThru)); operationContext.Add(OperationContextFieldName.WriteBehind, CacheItemWrapperInternal.getFlagValue(items[0]).IsBitSet((byte) BitSetConstants.WriteBehind)); operationContext.Add(OperationContextFieldName.RaiseCQNotification, true); operationContext.Add(OperationContextFieldName.ValueDataSize, sizes); tangible.RefObject tempRef_itemVersions = new tangible.RefObject(itemVersions); try { return (HashMap)_nCache.InsertEntries(entries, operationContext); } catch (Exception e) { throw new CacheException(e); } } ///#endregion ///#region / --- Remove --- / /** Removes the object from the . @param key The cache key used to reference the item. @return The item removed from the Cache. If the value in the key parameter is not found, returns a null reference (Nothing in Visual Basic). @exception ArgumentNullException contains a null reference (Nothing in Visual Basic). @exception ArgumentException is not serializable.

Note: If exceptions are enabled through the setting, this property throws exception in case of failure.

The following example demonstrates how you can remove an item from your application's object. NCache.Cache.Remove("timestamp"); Or simply in a class deriving from or . Cache.Remove("timestamp"); */ @Override public CompressedValueEntry remove(String key, BitSet flagMap, short onDsItemRemovedCallback, String lockId, CacheItemVersion version, Alachisoft.NCache.Common.Locking.LockAccessType accessType, String ProviderName) throws OperationFailedException { if (_nCache != null) { CallbackEntry notification = null; if (onDsItemRemovedCallback != -1) { notification = new CallbackEntry(getClientID(), -1, null, (short)-1, (short)-1, onDsItemRemovedCallback, EventDataFilter.None, EventDataFilter.None); } OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); operationContext.Add(OperationContextFieldName.ClientId,getClientID()); operationContext.Add(OperationContextFieldName.WriteThru, flagMap.IsBitSet((byte) BitSetConstants.WriteThru)); operationContext.Add(OperationContextFieldName.WriteBehind, flagMap.IsBitSet((byte) BitSetConstants.WriteBehind)); if (ProviderName != null) { operationContext.Add(OperationContextFieldName.WriteThruProviderName, ProviderName); } operationContext.Add(OperationContextFieldName.RaiseCQNotification, true); CompressedValueEntry cmpEntry = _nCache.Remove(key, flagMap, notification, lockId, version == null ? 0 : version.getVersion(), accessType, ProviderName, operationContext); if (cmpEntry != null && cmpEntry.getValue() != null) { if (cmpEntry.getValue() instanceof Alachisoft.NCache.Common.Caching.UserBinaryObject ) { Alachisoft.NCache.Common.Caching.UserBinaryObject ubObject = (Alachisoft.NCache.Common.Caching.UserBinaryObject )((cmpEntry.getValue() instanceof Alachisoft.NCache.Common.Caching.UserBinaryObject ) ? cmpEntry.getValue() : null); cmpEntry.setValue( ubObject.getFullObject()); } cmpEntry.setValue ( CacheHelper.getObjectOrInitializedCollection(key, cmpEntry.getType(), cmpEntry.getValue(), _parent,null)); } return cmpEntry; } return null; } /** Removes the object from the . @param key The cache key used to reference the item. @exception ArgumentNullException contains a null reference (Nothing in Visual Basic). @exception ArgumentException is not serializable.

Note: If exceptions are enabled through the setting, this property throws exception in case of failure.

The following example demonstrates how you can remove an item from your application's object. NCache.Cache.Remove("timestamp"); Or simply in a class deriving from or . Cache.Remove("timestamp"); */ @Override public void delete(String key, BitSet flagMap, short onDsItemRemovedCallback, String lockId, CacheItemVersion version, Alachisoft.NCache.Common.Locking.LockAccessType accessType, String ProviderName) throws OperationFailedException { if (_nCache != null) { CallbackEntry notification = null; if (onDsItemRemovedCallback != -1) { notification = new CallbackEntry(getClientID(), -1, -1, (short)-1, (short)-1, onDsItemRemovedCallback, EventDataFilter.None, EventDataFilter.None); } OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); operationContext.Add(OperationContextFieldName.ClientId, this.getClientID()); operationContext.Add(OperationContextFieldName.RaiseCQNotification, true); _nCache.Delete(key, flagMap, notification, lockId, version == null ? 0 : version.getVersion(), accessType, ProviderName, operationContext); } } /** Removes the objects from the . @param keys The cache keys used to reference the item. @return The items removed from the Cache. If the value in the keys parameter is not found, returns a null reference (Nothing in Visual Basic). @exception ArgumentNullException contains a null reference (Nothing in Visual Basic). @exception ArgumentException is not serializable.

Note: If exceptions are enabled through the setting, this property throws exception in case of failure.

The following example demonstrates how you can remove an item from your application's object. NCache.Cache.Remove(keys); Or simply in a class deriving from or . Cache.Remove(keys); */ @Override public java.util.HashMap remove(String[] keys, BitSet flagMap, String providerName, short onDsItemsRemovedCallback) throws OperationFailedException { CallbackEntry notification = null; if (onDsItemsRemovedCallback != -1) { notification = new CallbackEntry(getClientID(), -1, -1, (short)-1, (short)-1, onDsItemsRemovedCallback, EventDataFilter.None, EventDataFilter.None); } Object[] baseKeys = new Object[keys.length]; for (int i = 0; i < keys.length; i++) { baseKeys[i] = keys[i]; } OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); operationContext.Add(OperationContextFieldName.ClientId, this.getClientID()); operationContext.Add(OperationContextFieldName.WriteThru, flagMap.IsBitSet((byte) BitSetConstants.WriteThru)); operationContext.Add(OperationContextFieldName.WriteBehind, flagMap.IsBitSet((byte) BitSetConstants.WriteBehind)); if (providerName != null) { operationContext.Add(OperationContextFieldName.WriteThruProviderName, providerName); } operationContext.Add(OperationContextFieldName.RaiseCQNotification, true); java.util.HashMap items = (HashMap)_nCache.Remove(baseKeys, flagMap, notification, providerName, operationContext); if (items != null) { Iterator ide = items.entrySet().iterator(); while (ide.hasNext()) { Object val=ide.next(); CompressedValueEntry cmpEntry = (CompressedValueEntry)((val instanceof CompressedValueEntry) ? val : null); if (cmpEntry != null && cmpEntry.getValue() != null) { if (cmpEntry.getValue() instanceof Alachisoft.NCache.Common.Caching.UserBinaryObject ) { Alachisoft.NCache.Common.Caching.UserBinaryObject ubObject = (Alachisoft.NCache.Common.Caching.UserBinaryObject )((cmpEntry.getValue() instanceof Alachisoft.NCache.Common.Caching.UserBinaryObject ) ? cmpEntry.getValue() : null); cmpEntry.setValue( ubObject.getFullObject()); } } } } return items; } @Override public void delete(String[] keys, BitSet flagMap, String providerName, short onDsItemsRemovedCallback) throws OperationFailedException { CallbackEntry notification = null; if (onDsItemsRemovedCallback != -1) { notification = new CallbackEntry(getClientID(), (short)-1, null, (short)-1, (short)-1, (short)-1, EventDataFilter.None, EventDataFilter.None); } Object[] baseKeys = new Object[keys.length]; for (int i = 0; i < keys.length; i++) { baseKeys[i] = keys[i]; } OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); operationContext.Add(OperationContextFieldName.ClientId, getClientID()); operationContext.Add(OperationContextFieldName.RaiseCQNotification, true); _nCache.Delete(baseKeys, flagMap, notification, providerName, operationContext); } @Override public void remove(String group) throws OperationFailedException, GeneralFailureException, AggregateException, SecurityException, ConnectionException { if (group == null) throw new IllegalArgumentException("group"); if (_nCache == null) return; OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); operationContext.Add(OperationContextFieldName.RaiseCQNotification, true); _nCache.Remove(group, null, operationContext); return; } /** Performs search on the based on the query specified. @param query simple SQL like query syntax t oquery objects from cache @param values The IDictionary of atribute names and values. @return Returns a list of cache keys These operators are supported by NCache Queries. 1. Comparison Operators = , == , != , <> , < , > , <=, >=, IN 2. Logical Operators AND , OR , NOT 3. Miscellaneous () , DateTime.Now , DateTime("any date time compatible string") Hashtable values = new Hashtable(); values.add("Name", "Paul Jones"); "select Test.Application.Employee where this.Name = ?" values.add("Salary", 2000); "select Test.Application.Employee where this.Salary > ?" values.Add("Name", "Paul jones"); values.Add("Salary", 2000); "select Test.Application.Employee where this.Name = ? and this.Salary > ?" values.Add("Name", "Paul Jones"); values.Add("Salary", 2000); "select Test.Application.Employee where Not(this.Name = 'Paul Jones' and this.Salary > 2000)" */ @Override public Alachisoft.NCache.Caching.Queries.QueryResultSet search(String query, java.util.HashMap values) { throw new OperationNotSupportedRuntimeException(ErrorCodes.ClientCache.InprocCacheNotSuportedInJavaClient, ErrorMessages.getErrorMessage(ErrorCodes.ClientCache.InprocCacheNotSuportedInJavaClient)); } ///#endregion ///#region ------------ Delete/RemoveQuery ----------- /** Remove on the based on the query specified. @param query simple SQL like query syntax t oquery objects from cache @return Returns a dictionary containing removed cache keys and associated objects These operators are supported by NCache Queries. 1. Comparison Operators = , == , != , <> , < , > , <=, >=, IN 2. Logical Operators AND , OR , NOT 3. Miscellaneous () , DateTime.Now , DateTime("any date time compatible string") "delete Test.Application.Employee where this.Name = 'Paul Jones'" "delete Test.Application.Employee where this.Salary > 2000" "delete Test.Application.Employee where this.Name = 'Paul Jones' and this.Salary > 2000" "delete Test.Application.Employee where Not(this.Name = 'Paul Jones' and this.Salary > 2000)" */ @Override public int executeNonQuery(String query, java.util.HashMap values) throws Exception { throw new OperationNotSupportedException(ErrorCodes.ClientCache.InprocCacheNotSuportedInJavaClient, ErrorMessages.getErrorMessage(ErrorCodes.ClientCache.InprocCacheNotSuportedInJavaClient)); } @Override RecordSetEnumeratorImpl executeReaderCQ(ContinuousQuery continuousQuery, boolean getData, int chunkSize, String clientUniqueId, boolean notifyAdd, boolean notifyUpdate, boolean notifyRemove) { return null; } ///#endregion //ORIGINAL LINE: public override object SafeSerialize(object serializableObject, string serializationContext, ref BitSet flag, CacheImplBase cacheImpl, ref long size, UserObjectType userObjectType,bool isCustomAttributeBaseSerialzed=false) @Override public Object safeSerialize(Object serializableObject, String serializationContext, BitSet flag, CacheImplBase cacheImpl, RefObject size, UserObjectType userObjectType, boolean isCustomerAtributeBaseSerialized) throws OperationFailedException, GeneralFailureException { try { return SerializationUtil.safeSerializeInProc(serializableObject, serializationContext, flag,_nCache.getDataFormat() == DataFormat.Binary ,_parent.getSerializationFormat(),size, userObjectType,isCustomerAtributeBaseSerialized); } catch (IOException e) { throw new OperationFailedException(e); } } @Override public T safeDeserialize(Object serializedObject, String serializationContext, BitSet flag, CacheImplBase cacheImpl, UserObjectType userObjectType, Class cls) throws OperationFailedException { try { return SerializationUtil.safeDeserializeInProc(serializedObject, serializationContext, flag, _nCache.getDataFormat() == DataFormat.Binary,userObjectType, cls); } catch (IOException |ClassNotFoundException e) { throw new OperationFailedException(e); } } @Override public Enumeration getEnumerator() { return null; } @Override public ArrayList getNextChunk(ArrayList pointers) throws SecurityException, GeneralFailureException, OperationFailedException, AggregateException, ConnectionException, UnknownHostException, ConfigurationException, StreamException, StreamAlreadyLockedException, LicensingException, OperationNotSupportedException, StreamNotFoundException, CommandException { return null; } ///#endregion ///#endregion ///#region/ ---Serialization Compact Framework--- / @Override public java.util.HashMap getCompactTypes() { java.util.HashMap types = null; java.util.HashMap javaTypes = null; if (_config != null && _config.getCompactKnownTypes() != null) { if (_config.getDataSharingKnownTypes() != null) { tangible.RefObject tempRef_types = new tangible.RefObject(types); tangible.RefObject tempRef_javaTypes = new tangible.RefObject(javaTypes); filterOutDotNetTypes(_config.getDataSharingKnownTypes(), tempRef_types, tempRef_javaTypes, true, false); types = tempRef_types.argvalue; javaTypes = tempRef_javaTypes.argvalue; } tangible.RefObject tempRef_types2 = new tangible.RefObject(types); tangible.RefObject tempRef_javaTypes2 = new tangible.RefObject(javaTypes); filterOutDotNetTypes(_config.getCompactKnownTypes(), tempRef_types2, tempRef_javaTypes2, _config.getDataSharingKnownTypes() == null ? false : true, true); types = tempRef_types2.argvalue; javaTypes = tempRef_javaTypes2.argvalue; try { types = com.alachisoft.ncache.serialization.util.SerializationUtil.getCompactTypes(javaTypes, false, getName()); } catch (Exception e) { //System.err.println(e.getStackTrace()); } } return types; } private void filterOutDotNetTypes(java.util.HashMap _cmptKnownTypes, tangible.RefObject cmptKnownTypesdotNet, tangible.RefObject cmptKnownTypesJava, boolean isDataSharing, boolean compact) { cmptKnownTypesdotNet.argvalue = new java.util.HashMap(); cmptKnownTypesJava.argvalue = new java.util.HashMap(); if (compact && isDataSharing) { filterOutDotNetTypes(_config.getDataSharingKnownTypes(), cmptKnownTypesdotNet, cmptKnownTypesJava, true, false); // Dot Net and java compact type HashMap, keeping them in different HashMaps } if (_cmptKnownTypes != null) { Iterator ide = _cmptKnownTypes.entrySet().iterator(); Map.Entry keyVal; if (!compact) { while (ide.hasNext()) { keyVal = (Map.Entry) ide.next(); java.util.HashMap compactType = (java.util.HashMap) keyVal.getValue(); java.util.HashMap classes = (java.util.HashMap) compactType.get("known-classes"); Iterator ide2 = classes.entrySet().iterator(); Map.Entry cls; while (ide2.hasNext()) { cls = (Map.Entry) ide2.next(); java.util.HashMap typeInfo = (java.util.HashMap) cls.getValue(); if (typeInfo.get("type").toString().toLowerCase().equals("java")) { if (!cmptKnownTypesJava.argvalue.containsKey((String) keyVal.getKey())) { cmptKnownTypesJava.argvalue.put((String) keyVal.getKey(), new java.util.HashMap()); } ((java.util.HashMap) cmptKnownTypesJava.argvalue.get(((String) keyVal.getKey()))).put((String) typeInfo.get("name"), (java.util.HashMap) typeInfo); if (!typeInfo.containsKey("portable")) { typeInfo.put("portable", compactType.get("portable")); } } else if (typeInfo.get("type").toString().toLowerCase().equals("net")) { if (!cmptKnownTypesdotNet.argvalue.containsKey((String) keyVal.getKey())) { cmptKnownTypesdotNet.argvalue.put((String) keyVal.getKey(), new java.util.HashMap()); } ((java.util.HashMap) cmptKnownTypesdotNet.argvalue.get(((String) keyVal.getKey()))).put((String) typeInfo.get("name"), (java.util.HashMap) typeInfo); if (!typeInfo.containsKey("portable")) { typeInfo.put("portable", compactType.get("portable")); } } } if (Boolean.parseBoolean(compactType.get("portable").toString())) { if (cmptKnownTypesJava.argvalue.size() > 0 && (java.util.HashMap) cmptKnownTypesJava.argvalue.get(((String) keyVal.getKey())) != null) { ((java.util.HashMap) cmptKnownTypesJava.argvalue.get(((String) keyVal.getKey()))).put((String) "Alachisoft.NCache.AttributeUnion", compactType.get("attribute-union-list")); } if (cmptKnownTypesdotNet.argvalue.size() > 0 && (java.util.HashMap) cmptKnownTypesdotNet.argvalue.get(((String) keyVal.getKey())) != null) { ((java.util.HashMap) cmptKnownTypesdotNet.argvalue.get(((String) keyVal.getKey()))).put((String) "Alachisoft.NCache.AttributeUnion", compactType.get("attribute-union-list")); } } } } else { while (ide.hasNext()) { keyVal = (Map.Entry) ide.next(); java.util.HashMap compactType = (java.util.HashMap) keyVal.getValue(); if (compactType.get("type") != null) { if (compactType.get("type").toString().toLowerCase().equals("java")) { if (!cmptKnownTypesJava.argvalue.containsKey((String) keyVal.getKey())) { cmptKnownTypesJava.argvalue.put((String) keyVal.getKey(), new java.util.HashMap()); } ((java.util.HashMap) cmptKnownTypesJava.argvalue.get(((String) keyVal.getKey()))).put((String) compactType.get("name"), (java.util.HashMap) compactType); } else if (compactType.get("type").toString().toLowerCase().equals("net")) { if (compactType.containsValue("arg-types")) { compactType.put("arg-types", filterOutNestedGenerics((java.util.HashMap) compactType.get("arg-types"))); } if (!cmptKnownTypesdotNet.argvalue.containsKey((String) keyVal.getKey())) { cmptKnownTypesdotNet.argvalue.put((String) keyVal.getKey(), new java.util.HashMap()); } ((java.util.HashMap) cmptKnownTypesdotNet.argvalue.get(((String) keyVal.getKey()))).put((String) compactType.get("name"), (java.util.HashMap) compactType); } } } } } } private java.util.HashMap filterOutNestedGenerics(java.util.HashMap htArgTypes) { java.util.HashMap htArgTypes2 = null; if (htArgTypes != null && htArgTypes.size() > 0) { htArgTypes2 = new java.util.HashMap(); Iterator ide11 = htArgTypes.entrySet().iterator(); Map.Entry keyVal; while (ide11.hasNext()) { keyVal = (Map.Entry) ide11.next(); java.util.HashMap innerGenericType = new java.util.HashMap(); htArgTypes2.put(keyVal.getKey().toString(), innerGenericType); java.util.HashMap argInstances = (java.util.HashMap) keyVal.getValue(); Iterator ide12 = argInstances.entrySet().iterator(); while (ide12.hasNext()) { Map.Entry argInstance = (Map.Entry) ide12.next(); java.util.HashMap instanceArgType = (java.util.HashMap) argInstance.getValue(); if (instanceArgType.containsKey("arg-types")) { instanceArgType.put("arg-types", filterOutNestedGenerics((java.util.HashMap) instanceArgType.get("arg-types"))); } java.util.HashMap innerGenericTypeDetail = new java.util.HashMap(); innerGenericTypeDetail.put(instanceArgType.get("name").toString(), instanceArgType); innerGenericType.put(argInstance.getKey().toString(), innerGenericTypeDetail); } } //compactType["arg-types"] = htArgTypes2; } return htArgTypes2; } @Override public boolean removeTopic(String topicName, boolean b) throws CacheException { return false; } @Override public void publishMessage(String messageId, Object value, long time, long expiration, Hashtable metaInfo, BitSet flagMap) throws Exception { } @Override public boolean unSubscribe(String topicName, String recepientId, SubscriptionPolicyType subscriptionPolicyType, SubscriptionType pubSubType, boolean dispose) throws Exception { throw new OperationNotSupportedException("unSubscribe"); } @Override public ReceivedMessages getMessageData(BitSet flagMap) throws CacheException { return null; } @Override void createDataType(CollectionCreateOrGetOperation operation, DataStructureAttributes properties) throws OperationFailedException, LicensingException, CommandException { } @Override boolean getDataType(CollectionCreateOrGetOperation operation) { return false; } @Override RecordSetEnumerator executeReader(String query, Map values, boolean getData, int chunkSize) { return null; } @Override public void listRemoveWithIndex(ListRemoveWithIndexOperation operation) { } @Override public void listAddWithoutIndex(ListAddWithoutIndexOperation operation) { } @Override public boolean listAddWithPivot(ListAddWithPivotOperation operation) { return false; } @Override public List listGetBulk(ListGetBulkOperation operation) { return null; } @Override public int listRemoveWithoutIndex(ListRemoveWithoutIndexOperation operation) { return 0; } @Override public void listInsertWithIndex(ListInsertWithIndexOperation tempVar) { } @Override public int listSearch(ListSearchOperation operation) { return 0; } @Override public ExtendedJsonValueBase listGetItem(ListGetItemOperation operation) { return null; } @Override public String registerCQ(ContinuousQuery query, String clientUniqueId, boolean notifyAdd, boolean notifyUpdate, boolean notifyRemove) throws CacheException { return null; } @Override public void unRegisterCQ(String serverUniqueId, String clientUniqueId) throws CacheException { } @Override public void registerKeyNotificationListener(String key, short update, short remove, EventDataFilter datafilter, boolean notifyOnItemExpiration, ListenerType listenerType) { } @Override public void registerKeyNotificationListener(String[] key, short update, short remove, EventDataFilter datafilter, boolean notifyOnItemExpiration, ListenerType listenerType) { } @Override public void registerKeyNotificationListener(String[] keys, short updateCallbackid, short removeCallbackid) throws CacheException { } @Override public void unRegisterKeyNotificationListener(String key, short updateCallbackid, short removeCallbackid) throws CacheException { } @Override public void unRegisterKeyNotificationListener(String[] key, short update, short remove) throws CacheException { } @Override public void unRegisterGeneralNotificationListener(EventTypeInternal unregister, short sequenceNumber) throws CacheException { } @Override public void registerGeneralNotification(EventTypeInternal eventType, EventDataFilter datafilter, short sequenceNumber) throws CacheException { } @Override public void registerKeyNotificationListener(String[] keys, short updateCallbackid, short removeCallbackid, String clientId, ListenerType listenerType) { } ///#endregion ///#region ---------------------- Cache Data Reader ---------------------- /** Provide data reader on based on the query specified. */ ///#endregion ///#endregion @Override public void touch(java.util.ArrayList keys) throws OperationNotSupportedException { throw new OperationNotSupportedException(ErrorCodes.ClientCache.InprocCacheNotSuportedInJavaClient, ErrorMessages.getErrorMessage(ErrorCodes.ClientCache.InprocCacheNotSuportedInJavaClient)); } ///#region ICollection @Override public void CollectionClearOperation(CollectionOperation operation) { OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); _nCache.ClearCollection(operation, operationContext); } @Override public int CollectionCountOperation(CollectionOperation operation) { OperationContext operationContext = new OperationContext(OperationContextFieldName.OperationType, OperationContextOperationType.CacheOperation); return _nCache.GetCollectionCount(operation, operationContext); } @Override GetCollectionChunkResponseBase GetCollectionChunk(GetCollectionChunkOperation operation) { return null; } @Override long counterGetOperation(CounterGetOperation counterGetOperation) { return 0; } @Override long counterOperations(CounterOperation operation) { return 0; } @Override void dictionaryAdd(DictionaryAddOperation operation) { } @Override Collection dictionaryGet(DictionaryGetOperation operation) { return null; } @Override int dictionaryRemove(DictionaryRemoveOperation operation) { return 0; } @Override boolean dictionaryContains(DictionaryContainsOperation tempVar) { return false; } @Override void hashSetAdd(HashSetAddOperation tempVar) { } @Override int hashSetRemove(HashSetRemoveOperation tempVar) { return 0; } @Override List hashSetGetRandom(HashSetGetRandomOperation operation) { return null; } @Override List hashSetRemoveRandom(HashSetRemoveRandomOperation operation) { return null; } @Override boolean hashSetContains(HashSetContainsOperation operation) { return false; } @Override boolean queueEnqueue(QueueEnqueueOperation operation) { return false; } @Override ExtendedJsonValueBase queueDequeue(QueueDequeueOperation operation) { return null; } @Override ExtendedJsonValueBase queuePeek(QueuePeekOperation queuePeekOperation) { return null; } @Override boolean queueSearch(QueueSearchOperation operation) { return false; } @Override public void PublishMetadata(MetricsTransporter transporter) { } ///#endregion }