Search in sources :

Example 21 with Promise

use of io.joynr.provider.Promise in project joynr by bmwcarit.

the class DummyCapabilitiesDirectory method remove.

@Override
public Promise<DeferredVoid> remove(String participantId) {
    DeferredVoid deferred = new DeferredVoid();
    logger.info("!!!!!!!!!!!!!!!removeCapabilities");
    deferred.resolve();
    return new Promise<DeferredVoid>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) DeferredVoid(io.joynr.provider.DeferredVoid)

Example 22 with Promise

use of io.joynr.provider.Promise in project joynr by bmwcarit.

the class DummyCapabilitiesDirectory method add.

@Override
public Promise<DeferredVoid> add(DiscoveryEntry discoveryEntry) {
    DeferredVoid deferred = new DeferredVoid();
    registeredCapabilities.add(CapabilityUtils.convertToDiscoveryEntryWithMetaInfo(true, discoveryEntry));
    notifyCapabilityAdded(discoveryEntry);
    deferred.resolve();
    return new Promise<DeferredVoid>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) DeferredVoid(io.joynr.provider.DeferredVoid)

Example 23 with Promise

use of io.joynr.provider.Promise in project joynr by bmwcarit.

the class IltProvider method methodWithMultipleStructParameters.

/*
     * methodWithMultipleStructParameters
     */
@Override
public Promise<MethodWithMultipleStructParametersDeferred> methodWithMultipleStructParameters(ExtendedStructOfPrimitives extendedStructOfPrimitivesArg, BaseStruct baseStructArg) {
    MethodWithMultipleStructParametersDeferred deferred = new MethodWithMultipleStructParametersDeferred();
    logger.warn("*******************************************************");
    logger.warn("* IltProvider.methodWithMultipleStructParameters called");
    logger.warn("*******************************************************");
    // check input parameter
    if (!IltUtil.checkExtendedStructOfPrimitives(extendedStructOfPrimitivesArg)) {
        deferred.reject(new ProviderRuntimeException("methodWithMultipleStructParameters: invalid parameter extendedStructOfPrimitivesArg"));
        return new Promise<MethodWithMultipleStructParametersDeferred>(deferred);
    }
    if (!IltUtil.checkBaseStruct(baseStructArg)) {
        deferred.reject(new ProviderRuntimeException("methodWithMultipleStructParameters: invalid parameter baseStructArg"));
        return new Promise<MethodWithMultipleStructParametersDeferred>(deferred);
    }
    // set output values
    BaseStructWithoutElements baseStructWithoutElementsOut = IltUtil.createBaseStructWithoutElements();
    ExtendedExtendedBaseStruct extendedExtendedBaseStructOut = IltUtil.createExtendedExtendedBaseStruct();
    deferred.resolve(baseStructWithoutElementsOut, extendedExtendedBaseStructOut);
    return new Promise<MethodWithMultipleStructParametersDeferred>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) ExtendedExtendedBaseStruct(joynr.interlanguagetest.namedTypeCollection2.ExtendedExtendedBaseStruct) BaseStructWithoutElements(joynr.interlanguagetest.namedTypeCollection2.BaseStructWithoutElements) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException)

Example 24 with Promise

use of io.joynr.provider.Promise in project joynr by bmwcarit.

the class IltProvider method methodWithSingleMapParameters.

@Override
public Promise<MethodWithSingleMapParametersDeferred> methodWithSingleMapParameters(MapStringString mapArg) {
    MethodWithSingleMapParametersDeferred deferred = new MethodWithSingleMapParametersDeferred();
    if (mapArg == null) {
        deferred.resolve(null);
    } else {
        MapStringString mapOut = new MapStringString();
        Iterator<Map.Entry<String, String>> iterator = mapArg.entrySet().iterator();
        while (iterator.hasNext()) {
            Map.Entry<String, String> entry = (Entry<String, String>) iterator.next();
            mapOut.put(entry.getValue(), entry.getKey());
        }
        deferred.resolve(mapOut);
    }
    return new Promise<MethodWithSingleMapParametersDeferred>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) Entry(java.util.Map.Entry) MapStringString(joynr.interlanguagetest.namedTypeCollection2.MapStringString) MapStringString(joynr.interlanguagetest.namedTypeCollection2.MapStringString) Map(java.util.Map)

Example 25 with Promise

use of io.joynr.provider.Promise in project joynr by bmwcarit.

the class IltProvider method setAttributeByteBuffer.

@Override
public Promise<DeferredVoid> setAttributeByteBuffer(Byte[] attributeByteBuffer) {
    DeferredVoid deferred = new DeferredVoid();
    this.attributeByteBuffer = attributeByteBuffer;
    attributeByteBufferChanged(attributeByteBuffer);
    deferred.resolve();
    return new Promise<DeferredVoid>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) DeferredVoid(io.joynr.provider.DeferredVoid)

Aggregations

Promise (io.joynr.provider.Promise)79 DeferredVoid (io.joynr.provider.DeferredVoid)36 ProviderRuntimeException (joynr.exceptions.ProviderRuntimeException)27 MapStringString (joynr.interlanguagetest.namedTypeCollection2.MapStringString)13 Method (java.lang.reflect.Method)9 ProviderWrapper (io.joynr.jeeintegration.ProviderWrapper)6 JoynrProvider (io.joynr.provider.JoynrProvider)6 Test (org.junit.Test)6 JoynrException (io.joynr.exceptions.JoynrException)5 Deferred (io.joynr.provider.Deferred)4 PromiseListener (io.joynr.provider.PromiseListener)4 ExtendedExtendedBaseStruct (joynr.interlanguagetest.namedTypeCollection2.ExtendedExtendedBaseStruct)4 GlobalDiscoveryEntry (joynr.types.GlobalDiscoveryEntry)4 StructWithStringArray (joynr.interlanguagetest.namedTypeCollection1.StructWithStringArray)3 ExtendedTypeCollectionEnumerationInTypeCollection (joynr.interlanguagetest.namedTypeCollection2.ExtendedTypeCollectionEnumerationInTypeCollection)3 DiscoveryEntry (joynr.types.DiscoveryEntry)3 DiscoveryEntryWithMetaInfo (joynr.types.DiscoveryEntryWithMetaInfo)3 DiscoveryQos (io.joynr.arbitration.DiscoveryQos)2 DiscoveryScope (io.joynr.arbitration.DiscoveryScope)2 ProviderContainer (io.joynr.provider.ProviderContainer)2