/** {@inheritDoc} */ @Override public Object inStreamOutObject(int type, long memPtr) throws Exception { try (PlatformMemory mem = memPtr != 0 ? platformCtx.memory().get(memPtr) : null) { BinaryRawReaderEx reader = mem != null ? platformCtx.reader(mem) : null; return wrapProxy(target.processInStreamOutObject(type, reader)); } catch (Exception e) { throw target.convertException(e); } }
/** {@inheritDoc} */ @Override public long inStreamOutLong(int type, long memPtr) throws Exception { try (PlatformMemory mem = platformCtx.memory().get(memPtr)) { BinaryRawReaderEx reader = platformCtx.reader(mem); return target.processInStreamOutLong(type, reader, mem); } catch (Exception e) { throw target.convertException(e); } }
/** {@inheritDoc} */ @Override public void outStream(int type, long memPtr) throws Exception { try (PlatformMemory mem = platformCtx.memory().get(memPtr)) { PlatformOutputStream out = mem.output(); BinaryRawWriterEx writer = platformCtx.writer(out); target.processOutStream(type, writer); out.synchronize(); } catch (Exception e) { throw target.convertException(e); } }
/** * this method creates the platform object * * @param nodeElement OMElement input from the xml reader */ public void createPlatformContext(OMElement nodeElement) { Iterator instanceGroupIterator = nodeElement.getChildElements(); OMElement instanceGroupNode; // Walk through the instance group list while (instanceGroupIterator.hasNext()) { ProductGroup productGroup = new ProductGroup(); instanceGroupNode = (OMElement) instanceGroupIterator.next(); // set the attributes of the current instance group String groupName = instanceGroupNode.getAttributeValue( QName.valueOf(ContextConstants.PLATFORM_CONTEXT_INSTANCE_GROUP_NAME)); Boolean clusteringEnabled = Boolean.parseBoolean( instanceGroupNode.getAttributeValue( QName.valueOf( ContextConstants.PLATFORM_CONTEXT_INSTANCE_GROUP_CLUSTERING_ENABLED))); productGroup.setGroupName(groupName); productGroup.setClusteringEnabled(clusteringEnabled); // walk through the instances in the instance group Iterator instances = instanceGroupNode.getChildElements(); OMElement instanceNode; while (instances.hasNext()) { // adding the instance to the instance group instanceNode = (OMElement) instances.next(); createInstance(instanceNode, productGroup); // addInstanceToTypeList(currentInstance, productGroup); } platformContext.addProductGroup(productGroup); } }
/** {@inheritDoc} */ @Override public void inStreamOutStream(int type, long inMemPtr, long outMemPtr) throws Exception { try (PlatformMemory inMem = platformCtx.memory().get(inMemPtr)) { BinaryRawReaderEx reader = platformCtx.reader(inMem); try (PlatformMemory outMem = platformCtx.memory().get(outMemPtr)) { PlatformOutputStream out = outMem.output(); BinaryRawWriterEx writer = platformCtx.writer(out); target.processInStreamOutStream(type, reader, writer); out.synchronize(); } } catch (Exception e) { throw target.convertException(e); } }
/** {@inheritDoc} */ @Override public Object inObjectStreamOutObjectStream(int type, Object arg, long inMemPtr, long outMemPtr) throws Exception { PlatformMemory inMem = null; PlatformMemory outMem = null; try { BinaryRawReaderEx reader = null; if (inMemPtr != 0) { inMem = platformCtx.memory().get(inMemPtr); reader = platformCtx.reader(inMem); } PlatformOutputStream out = null; BinaryRawWriterEx writer = null; if (outMemPtr != 0) { outMem = platformCtx.memory().get(outMemPtr); out = outMem.output(); writer = platformCtx.writer(out); } PlatformTarget res = target.processInObjectStreamOutObjectStream(type, unwrapProxy(arg), reader, writer); if (out != null) out.synchronize(); return wrapProxy(res); } catch (Exception e) { throw target.convertException(e); } finally { try { if (inMem != null) inMem.close(); } finally { if (outMem != null) outMem.close(); } } }