<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
  ~
  ~ WSO2 Inc. licenses this file to you under the Apache License,
  ~ Version 2.0 (the "License"); you may not use this file except
  ~ in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied. See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->

<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jaxrs="http://cxf.apache.org/jaxrs"
       xmlns="http://www.springframework.org/schema/beans"
       xsi:schemaLocation="
         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
         http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">

    <jaxrs:server id="services" address="/">
        <jaxrs:serviceBeans>
            <ref bean="swaggerResource"/>
        </jaxrs:serviceBeans>
        <jaxrs:providers>
            <ref bean="jsonProvider"/>
            <ref bean="errorHandler"/>
            <ref bean="swaggerWriter"/>
        </jaxrs:providers>
    </jaxrs:server>
    <jaxrs:server id="certificateService" address="/certificates">
        <jaxrs:serviceBeans>
            <ref bean="certificateServiceBean"/>
        </jaxrs:serviceBeans>
        <jaxrs:providers>
            <ref bean="jsonProvider"/>
            <ref bean="errorHandler"/>
        </jaxrs:providers>
    </jaxrs:server>

    <bean id="swaggerWriter" class="io.swagger.jaxrs.listing.SwaggerSerializers"/>
    <bean id="swaggerResource" class="io.swagger.jaxrs.listing.ApiListingResource"/>

    <bean id="swaggerConfig" class="io.swagger.jaxrs.config.BeanConfig">
        <property name="resourcePackage" value="org.wso2.carbon.certificate.mgt.jaxrs"/>
        <property name="version" value="1.0.0"/>
        <property name="host" value="localhost:9443"/>
        <property name="basePath" value="/"/>
        <property name="title" value="Device Management Admin Service API Definitions"/>
        <property name="contact" value="dev@wso2.org"/>
        <property name="license" value="Apache 2.0"/>
        <property name="licenseUrl" value="http://www.apache.org/licenses/LICENSE-2.0.html"/>
        <property name="scan" value="true"/>
    </bean>

    <bean id="certificateServiceBean" class="org.wso2.carbon.certificate.mgt.jaxrs.api.impl.CertificateMgtServiceImpl"/>
    <bean id="jsonProvider" class="org.wso2.carbon.certificate.mgt.jaxrs.api.common.GsonMessageBodyHandler"/>
    <bean id="errorHandler" class="org.wso2.carbon.certificate.mgt.jaxrs.api.common.ErrorHandler"/>

</beans>
