public ServiceBundle addServiceBundle(ServiceBundle serviceBundle) throws ComponentConfigException { serviceBundle.getServiceUISpecification().validate(); if (serviceBundle.getId() == null) { serviceBundle.setId(this.dao.nextId(SERVICE_BUNDLE_NAMESPACE)); } if (serviceBundle.getTimestamp() == null) { serviceBundle.setTimestamp(System.currentTimeMillis()); } this.dao.add(serviceBundle); return serviceBundle; }
public TopologyComponentBundle addTopologyComponentBundle (TopologyComponentBundle topologyComponentBundle, java.io.File bundleJar) throws ComponentConfigException, IOException { topologyComponentBundle.getTopologyComponentUISpecification().validate(); loadTransformationClassForBundle(topologyComponentBundle, bundleJar); if (!topologyComponentBundle.getBuiltin()) { topologyComponentBundle.setBundleJar(getTopologyComponentBundleJarName(topologyComponentBundle)); try (InputStream is = new FileInputStream(bundleJar)) { uploadFileToStorage(is, topologyComponentBundle.getBundleJar()); } } try { if (topologyComponentBundle.getId() == null) { topologyComponentBundle.setId(this.dao.nextId(TopologyComponentBundle.NAME_SPACE)); } if (topologyComponentBundle.getTimestamp() == null) { topologyComponentBundle.setTimestamp(System.currentTimeMillis()); } this.dao.add(topologyComponentBundle); } catch (StorageException e) { if (!topologyComponentBundle.getBuiltin()) { LOG.debug("StorageException while adding the bundle. Deleting the bundle jar."); deleteFileFromStorage(topologyComponentBundle.getBundleJar()); } throw e; } return topologyComponentBundle; }
public TopologyComponentBundle addOrUpdateTopologyComponentBundle (Long id, TopologyComponentBundle topologyComponentBundle, java.io.File bundleJar) throws ComponentConfigException, IOException { topologyComponentBundle.getTopologyComponentUISpecification().validate(); loadTransformationClassForBundle(topologyComponentBundle, bundleJar); if (!topologyComponentBundle.getBuiltin()) {