use of com.tangosol.net.ScopedCacheFactoryBuilder in project oracle-bedrock by coherence-community.
the class ExtendClient method build.
@Override
public ConfigurableCacheFactory build(LocalPlatform platform, CoherenceCluster cluster, OptionsByType optionsByType) {
// ----- establish the diagnostics output table -----
Table diagnosticsTable = new Table();
diagnosticsTable.getOptions().add(Table.orderByColumn(0));
// ----- establish the options for launching a local extend-based member -----
optionsByType.add(RoleName.of("extend-client"));
optionsByType.add(Clustering.disabled());
optionsByType.add(LocalStorage.disabled());
optionsByType.add(LocalHost.only());
optionsByType.add(SystemProperty.of("tangosol.coherence.extend.enabled", true));
optionsByType.add(CacheConfig.of(cacheConfigURI));
// ----- notify the Profiles that we're about to launch an application -----
MetaClass<CoherenceClusterMember> metaClass = new CoherenceClusterMember.MetaClass();
for (Profile profile : optionsByType.getInstancesOf(Profile.class)) {
profile.onLaunching(platform, metaClass, optionsByType);
}
// ----- create local system properties based on those defined by the launch options -----
// modify the current system properties to include/override those in the schema
com.oracle.bedrock.runtime.java.options.SystemProperties systemProperties = optionsByType.get(com.oracle.bedrock.runtime.java.options.SystemProperties.class);
Properties properties = systemProperties.resolve(platform, optionsByType);
Table systemPropertiesTable = new Table();
systemPropertiesTable.getOptions().add(Table.orderByColumn(0));
systemPropertiesTable.getOptions().add(Cell.Separator.of(""));
systemPropertiesTable.getOptions().add(Cell.DisplayNull.asEmptyString());
for (String propertyName : properties.stringPropertyNames()) {
String propertyValue = properties.getProperty(propertyName);
systemPropertiesTable.addRow(propertyName + (System.getProperties().containsKey(propertyName) ? "*" : ""), propertyValue);
System.setProperty(propertyName, propertyValue.isEmpty() ? "" : propertyValue);
}
diagnosticsTable.addRow("System Properties", systemPropertiesTable.toString());
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.log(Level.INFO, "Oracle Bedrock " + Bedrock.getVersion() + ": Starting *Extend Client...\n" + "------------------------------------------------------------------------\n" + diagnosticsTable.toString() + "\n" + "------------------------------------------------------------------------\n");
}
// ----- establish the session -----
// create the session
ConfigurableCacheFactory session = new ScopedCacheFactoryBuilder().getConfigurableCacheFactory(cacheConfigURI, getClass().getClassLoader());
return session;
}
use of com.tangosol.net.ScopedCacheFactoryBuilder in project oracle-bedrock by coherence-community.
the class StorageDisabledMember method build.
@Override
public ConfigurableCacheFactory build(LocalPlatform platform, CoherenceCluster cluster, OptionsByType optionsByType) {
// ----- establish the diagnostics output table -----
Table diagnosticsTable = new Table();
diagnosticsTable.getOptions().add(Table.orderByColumn(0));
// establish a new set of options based on those provided
optionsByType = OptionsByType.of(optionsByType);
// ----- establish the options for launching a local storage-disabled member -----
optionsByType.add(RoleName.of("client"));
optionsByType.add(LocalStorage.disabled());
optionsByType.addIfAbsent(CacheConfig.of("coherence-cache-config.xml"));
// ----- notify the Profiles that we're about to launch an application -----
MetaClass<CoherenceClusterMember> metaClass = new CoherenceClusterMember.MetaClass();
for (Profile profile : optionsByType.getInstancesOf(Profile.class)) {
profile.onLaunching(platform, metaClass, optionsByType);
}
// ----- create local system properties based on those defined by the launch options -----
// modify the current system properties to include/override those in the schema
com.oracle.bedrock.runtime.java.options.SystemProperties systemProperties = optionsByType.get(com.oracle.bedrock.runtime.java.options.SystemProperties.class);
Properties properties = systemProperties.resolve(platform, optionsByType);
Table systemPropertiesTable = new Table();
systemPropertiesTable.getOptions().add(Table.orderByColumn(0));
systemPropertiesTable.getOptions().add(Cell.Separator.of(""));
systemPropertiesTable.getOptions().add(Cell.DisplayNull.asEmptyString());
for (String propertyName : properties.stringPropertyNames()) {
String propertyValue = properties.getProperty(propertyName);
systemPropertiesTable.addRow(propertyName + (System.getProperties().containsKey(propertyName) ? "*" : ""), propertyValue);
System.setProperty(propertyName, propertyValue.isEmpty() ? "" : propertyValue);
}
diagnosticsTable.addRow("System Properties", systemPropertiesTable.toString());
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.log(Level.INFO, "Oracle Bedrock " + Bedrock.getVersion() + ": Starting Storage Disabled Member...\n" + "------------------------------------------------------------------------\n" + diagnosticsTable.toString() + "\n" + "------------------------------------------------------------------------\n");
}
// ----- establish the session -----
// create the session
ConfigurableCacheFactory session = new ScopedCacheFactoryBuilder().getConfigurableCacheFactory(optionsByType.get(CacheConfig.class).getUri(), getClass().getClassLoader());
// as this is a cluster member we have to join the cluster
CacheFactory.ensureCluster();
return session;
}
Aggregations