public void save(Resource resource) throws CoreException { Resource targetResource = resource; if (targetResource == null) targetResource = documentRoot.eResource(); if (targetResource == null) throw ExceptionUtils.fromMessage("No resource to store Maven Metadata"); if (resource != null && !targetResource.equals(documentRoot.eResource())) targetResource.getContents().add(documentRoot); try { targetResource.save(Collections.emptyMap()); } catch (IOException e) { throw ExceptionUtils.fromMessage(e, "Unable to save Maven Metadata"); } }
public MetaData getMetaData() throws CoreException { if (documentRoot == null || documentRoot.getMetadata() == null) throw ExceptionUtils.fromMessage("No metadata available"); return documentRoot.getMetadata(); }
public MavenMetadata() { documentRoot = MetadataFactory.eINSTANCE.createDocumentRoot(); documentRoot.setMetadata(MetadataFactory.eINSTANCE.createMetaData()); }