com.gemstone.gemfire.admin.internal.CacheServerConfigImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gemfire-core Show documentation
Show all versions of gemfire-core Show documentation
SnappyData store based off Pivotal GemFireXD
/*
* Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved.
*
* 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. See accompanying
* LICENSE file.
*/
package com.gemstone.gemfire.admin.internal;
import com.gemstone.gemfire.admin.CacheServerConfig;
import com.gemstone.gemfire.admin.CacheVmConfig;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.admin.GemFireVM;
/**
* An implementation of CacheVmConfig
*
* @author David Whitlock
* @since 4.0
*/
public class CacheServerConfigImpl extends ManagedEntityConfigImpl
implements CacheVmConfig, CacheServerConfig {
/** Declarative caching XML file that is used to initialize the
* Cache in the cache server. */
private String cacheXMLFile;
/** Extra classpath for the cache server */
private String classpath;
/////////////////////// Constructors ///////////////////////
/**
* Creates a new CacheServerConfigImpl
with the default
* configuration settings.
*/
public CacheServerConfigImpl() {
this.cacheXMLFile = null;
this.classpath = null;
}
/**
* Creates a new CacheServerConfigImpl
for a running
* cache server.
*/
public CacheServerConfigImpl(GemFireVM vm) {
super(vm);
String name = DistributionConfig.CACHE_XML_FILE_NAME;
this.cacheXMLFile = vm.getConfig().getAttribute(name);
this.classpath = null;
}
/**
* Copy constructor
*/
public CacheServerConfigImpl(CacheServerConfig other) {
super(other);
this.cacheXMLFile = other.getCacheXMLFile();
this.classpath = other.getClassPath();
}
/**
* Copy constructor
*/
public CacheServerConfigImpl(CacheVmConfig other) {
super(other);
this.cacheXMLFile = other.getCacheXMLFile();
this.classpath = other.getClassPath();
}
////////////////////// Instance Methods //////////////////////
public String getCacheXMLFile() {
return this.cacheXMLFile;
}
public void setCacheXMLFile(String cacheXMLFile) {
checkReadOnly();
this.cacheXMLFile = cacheXMLFile;
configChanged();
}
public String getClassPath() {
return this.classpath;
}
public void setClassPath(String classpath) {
checkReadOnly();
this.classpath = classpath;
configChanged();
}
@Override
public void validate() {
super.validate();
// Nothing to validate really. Cache.xml file could live on
// different file system.
}
/**
* Currently, listeners are not supported on the locator config.
*/
@Override
protected void configChanged() {
}
@Override
public Object clone() throws CloneNotSupportedException {
return new CacheServerConfigImpl((CacheVmConfig)this);
}
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append(super.toString());
sb.append(" cacheXMLFile=");
sb.append(this.getCacheXMLFile());
sb.append(" classPath=");
sb.append(this.getClassPath());
return sb.toString();
}
}