/*
 * 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.
 */

package org.apache.aries.component.dsl.internal;

import org.apache.aries.component.dsl.OSGiRunnable;
import org.apache.aries.component.dsl.Publisher;
import org.osgi.framework.BundleContext;

/**
 * @author Carlos Sierra Andrés
 */
public class ProbeImpl<T> extends OSGiImpl<T> {

    public ProbeImpl() {
        super(new ProbeOperationImpl<>());
    }

    public Publisher<? super T> getPublisher() {
        return ((ProbeOperationImpl<T>) _operation)._op;
    }

    private static class ProbeOperationImpl<T> implements OSGiRunnable<T> {

        @Override
        public OSGiResultImpl run(
            BundleContext bundleContext, Publisher<? super T> op) {
            _bundleContext = bundleContext;
            _op = op;

            return new OSGiResultImpl(NOOP);
        }
        BundleContext _bundleContext;
        Publisher<? super T> _op;
    }

}

@@ -847,16 +847,66 @@
 ernal;%0A%0A
+import org.apache.aries.component.dsl.OSGiResult;%0A
 import o
@@ -949,16 +949,16 @@
 nnable;%0A
-
 import o
@@ -1390,24 +1390,69 @@
 nable%3CT%3E %7B%0A%0A
+        private OSGiResult _onClose = NOOP;%0A%0A
         @Ove
@@ -1665,20 +1665,75 @@
 ultImpl(
+%0A                () -%3E %7B_onClose.close(); _onClose = 
 NOOP
+;%7D
 );%0A     
@@ -1737,16 +1737,17 @@
       %7D%0A
+%0A
         
@@ -1768,32 +1768,33 @@
 _bundleContext;%0A
+%0A
         Publishe
@@ -1818,10 +1818,127 @@
 %0A    %7D%0A%0A
+    public void onClose(OSGiResult onClose) %7B%0A        ((ProbeOperationImpl%3CT%3E) _operation)._onClose = onClose;%0A    %7D%0A
 %7D%0A

Improve ProbleImpl