Search in sources :

Example 1 with MediaType

use of org.mule.runtime.extension.api.annotation.param.MediaType in project mule by mulesoft.

the class HeisenbergOperations method getEnemy.

@MediaType(TEXT_PLAIN)
public Result<String, IntegerAttributes> getEnemy(@Config HeisenbergExtension config, @Optional(defaultValue = "0") int index) {
    Charset lastSupportedEncoding = Charset.availableCharsets().values().stream().reduce((first, last) -> last).get();
    org.mule.runtime.api.metadata.DataType dt = DataType.builder().type(String.class).mediaType("dead/dead").charset(lastSupportedEncoding.toString()).build();
    return Result.<String, IntegerAttributes>builder().output(config.getEnemies().get(index)).mediaType(dt.getMediaType()).attributes(new IntegerAttributes(index)).build();
}
Also used : TEXT_PLAIN(org.mule.runtime.extension.api.annotation.param.MediaType.TEXT_PLAIN) KillingStereotype(org.mule.test.heisenberg.extension.stereotypes.KillingStereotype) ByteArrayInputStream(java.io.ByteArrayInputStream) BarberPreferences(org.mule.test.heisenberg.extension.model.BarberPreferences) KNOCKING_DOOR(org.mule.test.heisenberg.extension.HeisenbergNotificationAction.KNOCKING_DOOR) Map(java.util.Map) DisplayName(org.mule.runtime.extension.api.annotation.param.display.DisplayName) OnException(org.mule.runtime.extension.api.annotation.OnException) HEISENBERG(org.mule.test.heisenberg.extension.HeisenbergExtension.HEISENBERG) OperationParameters(org.mule.runtime.extension.api.client.OperationParameters) HealthException(org.mule.test.heisenberg.extension.exception.HealthException) Execution(org.mule.runtime.extension.api.annotation.execution.Execution) Weapon(org.mule.test.heisenberg.extension.model.Weapon) ObjectStore(org.mule.runtime.api.store.ObjectStore) HeisenbergException(org.mule.test.heisenberg.extension.exception.HeisenbergException) ImmutableMap(com.google.common.collect.ImmutableMap) Connection(org.mule.runtime.extension.api.annotation.param.Connection) EmpireStereotype(org.mule.test.heisenberg.extension.stereotypes.EmpireStereotype) String.format(java.lang.String.format) KillParameters(org.mule.test.heisenberg.extension.model.KillParameters) OutputResolver(org.mule.runtime.extension.api.annotation.metadata.OutputResolver) List(java.util.List) ParameterResolver(org.mule.runtime.extension.api.runtime.parameter.ParameterResolver) SimpleKnockeableDoor(org.mule.test.heisenberg.extension.model.SimpleKnockeableDoor) ExtensionsClient(org.mule.runtime.extension.api.client.ExtensionsClient) Entry(java.util.Map.Entry) Summary(org.mule.runtime.extension.api.annotation.param.display.Summary) PersonalInfo(org.mule.test.heisenberg.extension.model.PersonalInfo) Alias(org.mule.runtime.extension.api.annotation.Alias) DefaultOperationParametersBuilder(org.mule.runtime.extension.api.client.DefaultOperationParametersBuilder) CureCancerExceptionEnricher(org.mule.test.heisenberg.extension.exception.CureCancerExceptionEnricher) CPU_INTENSIVE(org.mule.runtime.api.meta.model.operation.ExecutionType.CPU_INTENSIVE) KNOCKED_DOOR(org.mule.test.heisenberg.extension.HeisenbergNotificationAction.KNOCKED_DOOR) Ignore(org.mule.runtime.extension.api.annotation.Ignore) Config(org.mule.runtime.extension.api.annotation.param.Config) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) Charset(java.nio.charset.Charset) MuleException(org.mule.runtime.api.exception.MuleException) PAYLOAD(org.mule.runtime.extension.api.annotation.param.Optional.PAYLOAD) Literal(org.mule.runtime.extension.api.runtime.parameter.Literal) Content(org.mule.runtime.extension.api.annotation.param.Content) NullExceptionEnricher(org.mule.test.heisenberg.extension.exception.NullExceptionEnricher) IOUtils(org.mule.runtime.core.api.util.IOUtils) Optional(org.mule.runtime.extension.api.annotation.param.Optional) ParameterGroup(org.mule.runtime.extension.api.annotation.param.ParameterGroup) Disposable(org.mule.runtime.api.lifecycle.Disposable) Stereotype(org.mule.runtime.extension.api.annotation.param.stereotype.Stereotype) KnockeableDoor(org.mule.test.heisenberg.extension.model.KnockeableDoor) NotificationEmitter(org.mule.runtime.extension.api.notification.NotificationEmitter) SaleInfo(org.mule.test.heisenberg.extension.model.SaleInfo) DataType(org.mule.runtime.api.metadata.DataType) Throws(org.mule.runtime.extension.api.annotation.error.Throws) Investment(org.mule.test.heisenberg.extension.model.Investment) RecursivePojo(org.mule.test.heisenberg.extension.model.RecursivePojo) Example(org.mule.runtime.extension.api.annotation.param.display.Example) Result(org.mule.runtime.extension.api.runtime.operation.Result) DefaultOperationParameters.builder(org.mule.runtime.extension.api.client.DefaultOperationParameters.builder) TypedValue.of(org.mule.runtime.api.metadata.TypedValue.of) TypedValue(org.mule.runtime.api.metadata.TypedValue) RecursiveChainB(org.mule.test.heisenberg.extension.model.RecursiveChainB) Collectors.toList(java.util.stream.Collectors.toList) RecursiveChainA(org.mule.test.heisenberg.extension.model.RecursiveChainA) Streaming(org.mule.runtime.extension.api.annotation.Streaming) ExtensionManager(org.mule.runtime.core.api.extension.ExtensionManager) MediaType(org.mule.runtime.extension.api.annotation.param.MediaType) Fires(org.mule.runtime.extension.api.annotation.notification.Fires) HealthStatus(org.mule.test.heisenberg.extension.model.HealthStatus) IntegerAttributes(org.mule.test.heisenberg.extension.model.types.IntegerAttributes) ANY(org.mule.runtime.extension.api.annotation.param.MediaType.ANY) InputStream(java.io.InputStream) DataType(org.mule.runtime.api.metadata.DataType) Charset(java.nio.charset.Charset) IntegerAttributes(org.mule.test.heisenberg.extension.model.types.IntegerAttributes) MediaType(org.mule.runtime.extension.api.annotation.param.MediaType)

Example 2 with MediaType

use of org.mule.runtime.extension.api.annotation.param.MediaType in project mule by mulesoft.

the class HeisenbergOperations method knock.

@MediaType(TEXT_PLAIN)
@Fires(KnockNotificationProvider.class)
public String knock(KnockeableDoor knockedDoor, NotificationEmitter notificationEmitter) {
    TypedValue<SimpleKnockeableDoor> door = of(new SimpleKnockeableDoor(knockedDoor));
    notificationEmitter.fire(KNOCKING_DOOR, door);
    String knock = knockedDoor.knock();
    notificationEmitter.fire(KNOCKED_DOOR, door);
    return knock;
}
Also used : SimpleKnockeableDoor(org.mule.test.heisenberg.extension.model.SimpleKnockeableDoor) Fires(org.mule.runtime.extension.api.annotation.notification.Fires) MediaType(org.mule.runtime.extension.api.annotation.param.MediaType)

Example 3 with MediaType

use of org.mule.runtime.extension.api.annotation.param.MediaType in project mule by mulesoft.

the class DrStrangeOperations method seekStream.

@MediaType(TEXT_PLAIN)
public String seekStream(@Config DrStrange dr, @Optional(defaultValue = PAYLOAD) InputStream stream, int position) throws IOException {
    checkArgument(stream instanceof CursorStream, "Stream was not cursored");
    CursorStream cursor = (CursorStream) stream;
    cursor.seek(position);
    return readStream(dr, cursor);
}
Also used : CursorStream(org.mule.runtime.api.streaming.bytes.CursorStream) MediaType(org.mule.runtime.extension.api.annotation.param.MediaType)

Aggregations

MediaType (org.mule.runtime.extension.api.annotation.param.MediaType)3 Fires (org.mule.runtime.extension.api.annotation.notification.Fires)2 SimpleKnockeableDoor (org.mule.test.heisenberg.extension.model.SimpleKnockeableDoor)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 String.format (java.lang.String.format)1 Charset (java.nio.charset.Charset)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 Collectors.toList (java.util.stream.Collectors.toList)1 Inject (javax.inject.Inject)1 MuleException (org.mule.runtime.api.exception.MuleException)1 Disposable (org.mule.runtime.api.lifecycle.Disposable)1 CPU_INTENSIVE (org.mule.runtime.api.meta.model.operation.ExecutionType.CPU_INTENSIVE)1 DataType (org.mule.runtime.api.metadata.DataType)1 TypedValue (org.mule.runtime.api.metadata.TypedValue)1 TypedValue.of (org.mule.runtime.api.metadata.TypedValue.of)1