protected void addConnectorImplementation( ConnectorImplementation impl, List<IResource> resourcesToExport, boolean includeSources) throws FileNotFoundException, CoreException { final IRepositoryStore store = getImplementationStore(); String fileName = NamingUtils.getEResourceFileName(impl, true); final EMFFileStore fileStore = (EMFFileStore) store.getChild(fileName); if (!fileStore.canBeShared()) { File f = new File(fileStore.getEMFResource().getURI().toFileString()); if (f.exists()) { IFile implFile = store.getResource().getFile(f.getName()); implFile.create(new FileInputStream(f), true, Repository.NULL_PROGRESS_MONITOR); resourcesToExport.add(implFile); cleanAfterExport.add(implFile); } } else { implBackup = EcoreUtil.copy(impl); String jarName = NamingUtils.toConnectorImplementationFilename( impl.getImplementationId(), impl.getImplementationVersion(), false) + ".jar"; if (!impl.getJarDependencies().getJarDependency().contains(jarName)) { impl.getJarDependencies().getJarDependency().add(jarName); } impl.setHasSources(includeSources); IRepositoryFileStore file = store.getChild(fileName); file.save(EcoreUtil.copy(impl)); resourcesToExport.add(file.getResource()); } }
protected void addConnectorDefinition( ConnectorImplementation impl, List<IResource> resourcesToExport) throws FileNotFoundException, CoreException { final IRepositoryStore store = getDefinitionStore(); ConnectorDefinition def = ((IDefinitionRepositoryStore) store) .getDefinition(impl.getDefinitionId(), impl.getDefinitionVersion()); EMFFileStore file = (EMFFileStore) store.getChild(URI.decode(def.eResource().getURI().lastSegment())); if (file != null && !file.canBeShared()) { File f = new File(file.getEMFResource().getURI().toFileString()); if (f.exists()) { IFile defFile = store.getResource().getFile(f.getName()); defFile.create(new FileInputStream(f), true, Repository.NULL_PROGRESS_MONITOR); resourcesToExport.add(defFile); cleanAfterExport.add(defFile); } } else if (file != null) { resourcesToExport.add(file.getResource()); } addDefinitionIcons(resourcesToExport, store, def); addDefinitionPropertiesFile(resourcesToExport, store, def); }