[
https://issues.jboss.org/browse/ISPN-1500?page=com.atlassian.jira.plugin....
]
William Burns edited comment on ISPN-1500 at 11/1/11 2:17 PM:
--------------------------------------------------------------
So if the accept is added I can change
{code}
@SuppressWarnings("unchecked")
public void override(MocaOverrideGlobalConfiguration override) {
// TODO: We have this hacky way until
https://issues.jboss.org/browse/ISPN-1500 is
fixed
AdvancedExternalizersType type = (AdvancedExternalizersType) ReflectionUtil
.getValue(override._serializactionType, "externalizerTypes");
Collection<AdvancedExternalizerConfig> configs =
(Collection<AdvancedExternalizerConfig>) ReflectionUtil
.getValue(type, "advancedExternalizers");
for (AdvancedExternalizerConfig config : configs) {
Integer id = config.getId();
if (id != null) {
_serializactionType.addAdvancedExternalizer(
config.getId(),
(AdvancedExternalizer<?>) Util.getInstance(
config.getExternalizerClass(), null));
}
else {
_serializactionType
.addAdvancedExternalizer((AdvancedExternalizer<?>) Util
.getInstance(config.getExternalizerClass(), null));
}
}
// We want to override the provided transport values
overrideFields(_transportType, override._transportType);
overrideFields(_jmxType, override._jmxType);
overrideFields(_shutdownType, override._shutdownType);
}
{code}
to
{code}
@SuppressWarnings("unchecked")
public void override(MocaOverrideGlobalConfiguration override) {
for (AdvancedExternalizerConfig config : _advancedExternalizerConfigs) {
Integer id = config.getId();
if (id != null) {
_serializactionType.addAdvancedExternalizer(
config.getId(),
(AdvancedExternalizer<?>) Util.getInstance(
config.getExternalizerClass(), null));
}
else {
_serializactionType
.addAdvancedExternalizer((AdvancedExternalizer<?>) Util
.getInstance(config.getExternalizerClass(), null));
}
}
// We want to override the provided transport values
overrideFields(_transportType, override._transportType);
overrideFields(_jmxType, override._jmxType);
overrideFields(_shutdownType, override._shutdownType);
}
{code}
and if AdvancedExternalizersType changes visibility I can change it to
{code}
// @see
org.infinispan.config.AbstractConfigurationBeanVisitor#visitAdvancedExternalizersType(org.infinispan.config.GlobalConfiguration.AdvancedExternalizersType)
@Override
public void visitAdvancedExternalizersType(AdvancedExternalizersType bean) {
_advancedExternalizersType = bean;
}
@SuppressWarnings("unchecked")
public void override(MocaOverrideGlobalConfiguration override) {
for (AdvancedExternalizerConfig config : _advancedExternalizerConfigs) {
_advancedExternalizersType.addExternalizer(config);
}
// We want to override the provided transport values
overrideFields(_transportType, override._transportType);
overrideFields(_jmxType, override._jmxType);
overrideFields(_shutdownType, override._shutdownType);
}
{code}
was (Author: rpwburns):
So if the accept is added I can change
{code}
@SuppressWarnings("unchecked")
public void override(MocaOverrideGlobalConfiguration override) {
// TODO: We have this hacky way until
https://issues.jboss.org/browse/ISPN-1500 is
fixed
AdvancedExternalizersType type = (AdvancedExternalizersType) ReflectionUtil
.getValue(override._serializactionType, "externalizerTypes");
Collection<AdvancedExternalizerConfig> configs =
(Collection<AdvancedExternalizerConfig>) ReflectionUtil
.getValue(type, "advancedExternalizers");
for (AdvancedExternalizerConfig config : configs) {
Integer id = config.getId();
if (id != null) {
_serializactionType.addAdvancedExternalizer(
config.getId(),
(AdvancedExternalizer<?>) Util.getInstance(
config.getExternalizerClass(), null));
}
else {
_serializactionType
.addAdvancedExternalizer((AdvancedExternalizer<?>) Util
.getInstance(config.getExternalizerClass(), null));
}
}
// We want to override the provided transport values
overrideFields(_transportType, override._transportType);
overrideFields(_jmxType, override._jmxType);
overrideFields(_shutdownType, override._shutdownType);
}
{code}
to
{code}
@SuppressWarnings("unchecked")
public void override(MocaOverrideGlobalConfiguration override) {
for (AdvancedExternalizerConfig config : _advancedExternalizerConfigs) {
Integer id = config.getId();
if (id != null) {
_serializactionType.addAdvancedExternalizer(
config.getId(),
(AdvancedExternalizer<?>) Util.getInstance(
config.getExternalizerClass(), null));
}
else {
_serializactionType
.addAdvancedExternalizer((AdvancedExternalizer<?>) Util
.getInstance(config.getExternalizerClass(), null));
}
}
// We want to override the provided transport values
overrideFields(_transportType, override._transportType);
overrideFields(_jmxType, override._jmxType);
overrideFields(_shutdownType, override._shutdownType);
}
{code}
and if AdvancedExternalizersType changes visibility I can change it to
{code}
// @see
org.infinispan.config.AbstractConfigurationBeanVisitor#visitAdvancedExternalizersType(org.infinispan.config.GlobalConfiguration.AdvancedExternalizersType)
@Override
public void visitAdvancedExternalizersType(AdvancedExternalizersType bean) {
}
@SuppressWarnings("unchecked")
public void override(MocaOverrideGlobalConfiguration override) {
for (AdvancedExternalizerConfig config : _advancedExternalizerConfigs) {
_advancedExternalizersType.addExternalizer(config);
}
// We want to override the provided transport values
overrideFields(_transportType, override._transportType);
overrideFields(_jmxType, override._jmxType);
overrideFields(_shutdownType, override._shutdownType);
}
{code}
SerializationType doesn't visit AdvancedExternalizersType
---------------------------------------------------------
Key: ISPN-1500
URL:
https://issues.jboss.org/browse/ISPN-1500
Project: Infinispan
Issue Type: Bug
Components: Configuration
Affects Versions: 5.0.1.FINAL
Reporter: William Burns
Assignee: Manik Surtani
Fix For: 5.1.0.CR1, 5.1.0.FINAL
Attachments: MocaOverrideGlobalConfiguration.java
Using infinispan, we have multiple infinispan.xml files that are used to configure our
caches. The overrides used on default and cache configurations work great for this. I
noticed there is no override global configuration support. So I was trying to make my own
for the stuff we needed. One of the items we need to "override" is the
serialization configs (it is more additive than override).
When doing this I found that the SerializationType doesn't properly pass off the
vistor to the AdvancedExternalizersType and thus I can't visit the Type or Configs,
which would make doing this much easier.
I was hoping I could keep a List of AdvancedSerializationConfigs that it visits and then
in my override method just add these Configs 1 by 1 to the SerializationType since it has
the public methods to add AdvancedSerializers.
It seems to be just an oversight but I would expect the accept method of
SerializationType to be the following instead (just added the accept to
AdvancedExternalizersType).
{code}
public void accept(ConfigurationBeanVisitor v) {
this.externalizerTypes.accept(v);
v.visitSerializationType(this);
}
{code}
Side note I noticed the AdvancedExternalizersType has addExternalizer as package level.
It would be easier to just call that method instead of having to detect the id myself and
whether an object or class is configured in the AdvancedSerializerConfig to decide what
add to call, since I could just do a straight add of the Config.
Also there is no way to remove or detect what AdvancedSerializers are present on the
SerializationType, which would be very helpful when trying to replace a given
AdvancedSerializers. Or are the AdvancedSerializerConfigs used started at the end of the
list? This would be preferable, because then I wouldn't care if another existed since
the one I just added would take priority.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira