com.thoughtworks.xstream.io.HierarchicalStreamDriver Java Examples
The following examples show how to use
com.thoughtworks.xstream.io.HierarchicalStreamDriver.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XStreamer.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Deserialize a self-contained XStream with object from an XML Reader. * * @param driver the implementation to use * @param xml the {@link Reader} providing the XML data * @param permissions the permissions to use (ensure that they include the defaults) * @throws IOException if an error occurs reading from the Reader. * @throws ClassNotFoundException if a class in the XML stream cannot be found * @throws com.thoughtworks.xstream.XStreamException if the object cannot be deserialized * @since 1.4.7 */ public Object fromXML(final HierarchicalStreamDriver driver, final Reader xml, final TypePermission[] permissions) throws IOException, ClassNotFoundException { final XStream outer = new XStream(driver); XStream.setupDefaultSecurity(outer); for(int i = 0; i < permissions.length; ++i) { outer.addPermission(permissions[i]); } final HierarchicalStreamReader reader = driver.createReader(xml); final ObjectInputStream configIn = outer.createObjectInputStream(reader); try { final XStream configured = (XStream)configIn.readObject(); final ObjectInputStream in = configured.createObjectInputStream(reader); try { return in.readObject(); } finally { in.close(); } } finally { configIn.close(); } }
Example #2
Source File: VRaptorXStream.java From vraptor4 with Apache License 2.0 | 5 votes |
public VRaptorXStream(TypeNameExtractor extractor, HierarchicalStreamDriver hierarchicalStreamDriver, Serializee serializee, ReflectionProvider reflectionProvider) { super(new PureJavaReflectionProvider(),hierarchicalStreamDriver); this.extractor = extractor; this.serializee = serializee; this.reflectionProvider = reflectionProvider; }
Example #3
Source File: XStreamFactory.java From saros with GNU General Public License v2.0 | 5 votes |
/** * Returns an <code>XStream</code> object with an set-up security framework. The passed <code> * HierarchicalStreamDriver</code> will be used when instantiating the <code>XStream</code> object * * @return an <code>XStream</code> object with an set-up security framework */ public static XStream getSecureXStream(HierarchicalStreamDriver hierarchicalStreamDriver) { XStream xStream = new XStream(hierarchicalStreamDriver); setUpSecurityFramework(xStream); return xStream; }
Example #4
Source File: CubaXStream.java From cuba with Apache License 2.0 | 5 votes |
protected CubaXStream( ReflectionProvider reflectionProvider, HierarchicalStreamDriver driver, ClassLoaderReference classLoader, Mapper mapper, final CubaXStreamConverterLookup converterLookup) { super(reflectionProvider, driver, classLoader, mapper, converterLookup::lookupConverterForType, converterLookup::registerConverter); }
Example #5
Source File: XStream.java From lams with GNU General Public License v2.0 | 5 votes |
private XStream( ReflectionProvider reflectionProvider, HierarchicalStreamDriver driver, ClassLoaderReference classLoader, Mapper mapper, final DefaultConverterLookup defaultConverterLookup) { this(reflectionProvider, driver, classLoader, mapper, new ConverterLookup() { public Converter lookupConverterForType(Class type) { return defaultConverterLookup.lookupConverterForType(type); } }, new ConverterRegistry() { public void registerConverter(Converter converter, int priority) { defaultConverterLookup.registerConverter(converter, priority); } }); }
Example #6
Source File: XStreamMarshaller.java From spring-analysis-note with MIT License | 4 votes |
private HierarchicalStreamDriver getDefaultDriver() { if (this.defaultDriver == null) { this.defaultDriver = new XppDriver(); } return this.defaultDriver; }
Example #7
Source File: XStreamMarshaller.java From spring4-understanding with Apache License 2.0 | 4 votes |
private HierarchicalStreamDriver getDefaultDriver() { if (this.defaultDriver == null) { this.defaultDriver = new XppDriver(); } return this.defaultDriver; }
Example #8
Source File: XStream.java From lams with GNU General Public License v2.0 | 4 votes |
/** * Constructs an XStream with a special {@link HierarchicalStreamDriver}, * {@link ReflectionProvider}, a prepared {@link Mapper} chain, the * {@link ClassLoaderReference} and an own {@link ConverterLookup} and * {@link ConverterRegistry}. * <p> * The ClassLoaderReference should also be used for the Mapper chain. The ConverterLookup * should access the ConverterRegistry if you intent to register {@link Converter} instances * with XStream facade or you are using annotations. * </p> * * @param reflectionProvider the reflection provider to use or <em>null</em> for best * matching Provider * @param driver the driver instance * @param classLoaderReference the reference to the {@link ClassLoader} to use * @param mapper the instance with the {@link Mapper} chain or <em>null</em> for the default * chain * @param converterLookup the instance that is used to lookup the converters * @param converterRegistry an instance to manage the converter instances or <em>null</em> * to prevent any further registry (including annotations) * @throws InitializationException in case of an initialization problem * @since 1.4.5 */ public XStream( ReflectionProvider reflectionProvider, HierarchicalStreamDriver driver, ClassLoaderReference classLoaderReference, Mapper mapper, ConverterLookup converterLookup, ConverterRegistry converterRegistry) { if (reflectionProvider == null) { reflectionProvider = JVM.newReflectionProvider(); } this.reflectionProvider = reflectionProvider; this.hierarchicalStreamDriver = driver; this.classLoaderReference = classLoaderReference; this.converterLookup = converterLookup; this.converterRegistry = converterRegistry; this.mapper = mapper == null ? buildMapper() : mapper; setupMappers(); setupSecurity(); setupAliases(); setupDefaultImplementations(); setupConverters(); setupImmutableTypes(); setMode(XPATH_RELATIVE_REFERENCES); }
Example #9
Source File: InitializerSerializer.java From openmrs-module-initializer with MIT License | 4 votes |
public InitializerSerializer(HierarchicalStreamDriver hierarchicalStreamDriver) { super(hierarchicalStreamDriver); }
Example #10
Source File: XStreamMarshaller.java From java-technology-stack with MIT License | 4 votes |
private HierarchicalStreamDriver getDefaultDriver() { if (this.defaultDriver == null) { this.defaultDriver = new XppDriver(); } return this.defaultDriver; }
Example #11
Source File: XStreamUtils.java From kogito-runtimes with Apache License 2.0 | 4 votes |
public static XStream createTrustingXStream(HierarchicalStreamDriver hierarchicalStreamDriver) { return internalCreateTrustingXStream(new XStream(hierarchicalStreamDriver)); }
Example #12
Source File: XStreamUtils.java From kogito-runtimes with Apache License 2.0 | 4 votes |
public static XStream createTrustingXStream(HierarchicalStreamDriver hierarchicalStreamDriver, ClassLoader classLoader) { return internalCreateTrustingXStream(new XStream((ReflectionProvider)null, hierarchicalStreamDriver, new ClassLoaderReference(classLoader))); }
Example #13
Source File: XStreamUtils.java From kogito-runtimes with Apache License 2.0 | 4 votes |
public static XStream createTrustingXStream(ReflectionProvider reflectionProvider, HierarchicalStreamDriver hierarchicalStreamDriver) { return internalCreateTrustingXStream(new XStream(reflectionProvider, hierarchicalStreamDriver)); }
Example #14
Source File: XStreamUtils.java From kogito-runtimes with Apache License 2.0 | 4 votes |
public static XStream createNonTrustingXStream(HierarchicalStreamDriver hierarchicalStreamDriver) { return internalCreateNonTrustingXStream(new XStream(hierarchicalStreamDriver)); }
Example #15
Source File: XStreamUtils.java From kogito-runtimes with Apache License 2.0 | 4 votes |
public static XStream createNonTrustingXStream(ReflectionProvider reflectionProvider, HierarchicalStreamDriver hierarchicalStreamDriver) { return internalCreateNonTrustingXStream(new XStream(reflectionProvider, hierarchicalStreamDriver)); }
Example #16
Source File: XStreamUtils.java From kogito-runtimes with Apache License 2.0 | 4 votes |
public static XStream createNonTrustingXStream(HierarchicalStreamDriver hierarchicalStreamDriver, ClassLoader classLoader) { return internalCreateNonTrustingXStream(new XStream((ReflectionProvider)null, hierarchicalStreamDriver, new ClassLoaderReference(classLoader))); }
Example #17
Source File: XStream.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Constructs an XStream with a special {@link HierarchicalStreamDriver}, * {@link ReflectionProvider}, a prepared {@link Mapper} chain and the {@link ClassLoader} * to use. * * @param reflectionProvider the reflection provider to use or <em>null</em> for best * matching Provider * @param driver the driver instance * @param classLoader the {@link ClassLoader} to use * @param mapper the instance with the {@link Mapper} chain or <em>null</em> for the default * chain * @throws InitializationException in case of an initialization problem * @since 1.3 * @deprecated As of 1.4.5 use * {@link #XStream(ReflectionProvider, HierarchicalStreamDriver, ClassLoaderReference, Mapper)} */ public XStream( ReflectionProvider reflectionProvider, HierarchicalStreamDriver driver, ClassLoader classLoader, Mapper mapper) { this( reflectionProvider, driver, new ClassLoaderReference(classLoader), mapper, new DefaultConverterLookup()); }
Example #18
Source File: XStream.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Constructs an XStream with a special {@link HierarchicalStreamDriver}, * {@link ReflectionProvider}, a prepared {@link Mapper} chain and the * {@link ClassLoaderReference}. * <p> * The {@link ClassLoaderReference} should also be used for the {@link Mapper} chain. * </p> * * @param reflectionProvider the reflection provider to use or <em>null</em> for best * matching Provider * @param driver the driver instance * @param classLoaderReference the reference to the {@link ClassLoader} to use * @param mapper the instance with the {@link Mapper} chain or <em>null</em> for the default * chain * @throws InitializationException in case of an initialization problem * @since 1.4.5 */ public XStream( ReflectionProvider reflectionProvider, HierarchicalStreamDriver driver, ClassLoaderReference classLoaderReference, Mapper mapper) { this( reflectionProvider, driver, classLoaderReference, mapper, new DefaultConverterLookup()); }
Example #19
Source File: XStream.java From lams with GNU General Public License v2.0 | 3 votes |
/** * Constructs an XStream with a special {@link HierarchicalStreamDriver}, * {@link ReflectionProvider}, a prepared {@link Mapper} chain, the * {@link ClassLoaderReference} and an own {@link ConverterLookup} and * {@link ConverterRegistry}. * * @param reflectionProvider the reflection provider to use or <em>null</em> for best * matching Provider * @param driver the driver instance * @param classLoader the {@link ClassLoader} to use * @param mapper the instance with the {@link Mapper} chain or <em>null</em> for the default * chain * @param converterLookup the instance that is used to lookup the converters * @param converterRegistry an instance to manage the converter instances * @throws InitializationException in case of an initialization problem * @since 1.3 * @deprecated As of 1.4.5 use * {@link #XStream(ReflectionProvider, HierarchicalStreamDriver, ClassLoaderReference, Mapper, ConverterLookup, ConverterRegistry)} */ public XStream( ReflectionProvider reflectionProvider, HierarchicalStreamDriver driver, ClassLoader classLoader, Mapper mapper, ConverterLookup converterLookup, ConverterRegistry converterRegistry) { this(reflectionProvider, driver, new ClassLoaderReference(classLoader), mapper, converterLookup, converterRegistry); }
Example #20
Source File: XStreamMarshaller.java From spring-analysis-note with MIT License | 2 votes |
/** * Set a XStream {@link HierarchicalStreamDriver} to be used for readers and writers. * <p>As of Spring 4.0, this stream driver will also be passed to the {@link XStream} * constructor and therefore used by streaming-related native API methods themselves. */ public void setStreamDriver(HierarchicalStreamDriver streamDriver) { this.streamDriver = streamDriver; this.defaultDriver = streamDriver; }
Example #21
Source File: XStreamMarshaller.java From spring4-understanding with Apache License 2.0 | 2 votes |
/** * Set a XStream {@link HierarchicalStreamDriver} to be used for readers and writers. * <p>As of Spring 4.0, this stream driver will also be passed to the {@link XStream} * constructor and therefore used by streaming-related native API methods themselves. */ public void setStreamDriver(HierarchicalStreamDriver streamDriver) { this.streamDriver = streamDriver; this.defaultDriver = streamDriver; }
Example #22
Source File: XStreamer.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Deserialize a self-contained XStream with object from an XML Reader. * * @param driver the implementation to use * @param xml the {@link Reader} providing the XML data * @throws IOException if an error occurs reading from the Reader. * @throws ClassNotFoundException if a class in the XML stream cannot be found * @throws com.thoughtworks.xstream.XStreamException if the object cannot be deserialized * @since 1.2 */ public Object fromXML(final HierarchicalStreamDriver driver, final Reader xml) throws IOException, ClassNotFoundException { return fromXML(driver, xml, PERMISSIONS); }
Example #23
Source File: XStream.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Constructs an XStream with a special {@link HierarchicalStreamDriver}, * {@link ReflectionProvider} and the {@link ClassLoader} to use. * * @throws InitializationException in case of an initialization problem * @since 1.3 * @deprecated As of 1.4.5 use * {@link #XStream(ReflectionProvider, HierarchicalStreamDriver, ClassLoaderReference)} */ public XStream( ReflectionProvider reflectionProvider, HierarchicalStreamDriver driver, ClassLoader classLoader) { this(reflectionProvider, driver, classLoader, null); }
Example #24
Source File: XStream.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Constructs an XStream with a special {@link HierarchicalStreamDriver}, * {@link ReflectionProvider} and a {@link ClassLoaderReference}. * * @param reflectionProvider the reflection provider to use or <em>null</em> for best * matching Provider * @param driver the driver instance * @param classLoaderReference the reference to the {@link ClassLoader} to use * @throws InitializationException in case of an initialization problem * @since 1.4.5 */ public XStream( ReflectionProvider reflectionProvider, HierarchicalStreamDriver driver, ClassLoaderReference classLoaderReference) { this(reflectionProvider, driver, classLoaderReference, null); }
Example #25
Source File: XStream.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Constructs an XStream with a special {@link HierarchicalStreamDriver}, * {@link ReflectionProvider} and a prepared {@link Mapper} chain. * * @param reflectionProvider the reflection provider to use or <em>null</em> for best * matching Provider * @param mapper the instance with the {@link Mapper} chain or <em>null</em> for the default * chain * @param driver the driver instance * @throws InitializationException in case of an initialization problem * @deprecated As of 1.3, use * {@link #XStream(ReflectionProvider, HierarchicalStreamDriver, ClassLoader, Mapper)} * instead */ public XStream( ReflectionProvider reflectionProvider, Mapper mapper, HierarchicalStreamDriver driver) { this(reflectionProvider, driver, new CompositeClassLoader(), mapper); }
Example #26
Source File: XStream.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Constructs an XStream with a special {@link HierarchicalStreamDriver} and * {@link ReflectionProvider}. * * @param reflectionProvider the reflection provider to use or <em>null</em> for best * matching Provider * @param hierarchicalStreamDriver the driver instance * @throws InitializationException in case of an initialization problem */ public XStream( ReflectionProvider reflectionProvider, HierarchicalStreamDriver hierarchicalStreamDriver) { this(reflectionProvider, (Mapper)null, hierarchicalStreamDriver); }
Example #27
Source File: XStream.java From lams with GNU General Public License v2.0 | 2 votes |
/** * Constructs an XStream with a special {@link HierarchicalStreamDriver}. * <p> * The instance will tries to determine the best match for the {@link ReflectionProvider} on * its own. * </p> * * @param hierarchicalStreamDriver the driver instance * @throws InitializationException in case of an initialization problem */ public XStream(HierarchicalStreamDriver hierarchicalStreamDriver) { this(null, (Mapper)null, hierarchicalStreamDriver); }
Example #28
Source File: XStreamMarshaller.java From java-technology-stack with MIT License | 2 votes |
/** * Set a XStream {@link HierarchicalStreamDriver} to be used for readers and writers. * <p>As of Spring 4.0, this stream driver will also be passed to the {@link XStream} * constructor and therefore used by streaming-related native API methods themselves. */ public void setStreamDriver(HierarchicalStreamDriver streamDriver) { this.streamDriver = streamDriver; this.defaultDriver = streamDriver; }