[forge-issues] [JBoss JIRA] (FORGE-2292) ResourcesFacet - A Resource should have API to get the project FQN name

Claus Ibsen (JIRA) issues at jboss.org
Mon Mar 23 07:52:18 EDT 2015


Claus Ibsen created FORGE-2292:
----------------------------------

             Summary: ResourcesFacet - A Resource should have API to get the project FQN name
                 Key: FORGE-2292
                 URL: https://issues.jboss.org/browse/FORGE-2292
             Project: Forge
          Issue Type: Feature Request
    Affects Versions: 2.15.2.Final
            Reporter: Claus Ibsen
            Priority: Minor


Using the following code to find all Camel xml files in my project
{code}
    public XmlFileCompleter(ResourcesFacet facet) {
        // find package names in the source code
        facet.visitResources(new ResourceVisitor() {
            @Override
            public void visit(VisitContext context, Resource<?> resource) {
                String name = resource.getName();
                if (name.endsWith(".xml")) {
                    // must contain <camelContext...
                    boolean camel = resource.getContents().contains("<camelContext");
                    if (camel) {
                        files.add(resource.getName());
                    }
                }
            }
        });
    }
{code}

The problem is that I cannot get the FQN package name of the resource. 

getName returns the name without any parents - that is okay and would be expected.

getFullyQualifiedName() returns the absolute path on my computer, so its
/opt/jboss-forge/foo/src/main/resources/spring/foo.xml

eg the project is stored in /opt/jboss-forge/foo. So I need an api to give me the java package name of the resource - which in this case would be spring/foo.xml.




--
This message was sent by Atlassian JIRA
(v6.3.11#6341)


More information about the forge-issues mailing list