Search in sources :

Example 1 with Persister

use of org.simpleframework.xml.core.Persister in project retrofit by square.

the class SimpleXmlConverterFactoryTest method setUp.

@Before
public void setUp() {
    Format format = new Format(0, null, new HyphenStyle(), Verbosity.HIGH);
    Persister persister = new Persister(format);
    Retrofit retrofit = new Retrofit.Builder().baseUrl(server.url("/")).addConverterFactory(SimpleXmlConverterFactory.create(persister)).build();
    service = retrofit.create(Service.class);
}
Also used : Retrofit(retrofit2.Retrofit) Format(org.simpleframework.xml.stream.Format) HyphenStyle(org.simpleframework.xml.stream.HyphenStyle) Persister(org.simpleframework.xml.core.Persister) Before(org.junit.Before)

Example 2 with Persister

use of org.simpleframework.xml.core.Persister in project syncany by syncany.

the class TestCliUtil method fixMachineName.

private static void fixMachineName(Map<String, String> client) throws Exception {
    File configFile = new File(client.get("localdir") + "/" + Config.DIR_APPLICATION + "/" + Config.FILE_CONFIG);
    Serializer serializer = new Persister();
    ConfigTO configTO = serializer.read(ConfigTO.class, configFile);
    configTO.setMachineName(client.get("machinename"));
    serializer.write(configTO, configFile);
}
Also used : Persister(org.simpleframework.xml.core.Persister) ConfigTO(org.syncany.config.to.ConfigTO) File(java.io.File) Serializer(org.simpleframework.xml.Serializer)

Example 3 with Persister

use of org.simpleframework.xml.core.Persister in project osm-contributor by jawg.

the class CommonSyncModule method getPersister.

@Provides
Persister getPersister() {
    RegistryMatcher matchers = new RegistryMatcher();
    matchers.bind(org.joda.time.DateTime.class, JodaTimeDateTimeTransform.class);
    Strategy strategy = new AnnotationStrategy();
    return new Persister(strategy, matchers);
}
Also used : AnnotationStrategy(org.simpleframework.xml.convert.AnnotationStrategy) AnnotationStrategy(org.simpleframework.xml.convert.AnnotationStrategy) Strategy(org.simpleframework.xml.strategy.Strategy) RegistryMatcher(org.simpleframework.xml.transform.RegistryMatcher) Persister(org.simpleframework.xml.core.Persister) Provides(dagger.Provides)

Example 4 with Persister

use of org.simpleframework.xml.core.Persister in project openmeetings by apache.

the class BackupExport method exportRoomGroup.

/*
	 * ##################### Backup Room Groups
	 */
private void exportRoomGroup(ZipOutputStream zos, ProgressHolder progressHolder) throws Exception {
    Registry registry = new Registry();
    Strategy strategy = new RegistryStrategy(registry);
    Serializer serializer = new Persister(strategy);
    registry.bind(Group.class, GroupConverter.class);
    registry.bind(Room.class, RoomConverter.class);
    writeList(serializer, zos, "rooms_organisation.xml", "room_organisations", roomDao.getGroups());
    progressHolder.setProgress(17);
}
Also used : RegistryStrategy(org.simpleframework.xml.convert.RegistryStrategy) Strategy(org.simpleframework.xml.strategy.Strategy) RegistryStrategy(org.simpleframework.xml.convert.RegistryStrategy) Registry(org.simpleframework.xml.convert.Registry) Persister(org.simpleframework.xml.core.Persister) Serializer(org.simpleframework.xml.Serializer)

Example 5 with Persister

use of org.simpleframework.xml.core.Persister in project openmeetings by apache.

the class BackupExport method exportContacts.

/*
	 * ##################### User Contacts
	 */
private void exportContacts(ZipOutputStream zos, ProgressHolder progressHolder) throws Exception {
    Registry registry = new Registry();
    Strategy strategy = new RegistryStrategy(registry);
    Serializer serializer = new Persister(strategy);
    registry.bind(User.class, UserConverter.class);
    writeList(serializer, zos, "userContacts.xml", "usercontacts", userContactDao.get());
    progressHolder.setProgress(60);
}
Also used : RegistryStrategy(org.simpleframework.xml.convert.RegistryStrategy) Strategy(org.simpleframework.xml.strategy.Strategy) RegistryStrategy(org.simpleframework.xml.convert.RegistryStrategy) Registry(org.simpleframework.xml.convert.Registry) Persister(org.simpleframework.xml.core.Persister) Serializer(org.simpleframework.xml.Serializer)

Aggregations

Persister (org.simpleframework.xml.core.Persister)124 Serializer (org.simpleframework.xml.Serializer)97 StringWriter (java.io.StringWriter)36 Registry (org.simpleframework.xml.convert.Registry)34 RegistryStrategy (org.simpleframework.xml.convert.RegistryStrategy)34 Strategy (org.simpleframework.xml.strategy.Strategy)34 Writer (java.io.Writer)33 File (java.io.File)14 Test (org.junit.Test)12 UserConverter (org.apache.openmeetings.backup.converter.UserConverter)9 RegistryMatcher (org.simpleframework.xml.transform.RegistryMatcher)9 StorageException (org.syncany.plugins.transfer.StorageException)8 IOException (java.io.IOException)7 RoomConverter (org.apache.openmeetings.backup.converter.RoomConverter)5 AnnotationStrategy (org.simpleframework.xml.convert.AnnotationStrategy)5 ConfigTO (org.syncany.config.to.ConfigTO)5 UnreliableLocalTransferSettings (org.syncany.plugins.unreliable_local.UnreliableLocalTransferSettings)5 FileOutputStream (java.io.FileOutputStream)4 ConfigException (org.syncany.config.ConfigException)4 MultichunkRemoteFile (org.syncany.plugins.transfer.files.MultichunkRemoteFile)4