Example usage for org.springframework.oxm.jaxb Jaxb2Marshaller Jaxb2Marshaller

List of usage examples for org.springframework.oxm.jaxb Jaxb2Marshaller Jaxb2Marshaller

Introduction

In this page you can find the example usage for org.springframework.oxm.jaxb Jaxb2Marshaller Jaxb2Marshaller.

Prototype

Jaxb2Marshaller

Source Link

Usage

From source file:dk.nsi.minlog.ws.config.WSConfig.java

@Bean(name = { "serviceMarshaller", "serviceUnmarshaller" })
@Primary//from  w w w.  java 2s  . c om
public Jaxb2Marshaller serviceMarshaller() {
    final Jaxb2Marshaller bean = new Jaxb2Marshaller();
    bean.setContextPaths("dk.nsi.minlog._2012._05._24", "dk.medcom.dgws._2006._04.dgws_1_0",
            "org.oasis_open.docs.wss._2004._01.oasis_200401_wss_wssecurity_secext_1_0",
            "org.oasis_open.docs.wss._2004._01.oasis_200401_wss_wssecurity_utility_1_0",
            "org.w3._2000._09.xmldsig", "oasis.names.tc.saml._2_0.assertion");
    return bean;
}

From source file:org.muhia.app.psi.integ.config.ke.obopay.ObopayBulkApiClientConfiguration.java

@Bean(name = "obopayBulkApiUnmarshaller")
public Jaxb2Marshaller unmarshaller() {
    Jaxb2Marshaller unmarshaller = new Jaxb2Marshaller();
    unmarshaller.setPackagesToScan(properties.getBulkpaymentUnmarshallerPackagesToscan().split(","));
    return unmarshaller;
}

From source file:dk.nsi.minlog.ws.config.WSConfig.java

@Bean(name = { "nspMarshaller", "nspUnmarshaller" })
public Jaxb2Marshaller nspMarshaller() {
    final Jaxb2Marshaller bean = new Jaxb2Marshaller();
    bean.setContextPath("dk.nsi.minlog._2012._05._24");
    return bean;//from w w w.j  a  v a  2s. c  o  m
}

From source file:com.zergiu.tvman.jobs.TestTVRageShowLoader.java

/**
 * @param string/*from w  ww.  jav  a 2  s .  com*/
 * @return
 */
private TVRageShowLoaderJob createShowLoader(final String resourcePath) {
    showLoader = new TVRageShowLoaderJob() {

        /* (non-Javadoc)
         * @see com.zergiu.tvman.shows.tvrage.TVRageShowLoaderJob#getShow(org.quartz.JobExecutionContext)
         */
        @Override
        protected TVShow getShow(JobExecutionContext context) {
            return show;
        }

        /* (non-Javadoc)
         * @see com.zergiu.tvman.shows.tvrage.TVRageShowLoaderJob#getShowDataStream(java.lang.String)
         */
        @Override
        protected InputStream getShowDataStream(String urlString) throws IOException {
            return TestTVRageShowLoader.class.getResourceAsStream(resourcePath);
        }

        @Override
        protected Unmarshaller getUnmarshaller() {
            Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
            marshaller.setPackagesToScan(new String[] { "com.zergiu.tvman.shows.tvrage.entities" });

            return marshaller;
        }

    };
    return showLoader;
}

From source file:com.neiljbrown.brighttalk.channels.reportingapi.client.spring.AppConfig.java

/**
 * Creates and configures a {@link Marshaller} to be used for both marshalling and unmarshalling HTTP request and
 * response bodies.//from   w  w w.  j  ava  2 s .  c o m
 * <p>
 * The created Marshaller is configured with a custom JAXB {@link javax.xml.bind.ValidationEventHandler} which
 * supports logging not fatal validation errors that occur on unmarshalling, and optionally classifying them as fatal
 * errors depending on the class of causal ('linked') exception.
 * 
 * @return The created {@link Marshaller}.
 */
@Bean
public Marshaller marshaller() {
    Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
    CustomValidationEventHandler eventHandler = new CustomValidationEventHandler();
    eventHandler.setFatalLinkedExceptions(this.marshallingErrorFatalExceptions);
    jaxb2Marshaller.setValidationEventHandler(eventHandler);
    Package apiResourcesRootPackage = ChannelResource.class.getPackage();
    jaxb2Marshaller.setPackagesToScan(new String[] { apiResourcesRootPackage.getName() });
    return jaxb2Marshaller;
}

From source file:py.una.pol.karaku.configuration.KarakuWSClientConfiguration.java

/**
 * Crea un nuevo marhsaller./*w  w w  .  j  av a2 s .c  om*/
 * 
 * @param packagesFound
 *            lista de paquetes.
 * @return
 */
private Jaxb2Marshaller instanciateMarshaller(List<String> packagesFound) {

    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    String[] packages = packagesFound.toArray(new String[0]);
    log.info("Add packages to the marshaller {}: ", new Object[] { packages });
    marshaller.setPackagesToScan(packages);
    return marshaller;
}

From source file:org.wallerlab.yoink.config.BatchConfig.java

/**
 *  Standard Spring Batch item reader for JAXB
 *  //from w ww.  ja  va2 s  .  c  om
 * @return  JAXB reader bean -{@link org.springframework.oxm.jaxb.Jaxb2Marshaller}
 */
@Bean
org.springframework.oxm.Unmarshaller unmarshaller() {
    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setClassesToBeBound(Cml.class);
    return (Unmarshaller) marshaller;
}

From source file:io.gabbm.ticket_office.api.connector.RestConnector.java

/**
 * Method to get the marshaller defined for mapping XML REST Response and
 * their Java Objects/*  ww w. j av a 2s . c  o m*/
 * 
 * @return
 */
public Jaxb2Marshaller getJaxb2Marshaller() {
    Jaxb2Marshaller jaxbMarshallerCamel = null;

    try {
        jaxbMarshallerCamel = new Jaxb2Marshaller();
        jaxbMarshallerCamel.setContextPath(configurationService.getRestJaxbPath());
    } catch (Exception e) {
        log.error(e.getMessage(), e);
    }

    return jaxbMarshallerCamel;
}

From source file:edu.unc.lib.dl.fedora.AccessClient.java

/**
 * Initializes this client bean, calling the initializers of dependencies.
 *
 * @throws Exception/*  ww  w . j  a va2s  . c o  m*/
 *            when initialization fails
 */
public void init() throws Exception {
    SaajSoapMessageFactory msgFactory = new SaajSoapMessageFactory();
    msgFactory.afterPropertiesSet();
    this.setMessageFactory(msgFactory);

    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setContextPath("edu.unc.lib.dl.fedora.types");
    marshaller.afterPropertiesSet();
    this.setMarshaller(marshaller);
    this.setUnmarshaller(marshaller);

    CommonsHttpMessageSender messageSender = new CommonsHttpMessageSender();
    UsernamePasswordCredentials creds = new UsernamePasswordCredentials(this.username, this.password);
    messageSender.setCredentials(creds);
    messageSender.afterPropertiesSet();
    this.setMessageSender(messageSender);

    // this.setFaultMessageResolver(new FedoraFaultMessageResolver());
    this.setDefaultUri(this.getFedoraContextUrl() + "/services/access");
    this.afterPropertiesSet();
}

From source file:edu.unc.lib.dl.fedora.ManagementClient.java

private void initializeConnections() throws Exception {
    SaajSoapMessageFactory msgFactory = new SaajSoapMessageFactory();
    msgFactory.afterPropertiesSet();//from   w  w w.  j a  v a 2s  . com
    this.setMessageFactory(msgFactory);

    Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
    marshaller.setContextPath("edu.unc.lib.dl.fedora.types");
    marshaller.afterPropertiesSet();
    this.setMarshaller(marshaller);
    this.setUnmarshaller(marshaller);

    CommonsHttpMessageSender messageSender = new CommonsHttpMessageSender();
    UsernamePasswordCredentials creds = new UsernamePasswordCredentials(this.getUsername(), this.getPassword());
    messageSender.setCredentials(creds);
    messageSender.setReadTimeout(300 * 1000);
    messageSender.afterPropertiesSet();
    this.setMessageSender(messageSender);

    // this.setFaultMessageResolver(new FedoraFaultMessageResolver());
    this.setDefaultUri(this.getFedoraContextUrl() + "/services/management");
    this.afterPropertiesSet();

    this.httpClient = HttpClientUtil.getAuthenticatedClient(this.getFedoraContextUrl(), this.getUsername(),
            this.getPassword(), this.httpManager);
}