Search in sources :

Example 36 with Promise

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

the class IltProvider method methodWithMultipleArrayParameters.

/*
     * methodWithMultipleArrayParameters
     *
     * return the byte array as int64array
     * return the string list as list of string arrays with 1 element each, where this element
     * refers to the one from input
     */
@Override
public Promise<MethodWithMultipleArrayParametersDeferred> methodWithMultipleArrayParameters(String[] stringArrayArg, Byte[] int8ArrayArg, ExtendedInterfaceEnumerationInTypeCollection[] enumArrayArg, StructWithStringArray[] structWithStringArrayArrayArg) {
    logger.warn("******************************************************");
    logger.warn("* IltProvider.methodWithMultipleArrayParameters called");
    logger.warn("******************************************************");
    MethodWithMultipleArrayParametersDeferred deferred = new MethodWithMultipleArrayParametersDeferred();
    if (!IltUtil.checkStringArray(stringArrayArg)) {
        deferred.reject(new ProviderRuntimeException("methodWithMultipleArrayParameters: invalid stringArrayArg"));
        return new Promise<MethodWithMultipleArrayParametersDeferred>(deferred);
    }
    if (!IltUtil.checkByteArray(int8ArrayArg)) {
        deferred.reject(new ProviderRuntimeException("methodWithMultipleArrayParameters: invalid int8ArrayArg"));
        return new Promise<MethodWithMultipleArrayParametersDeferred>(deferred);
    }
    if (!IltUtil.checkExtendedInterfaceEnumerationInTypeCollectionArray(enumArrayArg)) {
        deferred.reject(new ProviderRuntimeException("methodWithMultipleArrayParameters: invalid enumArrayArg"));
        return new Promise<MethodWithMultipleArrayParametersDeferred>(deferred);
    }
    if (!IltUtil.checkStructWithStringArrayArray(structWithStringArrayArrayArg)) {
        deferred.reject(new ProviderRuntimeException("methodWithMultipleArrayParameters: invalid structWithStringArrayArrayArg"));
        return new Promise<MethodWithMultipleArrayParametersDeferred>(deferred);
    }
    Long[] uInt64ArrayOut = IltUtil.createUInt64Array();
    StructWithStringArray[] structWithStringArrayArrayOut = new StructWithStringArray[2];
    structWithStringArrayArrayOut[0] = IltUtil.createStructWithStringArray();
    structWithStringArrayArrayOut[1] = IltUtil.createStructWithStringArray();
    deferred.resolve(uInt64ArrayOut, structWithStringArrayArrayOut);
    return new Promise<MethodWithMultipleArrayParametersDeferred>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) StructWithStringArray(joynr.interlanguagetest.namedTypeCollection1.StructWithStringArray) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException)

Example 37 with Promise

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

the class IltProvider method setAttributeArrayOfStringImplicit.

@Override
public Promise<DeferredVoid> setAttributeArrayOfStringImplicit(String[] attributeArrayOfStringImplicit) {
    DeferredVoid deferred = new DeferredVoid();
    this.attributeArrayOfStringImplicit = attributeArrayOfStringImplicit;
    attributeArrayOfStringImplicitChanged(attributeArrayOfStringImplicit);
    deferred.resolve();
    return new Promise<DeferredVoid>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) DeferredVoid(io.joynr.provider.DeferredVoid)

Example 38 with Promise

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

the class IltProvider method methodWithoutOutputParameter.

/*
     * methodWithoutOutputParameter
     *
     * can only resolve or reject since there is no output parameter
     */
@Override
public Promise<DeferredVoid> methodWithoutOutputParameter(Boolean booleanArg) {
    logger.warn("*************************************************");
    logger.warn("* IltProvider.methodWithoutOutputParameter called");
    logger.warn("*************************************************");
    DeferredVoid deferred = new DeferredVoid();
    if (booleanArg != false) {
        logger.warn("methodWithoutOutputParameter: invalid argument booleanArg");
        deferred.reject(new ProviderRuntimeException("methodWithoutOutputParameter: received wrong argument"));
        return new Promise<DeferredVoid>(deferred);
    }
    deferred.resolve();
    return new Promise<DeferredVoid>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) DeferredVoid(io.joynr.provider.DeferredVoid) ProviderRuntimeException(joynr.exceptions.ProviderRuntimeException)

Example 39 with Promise

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

the class IltProvider method methodToFireBroadcastWithSingleByteBufferParameter.

/*
     * methodToFireBroadcastWithSingleByteBufferParameter
     */
@Override
public Promise<DeferredVoid> methodToFireBroadcastWithSingleByteBufferParameter(Byte[] byteBufferIn, String[] partitions) {
    logger.info("***********************************************************************");
    logger.info("* IltProvider.methodToFireBroadcastWithSingleByteBufferParameter called");
    logger.info("***********************************************************************");
    DeferredVoid deferred = new DeferredVoid();
    fireBroadcastWithSingleByteBufferParameter(byteBufferIn, partitions);
    deferred.resolve();
    return new Promise<DeferredVoid>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) DeferredVoid(io.joynr.provider.DeferredVoid)

Example 40 with Promise

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

the class IltProvider method methodWithSinglePrimitiveParameters.

/*
     * methodWithSinglePrimitiveParameters
     *
     * returns the integer parameter as string
     */
@Override
public Promise<MethodWithSinglePrimitiveParametersDeferred> methodWithSinglePrimitiveParameters(Short uInt16Arg) {
    logger.warn("********************************************************");
    logger.warn("* IltProvider.methodWithSinglePrimitiveParameters called");
    logger.warn("********************************************************");
    MethodWithSinglePrimitiveParametersDeferred deferred = new MethodWithSinglePrimitiveParametersDeferred();
    // if (Short.toUnsignedInt(uInt16Arg) != 65535) {
    if (uInt16Arg != 32767) {
        logger.warn("methodWithSinglePrimitiveParameters: invalid argument uInt16Arg");
        deferred.reject(new ProviderRuntimeException("methodWithSinglePrimitiveParameters: received wrong argument"));
        return new Promise<MethodWithSinglePrimitiveParametersDeferred>(deferred);
    }
    // send back the input converted to a string
    deferred.resolve(new Integer(Short.toUnsignedInt(uInt16Arg)).toString());
    return new Promise<MethodWithSinglePrimitiveParametersDeferred>(deferred);
}
Also used : Promise(io.joynr.provider.Promise) 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