Search in sources :

Example 56 with Promise

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

the class IltProvider method methodWithMultipleEnumParameters.

/*
     * methodWithMultipleEnumParameters
     *
     * return fixed values for now
     */
@Override
public Promise<MethodWithMultipleEnumParametersDeferred> methodWithMultipleEnumParameters(Enumeration enumerationArg, ExtendedTypeCollectionEnumerationInTypeCollection extendedEnumerationArg) {
    logger.warn("*****************************************************");
    logger.warn("* IltProvider.methodWithMultipleEnumParameters called");
    logger.warn("*****************************************************");
    MethodWithMultipleEnumParametersDeferred deferred = new MethodWithMultipleEnumParametersDeferred();
    // check input parameters
    if (enumerationArg != joynr.interlanguagetest.Enumeration.ENUM_0_VALUE_3 || extendedEnumerationArg != ExtendedTypeCollectionEnumerationInTypeCollection.ENUM_2_VALUE_EXTENSION_FOR_TYPECOLLECTION) {
        logger.warn("methodWithMultipleEnumParameters: invalid argument enumerationArg or extendedEnumerationArg");
        deferred.reject(new ProviderRuntimeException("methodWithMultipleEnumParameters: received wrong argument"));
        return new Promise<MethodWithMultipleEnumParametersDeferred>(deferred);
    }
    // prepare output parameters
    ExtendedEnumerationWithPartlyDefinedValues extendedEnumerationOut = ExtendedEnumerationWithPartlyDefinedValues.ENUM_2_VALUE_EXTENSION_FOR_ENUM_WITHOUT_DEFINED_VALUES;
    Enumeration enumerationOut = Enumeration.ENUM_0_VALUE_1;
    deferred.resolve(extendedEnumerationOut, enumerationOut);
    return new Promise<MethodWithMultipleEnumParametersDeferred>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) Enumeration(joynr.interlanguagetest.Enumeration) ExtendedExtendedEnumeration(joynr.interlanguagetest.namedTypeCollection2.ExtendedExtendedEnumeration) ExtendedEnumerationWithPartlyDefinedValues(joynr.interlanguagetest.namedTypeCollection2.ExtendedEnumerationWithPartlyDefinedValues) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException)

Example 57 with Promise

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

the class IltProvider method methodWithExistingErrorEnum.

/*
     * methodWithExistingErrorEnum
     */
@Override
public Promise<MethodWithExistingErrorEnumDeferred> methodWithExistingErrorEnum(String wantedExceptionArg) {
    logger.warn("************************************************");
    logger.warn("* IltProvider.methodWithExistingErrorEnum called");
    logger.warn("************************************************");
    MethodWithExistingErrorEnumDeferred deferred = new MethodWithExistingErrorEnumDeferred();
    if (wantedExceptionArg.equals("ProviderRuntimeException")) {
        deferred.reject(new ProviderRuntimeException("Exception from methodWithExistingErrorEnum"));
    } else if (wantedExceptionArg.equals("ApplicationException_1")) {
        deferred.reject(ExtendedErrorEnumTc.ERROR_2_3_TC2);
    } else if (wantedExceptionArg.equals("ApplicationException_2")) {
        deferred.reject(ExtendedErrorEnumTc.ERROR_1_2_TC_2);
    } else {
        deferred.resolve();
    }
    return new Promise<MethodWithExistingErrorEnumDeferred>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException)

Example 58 with Promise

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

the class IltProvider method methodToFireBroadcastWithSinglePrimitiveParameter.

/*
     * methodToFireBroadcastWithSinglePrimitiveParameter
     */
@Override
public Promise<DeferredVoid> methodToFireBroadcastWithSinglePrimitiveParameter(String[] partitions) {
    logger.warn("**********************************************************************");
    logger.warn("* IltProvider.methodToFireBroadcastWithSinglePrimitiveParameter called");
    logger.warn("**********************************************************************");
    DeferredVoid deferred = new DeferredVoid();
    String stringOut = "boom";
    fireBroadcastWithSinglePrimitiveParameter(stringOut, partitions);
    deferred.resolve();
    return new Promise<DeferredVoid>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) MapStringString(joynr.interlanguagetest.namedTypeCollection2.MapStringString) DeferredVoid(io.joynr.provider.DeferredVoid)

Example 59 with Promise

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

the class IltProvider method setAttributeBaseStruct.

@Override
public Promise<DeferredVoid> setAttributeBaseStruct(BaseStruct attributeBaseStruct) {
    DeferredVoid deferred = new DeferredVoid();
    this.attributeBaseStruct = attributeBaseStruct;
    attributeBaseStructChanged(attributeBaseStruct);
    deferred.resolve();
    return new Promise<DeferredVoid>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) DeferredVoid(io.joynr.provider.DeferredVoid)

Example 60 with Promise

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

the class IltProvider method methodWithoutParameters.

/*
     * methodWithoutParameters
     *
     * no output possible, but may reject instead
     */
@Override
public Promise<DeferredVoid> methodWithoutParameters() {
    logger.warn("*******************************************");
    logger.warn("* IltProvider.methodWithoutParameters called");
    logger.warn("*******************************************");
    DeferredVoid deferred = new DeferredVoid();
    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