PersistentObjectStorePartition(MuleContext muleContext, String partitionName, File partitionDirectory) { this.muleContext = muleContext; serializer = muleContext.getObjectSerializer(); this.partitionName = partitionName; this.partitionDirectory = partitionDirectory; }
@Override public ObjectSerializer getObject() throws Exception { return muleContext.getObjectSerializer(); }
PersistentObjectStorePartition(MuleContext muleContext, File partitionDirectory) throws ObjectStoreNotAvaliableException { this.muleContext = muleContext; serializer = muleContext.getObjectSerializer(); this.partitionDirectory = partitionDirectory; this.partitionName = readPartitionFileName(partitionDirectory); }
@Override public Object transformMessage(MuleMessage message, String outputEncoding) { return muleContext.getObjectSerializer().serialize(message); } }
@Override public ObjectSerializer getObjectSerializer(MuleMessage message) { return message.getMuleContext().getObjectSerializer(); } }
public void write(MuleEvent event, OutputStream out) throws IOException { muleContext.getObjectSerializer().serialize(src, out); } };
public void write(DataOutputStream outputStream, MuleContext muleContext) { try { serializeTxId(outputStream); outputStream.write(operation); if (isCheckpointOperation(operation)) { outputStream.flush(); return; } outputStream.write(queueName.length()); outputStream.write(queueName.getBytes()); byte[] serializedValue = muleContext.getObjectSerializer().serialize(value); outputStream.writeInt(serializedValue.length); outputStream.write(serializedValue); outputStream.flush(); } catch (IOException e) { throw new MuleRuntimeException(e); } }
public AbstractQueueTxJournalEntry(DataInputStream inputStream, MuleContext muleContext) throws IOException { txId = deserializeTxId(inputStream); operation = inputStream.readByte(); if (isCheckpointOperation(operation)) { return; } int queueNameSize = toUnsignedInt(inputStream.readByte()); byte[] queueNameAsBytes = new byte[queueNameSize]; inputStream.read(queueNameAsBytes, 0, queueNameSize); int valueSize = inputStream.readInt(); byte[] valueAsBytes = new byte[valueSize]; inputStream.read(valueAsBytes, 0, valueSize); queueName = new String(queueNameAsBytes); value = muleContext.getObjectSerializer().deserialize(valueAsBytes); }
public void storeSessionInfoToMessage(MuleSession session, MuleMessage message) throws MuleException { MuleContext muleContext = message.getMuleContext(); byte[] serializedSession = muleContext.getObjectSerializer().serialize( removeNonSerializableProperties(session, muleContext)); if (logger.isDebugEnabled()) { logger.debug("Adding serialized Session header to message: " + serializedSession); } message.setOutboundProperty(MuleProperties.MULE_SESSION_PROPERTY, serializedSession); }
@Override public Object doTransform(Object src, String outputEncoding) throws TransformerException { /* * If the MuleMessage source type has been registered then we can assume that * the whole message is to be serialised, not just the payload. This can be * useful for protocols such as tcp where the protocol does not support * headers and the whole message needs to be serialized. */ try { return muleContext.getObjectSerializer().serialize(src); } catch (Exception e) { throw new TransformerException(this, e); } }
@SuppressWarnings("unchecked") protected T deserialize(File file) throws ObjectStoreException { try { FileInputStream in = new FileInputStream(file); return muleContext.getObjectSerializer().deserialize(in); } catch (SerializationException se) { throw new ObjectStoreException(se); } catch (FileNotFoundException fnfe) { throw new ObjectStoreException(fnfe); } }
protected void serialize(T value, File outputFile) throws ObjectStoreException { try { FileOutputStream out = new FileOutputStream(outputFile); out.write(muleContext.getObjectSerializer().serialize(value)); out.flush(); } catch (SerializationException se) { throw new ObjectStoreException(se); } catch (FileNotFoundException fnfe) { throw new ObjectStoreException(fnfe); } catch (IOException e) { throw new MuleRuntimeException(MessageFactory.createStaticMessage("Could not write to file"), e); } }
public DualRandomAccessFileQueueStoreDelegate(String queueName, String workingDirectory, MuleContext muleContext, int capacity) { super(capacity); this.muleContext = muleContext; serializer = muleContext.getObjectSerializer(); File queuesDirectory = getQueuesDirectory(workingDirectory); if (!queuesDirectory.exists()) { Preconditions.checkState(queuesDirectory.mkdirs(), "Could not create queue store directory " + queuesDirectory.getAbsolutePath()); } randomAccessFileQueueStore1 = new RandomAccessFileQueueStore(new QueueFileProvider(queuesDirectory, queueName + QUEUE_STORE_1_SUFFIX)); randomAccessFileQueueStore2 = new RandomAccessFileQueueStore(new QueueFileProvider(queuesDirectory, queueName + QUEUE_STORE_2_SUFFIX)); queueControlDataFile = new QueueControlDataFile(new QueueFileProvider(queuesDirectory, queueName + QUEUE_DATA_CONTROL_SUFFIX), randomAccessFileQueueStore1.getFile(), randomAccessFileQueueStore2.getFile()); writeFile = queueControlDataFile.getCurrentWriteFile().getAbsolutePath().equals(randomAccessFileQueueStore1.getFile().getAbsolutePath()) ? randomAccessFileQueueStore1 : randomAccessFileQueueStore2; readFile = queueControlDataFile.getCurrentReadFile().getAbsolutePath().equals(randomAccessFileQueueStore1.getFile().getAbsolutePath()) ? randomAccessFileQueueStore1 : randomAccessFileQueueStore2; filesLock = new ReentrantReadWriteLock(); if (logger.isDebugEnabled()) { logger.debug(String.format("Queue %s has %s messages", queueName, getSize())); } }
@Override public Object doTransform(Object src, String encoding) throws TransformerException { ObjectSerializer serializer = muleContext.getObjectSerializer(); try { final Object result; if (src instanceof byte[]) { result = serializer.deserialize((byte[]) src); } else { result = serializer.deserialize((InputStream) src); } return result; } catch (Exception e) { throw new TransformerException( CoreMessages.transformFailed("byte[]", "Object"), this, e); } }
return muleContext.getObjectSerializer().deserialize(buffer); return muleContext.getObjectSerializer().deserialize(buffer);
protected RemoteDispatcher(String endpoint, MuleContext muleContext) throws MuleException { this.muleContext = muleContext; serializer = muleContext.getObjectSerializer(); EndpointFactory endpointFactory = muleContext.getEndpointFactory(); asyncServerEndpoint = endpointFactory.getOutboundEndpoint(endpoint); EndpointBuilder endpointBuilder = endpointFactory.getEndpointBuilder(endpoint); endpointBuilder.setExchangePattern(MessageExchangePattern.REQUEST_RESPONSE); syncServerEndpoint = muleContext.getEndpointFactory().getOutboundEndpoint( endpointBuilder); wireFormat = requestWireFormat(); }
data = muleContext.getObjectSerializer().serialize(src);
final Object deserialized = muleContext.getObjectSerializer().deserialize(baos.toByteArray()); message = new DefaultMuleMessage(deserialized, firstEvent.getMessage(), muleContext);
final byte[] buffer = muleContext.getObjectSerializer().serialize(src); postMethod.setRequestEntity(new ByteArrayRequestEntity(buffer, outboundMimeType));