com.gemstone.gemfire.cache.Declarable Maven / Gradle / Ivy
/*
* 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.cache;
import java.util.Properties;
/**
* An object that can be described in a declarative caching XML file.
*
*
*
* Any user-defined object in the declarative caching xml file
* should implement this interface in order to be constructed.
*
*
*
* For example, the user can declare a CacheLoader
in a declarative
* XML file as follows:
*
*
* <cache-loader>
* <class-name>com.company.app.DBLoader</class-name>
* <parameter name="URL">
* <string>jdbc://12.34.56.78/mydb</string>
* </parameter>
* </cache-loader>
*
*
*
*
* In this case, com.company.app.DBLoader
must
* implement both the {@link CacheLoader} and Declarable
* interfaces. The cache service will construct a
* com.company.app.DBLoader
object by invoking the loader's
* zero-argument constructor and then calling the {@link #init} method
* to pass in the parameters.
*
*
*
* See package introduction.
*
* @author Darrel Schneider
*
*
* @since 2.0
*/
public interface Declarable {
/**
* Initializes a user-defined object using the given properties.
* Note that any uncaught exception thrown by this method will cause
* the Cache
initialization to fail.
*
* @param props
* Contains the parameters declared in the declarative xml
* file.
*
* @throws IllegalArgumentException
* If one of the configuration options in props
* is illegal or malformed.
*/
public void init(Properties props);
}