public void readDataPlugins(String filePath) throws Exception { dataPlugins.clear(); FileInputStream fin = new FileInputStream(filePath); ZipInputStream zin = new ZipInputStream(fin); ZipEntry ze = null; while ((ze = zin.getNextEntry()) != null) { if (ze.getName().equals("configuration.xml") || ze.getName().contains(CONFIGURATION_XML_SUFFIX)) { ByteArrayOutputStream fout = new ByteArrayOutputStream(); for (int c = zin.read(); c != -1; c = zin.read()) { fout.write(c); } zin.closeEntry(); Configuration tmpConfiguration = SerializationUtils.fromXML(fout.toByteArray(), Configuration.class); Component component = tmpConfiguration.getComponent(DataInjectorService.class.getName()); ExternalComponentPlugins externalComponentPlugins = tmpConfiguration .getExternalComponentPlugins(DataInjectorService.class.getName()); if (component != null && component.getComponentPlugins() != null && !component.getComponentPlugins().isEmpty()) { this.addComponentPlugins(component.getComponentPlugins()); } else if (externalComponentPlugins != null && externalComponentPlugins.getComponentPlugins() != null && !externalComponentPlugins.getComponentPlugins().isEmpty()) { this.addComponentPlugins(externalComponentPlugins.getComponentPlugins()); } } } zin.close(); }
public static Configuration buildOrganizationServiceConfiguration(OrganizationConfig organizationConfig) { Configuration configuration = new Configuration(); ExternalComponentPlugins externalComponentPlugins = new ExternalComponentPlugins(); ComponentPlugin componentPlugin = new ComponentPlugin(); InitParams initParams = new InitParams(); ObjectParameter objectParam = new ObjectParameter(); objectParam.setName("configuration"); objectParam.setObject(organizationConfig); initParams.addParameter(objectParam); externalComponentPlugins.setTargetComponent(DataInjectorService.class.getName()); componentPlugin.setName("injector.Data.plugin"); componentPlugin.setSetMethod("addDataPlugin"); componentPlugin.setType(DataPlugin.class.getName()); componentPlugin.setInitParams(initParams); ArrayList<ComponentPlugin> componentPlugins = new ArrayList<ComponentPlugin>(); componentPlugins.add(componentPlugin); externalComponentPlugins.setComponentPlugins(componentPlugins); configuration.addExternalComponentPlugins(externalComponentPlugins); return configuration; }
TemplateService.class.getName()); List<ComponentPlugin> componentPlugins = new ArrayList<ComponentPlugin>(); if (externalComponentPlugins != null && externalComponentPlugins.getComponentPlugins() != null) { LOG.info("add Template Services externalComponentPlugins"); componentPlugins.addAll(externalComponentPlugins.getComponentPlugins());
&& organizationServiceExternalComponentPlugins.getComponentPlugins() != null) { nbExternalComponentPlugins = organizationServiceExternalComponentPlugins.getComponentPlugins().size(); manager.getConfiguration() .getExternalComponentPlugins(OrganizationService.class.getName()); addComponentPlugin(organizationServiceExternalComponentPlugins.getComponentPlugins());