/** * When a <code>serializer-registration element is first encountered, we need * to create the wrapper object to hold the data, and put it on the stack. */ private void startSerializerRegistration(){ SerializerCreation sc = new SerializerCreation(); this.stack.push(sc); }
/** * Ending the top level <code>serialization-registration</code> element and * actually doing the work of registering all the components. */ private void endSerializerRegistration() { SerializerCreation sc = (SerializerCreation) this.stack.pop(); sc.create(); this.cache.setSerializerCreation(sc); }
public void testSerializationRegistration() SerializerCreation sc = new SerializerCreation(); sc.registerInstantiator(DS1.class, 15); sc.registerInstantiator(DS2.class, 16); sc.registerSerializer(GoodSerializer.class); assertEquals(GoodSerializer.class, InternalDataSerializer.getSerializer(101).getClass()); sc = new SerializerCreation(); sc.registerInstantiator(NotDataSerializable.class, 15); closeCache(); cc.setSerializerCreation(sc); sc = new SerializerCreation(); sc.registerSerializer(BadSerializer.class); closeCache(); cc.setSerializerCreation(sc);
for(Class c : sc.getSerializerRegistrations()) { handler.startElement("", SERIALIZER_REGISTRATION, SERIALIZER_REGISTRATION, EMPTY); handler.startElement("", CLASS_NAME, CLASS_NAME, EMPTY); for(Map.Entry<Class, Integer> e : sc.getInstantiatorRegistrations().entrySet()) { Class c = e.getKey(); Integer i = e.getValue();
/** * Ending the serialization registration should leave us with a class name * on the stack. We will call the DataSerializer.register() with the class * once we find it. */ private void endSerializer() { Class c = getClassFromStack(); if(! (DataSerializer.class.isAssignableFrom(c))) { throw new CacheXmlException(LocalizedStrings.CacheXmlParser_A_0_NOT_A_SERIALIZER .toLocalizedString(c.getName())); } SerializerCreation sr = (SerializerCreation) this.stack.peek(); sr.registerSerializer(c); }
for(Class c : sc.getSerializerRegistrations()) { handler.startElement("", SERIALIZER_REGISTRATION, SERIALIZER_REGISTRATION, EMPTY); handler.startElement("", CLASS_NAME, CLASS_NAME, EMPTY); for(Map.Entry<Class, Integer> e : sc.getInstantiatorRegistrations().entrySet()) { Class c = e.getKey(); Integer i = e.getValue();
/** * Ending the serialization registration should leave us with a class name * on the stack. We will call the DataSerializer.register() with the class * once we find it. */ private void endSerializer() { Class c = getClassFromStack(); if(! (DataSerializer.class.isAssignableFrom(c))) { throw new CacheXmlException(LocalizedStrings.CacheXmlParser_A_0_NOT_A_SERIALIZER .toLocalizedString(c.getName())); } SerializerCreation sr = (SerializerCreation) this.stack.peek(); sr.registerSerializer(c); }
/** * When a <code>serializer-registration element is first encountered, we need * to create the wrapper object to hold the data, and put it on the stack. */ private void startSerializerRegistration(){ //The logWriter appears to be null during the unit tests... so just to //be sure we don't cause a problem, check for null... SerializerCreation sc = new SerializerCreation(); this.stack.push(sc); }
/** * Ending the top level <code>serialization-registration</code> element and * actually doing the work of registering all the components. */ private void endSerializerRegistration() { SerializerCreation sc = (SerializerCreation) this.stack.pop(); sc.create(getLogWriter()==null?null:getLogWriter().convertToLogWriter()); this.cache.setSerializerCreation(sc); }