Search in sources :

Example 26 with Promise

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

the class IltProvider method setAttributeEnumeration.

@Override
public Promise<DeferredVoid> setAttributeEnumeration(Enumeration attributeEnumeration) {
    DeferredVoid deferred = new DeferredVoid();
    this.attributeEnumeration = attributeEnumeration;
    attributeEnumerationChanged(attributeEnumeration);
    deferred.resolve();
    return new Promise<DeferredVoid>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) DeferredVoid(io.joynr.provider.DeferredVoid)

Example 27 with Promise

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

the class IltProvider method overloadedMethod.

/*
     * overloadedMethod (2)
     */
@Override
public Promise<OverloadedMethod1Deferred> overloadedMethod(Boolean booleanArg) {
    logger.warn("*****************************************");
    logger.warn("* IltProvider.overloadedMethod called (2)");
    logger.warn("*****************************************");
    OverloadedMethod1Deferred deferred = new OverloadedMethod1Deferred();
    if (booleanArg != false) {
        logger.warn("overloadedMethod_2: invalid argument booleanArg");
        deferred.reject(new ProviderRuntimeException("overloadedMethod_2: invalid parameter baseStructArg"));
        return new Promise<OverloadedMethod1Deferred>(deferred);
    }
    String stringOut = "TestString 2";
    deferred.resolve(stringOut);
    return new Promise<OverloadedMethod1Deferred>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) MapStringString(joynr.interlanguagetest.namedTypeCollection2.MapStringString) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException)

Example 28 with Promise

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

the class IltProvider method getAttributeWithExceptionFromGetter.

@Override
public Promise<Deferred<Boolean>> getAttributeWithExceptionFromGetter() {
    Deferred<Boolean> deferred = new Deferred<Boolean>();
    deferred.reject(new ProviderRuntimeException("Exception from getAttributeWithExceptionFromGetter"));
    return new Promise<Deferred<Boolean>>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) Deferred(io.joynr.provider.Deferred) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException)

Example 29 with Promise

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

the class IltProvider method overloadedMethod.

/*
     * overloadedMethod (3)
     */
@Override
public Promise<OverloadedMethod2Deferred> overloadedMethod(ExtendedExtendedEnumeration[] enumArrayArg, Long int64Arg, BaseStruct baseStructArg, Boolean booleanArg) {
    logger.warn("*****************************************");
    logger.warn("* IltProvider.overloadedMethod called (3)");
    logger.warn("*****************************************");
    OverloadedMethod2Deferred deferred = new OverloadedMethod2Deferred();
    // check input parameter
    if (int64Arg != 1L || booleanArg != false) {
        logger.warn("overloadedMethod_3: invalid argument int64Arg or booleanArg");
        deferred.reject(new ProviderRuntimeException("overloadedMethod_3: invalid parameter int64Arg or booleanArg"));
        return new Promise<OverloadedMethod2Deferred>(deferred);
    }
    // check enumArrayArg
    if (!IltUtil.checkExtendedExtendedEnumerationArray(enumArrayArg)) {
        deferred.reject(new ProviderRuntimeException("overloadedMethod_3: invalid parameter enumArrayArg"));
        return new Promise<OverloadedMethod2Deferred>(deferred);
    }
    // check baseStructArg
    if (!IltUtil.checkBaseStruct(baseStructArg)) {
        logger.warn("overloadedMethod_3: invalid argument baseStructArg");
        deferred.reject(new ProviderRuntimeException("overloadedMethod_3: invalid parameter baseStructArg"));
        return new Promise<OverloadedMethod2Deferred>(deferred);
    }
    // setup output parameter
    Double doubleOut = 0d;
    String[] stringArrayOut = IltUtil.createStringArray();
    ExtendedBaseStruct extendedBaseStructOut = IltUtil.createExtendedBaseStruct();
    deferred.resolve(doubleOut, stringArrayOut, extendedBaseStructOut);
    return new Promise<OverloadedMethod2Deferred>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) ExtendedExtendedBaseStruct(joynr.interlanguagetest.namedTypeCollection2.ExtendedExtendedBaseStruct) ExtendedBaseStruct(joynr.interlanguagetest.namedTypeCollection2.ExtendedBaseStruct) MapStringString(joynr.interlanguagetest.namedTypeCollection2.MapStringString) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException)

Example 30 with Promise

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

the class IltProvider method methodWithSingleEnumParameters.

/*
     * methodWithSingleEnumParameters
     *
     * return fixed value for now
     */
@Override
public Promise<MethodWithSingleEnumParametersDeferred> methodWithSingleEnumParameters(ExtendedEnumerationWithPartlyDefinedValues enumerationArg) {
    logger.warn("***************************************************");
    logger.warn("* IltProvider.methodWithSingleEnumParameters called");
    logger.warn("***************************************************");
    MethodWithSingleEnumParametersDeferred deferred = new MethodWithSingleEnumParametersDeferred();
    // check input parameter
    if (enumerationArg != ExtendedEnumerationWithPartlyDefinedValues.ENUM_2_VALUE_EXTENSION_FOR_ENUM_WITHOUT_DEFINED_VALUES) {
        logger.warn("methodWithSingleEnumParameters: invalid argument enumerationArg");
        deferred.reject(new ProviderRuntimeException("methodWithSingleEnumParameters: received wrong argument"));
        return new Promise<MethodWithSingleEnumParametersDeferred>(deferred);
    }
    // prepare output parameter
    ExtendedTypeCollectionEnumerationInTypeCollection enumerationOut = ExtendedTypeCollectionEnumerationInTypeCollection.ENUM_2_VALUE_EXTENSION_FOR_TYPECOLLECTION;
    deferred.resolve(enumerationOut);
    return new Promise<MethodWithSingleEnumParametersDeferred>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) ExtendedTypeCollectionEnumerationInTypeCollection(joynr.interlanguagetest.namedTypeCollection2.ExtendedTypeCollectionEnumerationInTypeCollection) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException)

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