Java Code Examples for org.jboss.forge.addon.resource.Resource#getFullyQualifiedName()
The following examples show how to use
org.jboss.forge.addon.resource.Resource#getFullyQualifiedName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XmlWebResourcesCamelFilesVisitor.java From fabric8-forge with Apache License 2.0 | 5 votes |
@Override public void visit(VisitContext visitContext, Resource<?> resource) { // skip directories if (resource instanceof FileResource) { if (((FileResource) resource).isDirectory()) { return; } } String name = resource.getFullyQualifiedName(); name = AbstractCamelProjectCommand.asRelativeFile(name, null, null, facet); LOG.info("Resource name " + name); if (name.endsWith(".xml")) { boolean include = true; if (filter != null) { Boolean out = filter.apply(name); LOG.info("Filter " + name + " -> " + out); include = out == null || out; } if (include) { boolean camel = containsCamelRoutes(resource); if (camel) { // we only want the relative dir name from the resource directory, eg WEB-INF/foo.xml String baseDir = facet.getWebRootDirectory().getFullyQualifiedName(); String fqn = resource.getFullyQualifiedName(); if (fqn.startsWith(baseDir)) { fqn = fqn.substring(baseDir.length() + 1); } int idx = Math.max(fqn.lastIndexOf("/"), fqn.lastIndexOf("\\")); if (idx > 0) { directories.add(fqn.substring(0, idx)); } files.add(fqn); } } } }
Example 2
Source File: XmlResourcesCamelFilesVisitor.java From fabric8-forge with Apache License 2.0 | 5 votes |
@Override public void visit(VisitContext visitContext, Resource<?> resource) { // skip directories if (resource instanceof FileResource) { if (((FileResource) resource).isDirectory()) { return; } } String name = resource.getFullyQualifiedName(); name = AbstractCamelProjectCommand.asRelativeFile(name, null, facet, null); LOG.info("Resource name " + name); if (name.endsWith(".xml")) { boolean include = true; if (filter != null) { Boolean out = filter.apply(name); include = out == null || out; } if (include) { boolean camel = containsCamelRoutes(resource); if (camel) { // we only want the relative dir name from the resource directory, eg META-INF/spring/foo.xml String baseDir = facet.getResourceDirectory().getFullyQualifiedName(); String fqn = resource.getFullyQualifiedName(); if (fqn.startsWith(baseDir)) { fqn = fqn.substring(baseDir.length() + 1); } files.add(fqn); } } } }
Example 3
Source File: XmlWebResourcesCamelEndpointsVisitor.java From fabric8-forge with Apache License 2.0 | 5 votes |
@Override public void visit(VisitContext visitContext, Resource<?> resource) { // skip directories if (resource instanceof FileResource) { if (((FileResource) resource).isDirectory()) { return; } } String name = resource.getFullyQualifiedName(); name = AbstractCamelProjectCommand.asRelativeFile(name, null, null, facet); LOG.info("Resource name " + name); if (name.endsWith(".xml")) { boolean include = true; if (filter != null) { Boolean out = filter.apply(name); LOG.info("Filter " + name + " -> " + out); include = out == null || out; } if (include) { boolean camel = containsCamelRoutes(resource); if (camel) { // find all the endpoints (currently only <endpoint> and within <route>) try { InputStream is = resource.getResourceInputStream(); String fqn = resource.getFullyQualifiedName(); String baseDir = facet.getWebRootDirectory().getFullyQualifiedName(); XmlRouteParser.parseXmlRouteEndpoints(is, baseDir, fqn, endpoints); } catch (Throwable e) { // ignore } } } } }
Example 4
Source File: XmlResourcesCamelEndpointsVisitor.java From fabric8-forge with Apache License 2.0 | 5 votes |
@Override public void visit(VisitContext visitContext, Resource<?> resource) { // skip directories if (resource instanceof FileResource) { if (((FileResource) resource).isDirectory()) { return; } } String name = resource.getFullyQualifiedName(); name = AbstractCamelProjectCommand.asRelativeFile(name, null, facet, null); LOG.info("Resource name " + name); if (name.endsWith(".xml")) { boolean include = true; if (filter != null) { Boolean out = filter.apply(name); LOG.info("Filter " + name + " -> " + out); include = out == null || out; } if (include) { boolean camel = containsCamelRoutes(resource); if (camel) { // find all the endpoints (currently only <endpoint> and within <route>) try { InputStream is = resource.getResourceInputStream(); String fqn = resource.getFullyQualifiedName(); String baseDir = facet.getResourceDirectory().getFullyQualifiedName(); XmlRouteParser.parseXmlRouteEndpoints(is, baseDir, fqn, endpoints); } catch (Throwable e) { // ignore } } } } }
Example 5
Source File: SpringBootConfigurationResourcesFilesVisitor.java From fabric8-forge with Apache License 2.0 | 5 votes |
@Override public void visit(VisitContext visitContext, Resource<?> resource) { // skip directories if (resource instanceof FileResource) { if (((FileResource) resource).isDirectory()) { return; } } String name = resource.getFullyQualifiedName(); name = AbstractCamelProjectCommand.asRelativeFile(name, null, facet, null); LOG.info("Resource name " + name); if (name.equals("application.properties") || name.equals("application.yaml") || name.equals("application.yml")) { boolean include = true; if (filter != null) { Boolean out = filter.apply(name); include = out == null || out; } if (include) { // we only want the relative dir name from the resource directory, eg META-INF/spring/foo.xml String baseDir = facet.getResourceDirectory().getFullyQualifiedName(); String fqn = resource.getFullyQualifiedName(); if (fqn.startsWith(baseDir)) { fqn = fqn.substring(baseDir.length() + 1); } files.add(fqn); } } }