Beispiel #1
0
  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");
    }
  }
Beispiel #2
0
  public MetaData getMetaData() throws CoreException {
    if (documentRoot == null || documentRoot.getMetadata() == null)
      throw ExceptionUtils.fromMessage("No metadata available");

    return documentRoot.getMetadata();
  }
Beispiel #3
0
 public MavenMetadata() {
   documentRoot = MetadataFactory.eINSTANCE.createDocumentRoot();
   documentRoot.setMetadata(MetadataFactory.eINSTANCE.createMetaData());
 }