JsxResourceConverter implements IResourceConverter, IExtensionInitializer, ICacheManagerListener { @Override public void initialize(IAggregator aggregator, IAggregatorExtension extension, IExtensionRegistrar registrar) { final String sourceMethod = "initialize"; final boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(sourceMethod, sourceMethod, new Object[]{aggregator, extension}); } this.aggregator = aggregator; isSkipResourceConversion.set(false); String xformerUri = extension.getInitParams().getValue(JSXTRANSFORMER_NAME); if (xformerUri == null) { throw new IllegalStateException("Missing transformer init-param"); } try { xformerRes = aggregator.newResource(new URI(xformerUri)); } catch (URISyntaxException e) { throw new RuntimeException(e); } if (!xformerRes.exists()) { throw new RuntimeException(new NotFoundException(xformerUri)); } Dictionary<String,String> dict; dict = new Hashtable<String, String>(); dict.put("name", aggregator.getName()); cacheMgrListenerReg = aggregator.getPlatformServices().registerService(ICacheManagerListener.class.getName(), this, dict); if (ctorScopePoolSize > 0) { scopePoolSize = ctorScopePoolSize; } else { if (extension != null) { scopePoolSize = TypeUtil.asInt(extension.getInitParams().getValue(SCOPE_POOL_SIZE_INITPARAM), DEFAULT_SCOPE_POOL_SIZE); String options = extension.getInitParams().getValue(JSX_OPTIONS_INITPARAM); if (options != null && options.length() > 0) { jsxOptions = options; } } } if (isTraceLogging) { log.exiting(sourceClass, sourceMethod); } } JsxResourceConverter();  JsxResourceConverter(ExecutorService es, int scopePoolSize); @Override void initialize(IAggregator aggregator, IAggregatorExtension extension,
			IExtensionRegistrar registrar); @Override void initialized(ICacheManager cacheManager); @Override IResource convert(final IResource resource);  }
@Test public void testJsxConverter() throws Exception { URI converterUri = JsxResourceConverterTest.class.getClassLoader().getResource("JSXTransformer.js").toURI(); File tmpdir = Files.createTempDir(); File cacheFile = new File(tmpdir, "test.js"); JsxResourceConverter.JsxConverter jsxConverter = new JsxResourceConverter.JsxConverter(1, null); jsxConverter.initialize(new SynchronousExecutor(), converterUri); IResource res = new StringResource(jsxSource, new URI("test.jsx")); jsxConverter.generateCacheContent(res, cacheFile); Assert.assertEquals(transpiledJs, FileUtils.readFileToString(cacheFile)); File file = new File(tmpdir, "converter.ser"); ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(file)); os.writeObject(jsxConverter); os.close(); ObjectInputStream is = new ObjectInputStream(new FileInputStream(file)); jsxConverter = (JsxResourceConverter.JsxConverter)is.readObject(); jsxConverter.initialize(new SynchronousExecutor(), converterUri); is.close(); jsxConverter.generateCacheContent(res, cacheFile); Assert.assertEquals(transpiledJs, FileUtils.readFileToString(cacheFile)); }