001package org.apache.commons.jcs3.auxiliary.remote.http.server;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *   http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import org.apache.commons.jcs3.auxiliary.AbstractAuxiliaryCacheAttributes;
023
024/**
025 * Configuration for the RemoteHttpCacheServer. Most of these properties are used only by the
026 * service.
027 */
028public class RemoteHttpCacheServerAttributes
029    extends AbstractAuxiliaryCacheAttributes
030{
031    /** Don't change. */
032    private static final long serialVersionUID = -3987239306108780496L;
033
034    /** Can a cluster remote put to other remotes */
035    private boolean localClusterConsistency = true;
036
037    /** Can a cluster remote get from other remotes */
038    private boolean allowClusterGet = true;
039
040    /**
041     * Should cluster updates be propagated to the locals
042     * <p>
043     * @return The localClusterConsistency value
044     */
045    public boolean isLocalClusterConsistency()
046    {
047        return localClusterConsistency;
048    }
049
050    /**
051     * Should cluster updates be propagated to the locals
052     * <p>
053     * @param r The new localClusterConsistency value
054     */
055    public void setLocalClusterConsistency( final boolean r )
056    {
057        this.localClusterConsistency = r;
058    }
059
060    /**
061     * Should gets from non-cluster clients be allowed to get from other remote auxiliaries.
062     * <p>
063     * @return The localClusterConsistency value
064     */
065    public boolean isAllowClusterGet()
066    {
067        return allowClusterGet;
068    }
069
070    /**
071     * Should we try to get from other cluster servers if we don't find the items locally.
072     * <p>
073     * @param r The new localClusterConsistency value
074     */
075    public void setAllowClusterGet( final boolean r )
076    {
077        allowClusterGet = r;
078    }
079
080    /**
081     * @return String details
082     */
083    @Override
084    public String toString()
085    {
086        final StringBuilder buf = new StringBuilder();
087        buf.append( "\nRemoteHttpCacheServiceAttributes" );
088        buf.append( "\n cacheName = [" + this.getCacheName() + "]" );
089        buf.append( "\n allowClusterGet = [" + this.isAllowClusterGet() + "]" );
090        buf.append( "\n localClusterConsistency = [" + this.isLocalClusterConsistency() + "]" );
091        buf.append( "\n eventQueueType = [" + this.getEventQueueType() + "]" );
092        buf.append( "\n eventQueuePoolName = [" + this.getEventQueuePoolName() + "]" );
093        return buf.toString();
094    }
095}