<?xml version="1.0"?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one or more
    contributor license agreements.  See the NOTICE file distributed with
    this work for additional information regarding copyright ownership.
    The ASF 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="http://www.springframework.org/schema/beans"
       xmlns:util="http://www.springframework.org/schema/util"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:http="http://servicemix.apache.org/http/1.0"
       xmlns:ctx="http://www.springframework.org/schema/context"
       xmlns:osgi="http://www.springframework.org/schema/osgi"
       xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
       xmlns:wsn="http://servicemix.org/wsnotification"
       xsi:schemaLocation="
         http://www.springframework.org/schema/beans             http://www.springframework.org/schema/beans/spring-beans.xsd
         http://www.springframework.org/schema/context           http://www.springframework.org/schema/context/spring-context.xsd
         http://www.springframework.org/schema/util              http://www.springframework.org/schema/util/spring-util.xsd
         http://www.springframework.org/schema/osgi              http://www.springframework.org/schema/osgi/spring-osgi.xsd
         http://www.springframework.org/schema/osgi-compendium   http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
         http://servicemix.apache.org/http/1.0                   http://servicemix.apache.org/http/1.0/servicemix-http.xsd">

    <http:endpoint service="wsn:NotificationBroker"
                 endpoint="http-binding"
                 targetService="wsn:NotificationBroker"
                 targetEndpoint="Broker"
                 role="consumer"
                 locationURI="${baseUrl}/Broker/"
                 defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
                 soap="true"/>

  <http:endpoint service="wsn:CreatePullPoint"
                 endpoint="http-binding2"
                 targetService="wsn:CreatePullPoint"
                 targetEndpoint="Broker"
                 role="consumer"
                 locationURI="${baseUrl}/CreatePullPoint/"
                 defaultMep="http://www.w3.org/2004/08/wsdl/in-out"
                 soap="true"/>

    <!-- Export this service assembly to the OSGi registry -->
    <bean class="org.apache.servicemix.common.osgi.EndpointExporter" />
    
    <!-- The target endpoints for this Service Assembly are defined outside the scope of this SA.
         To make sure the SA is not create before those endpoints are available, we add
         two dependencies at spring-dm level on the required endpoints.
      -->
    <osgi:reference id="notificationBrokerEndpoint" 
                    interface="org.apache.servicemix.nmr.api.Endpoint" 
                    filter="(&amp;(jbi.internal=true)(SERVICE_NAME={http://servicemix.org/wsnotification}NotificationBroker))" />
    <osgi:reference id="createPullpointEndpoint" 
                    interface="org.apache.servicemix.nmr.api.Endpoint" 
                    filter="(&amp;(jbi.internal=true)(SERVICE_NAME={http://servicemix.org/wsnotification}CreatePullPoint))" />

    <!-- Expose some properties using the OSGi Configuration Admin service.
         The values specified here is the default value which can be overriden
         by feeding the configuration admin service with the needed configuration.
         This can be done by creating a file named etc/org.apache.servicemix.examples.wsn.cfg
         containing the property below. -->
    <osgix:cm-properties id="wsnProps" persistent-id="org.apache.servicemix.examples.wsn">
        <prop key="baseUrl">http://0.0.0.0:8192/wsn</prop>
    </osgix:cm-properties>
    <ctx:property-placeholder properties-ref="wsnProps" />

</beans>
