continue; contribution.addResource(resource); callback.accept(resource); } catch (ClassNotFoundException | NoClassDefFoundError e) { UrlSource source = new UrlSource(entryUrl); Resource resource = new Resource(contribution, source, contentType); contribution.addResource(resource);
continue; contribution.addResource(resource); callback.accept(resource); } catch (ClassNotFoundException | NoClassDefFoundError e) { UrlSource source = new UrlSource(entryUrl); Resource resource = new Resource(contribution, source, contentType); contribution.addResource(resource);
/** * Creates an index entry in the given contribution for the web implementation. * * Only one web implementation can exist per web contribution. * * @param implementation the implementation * @param contribution the contribution */ public static void indexImplementation(WebImplementation implementation, Contribution contribution) { WebImplementationSymbol symbol = new WebImplementationSymbol(); ResourceElement<WebImplementationSymbol, WebImplementation> element = new ResourceElement<>(symbol, implementation); Resource resource = new Resource(contribution, null, "webimpl"); resource.addResourceElement(element); contribution.addResource(resource); resource.setState(ResourceState.PROCESSED); } }
/** * Adds the composite as a resource to the contribution. * * @param contribution the contribution * @param composite the composite */ private static void addResource(Contribution contribution, Composite composite) { Source source = new UrlSource(COMPOSITE_URL); Resource resource = new Resource(contribution, source, Constants.COMPOSITE_CONTENT_TYPE); QName compositeName = composite.getName(); QNameSymbol symbol = new QNameSymbol(compositeName); ResourceElement<QNameSymbol, Composite> element = new ResourceElement<>(symbol, composite); resource.addResourceElement(element); resource.setState(ResourceState.PROCESSED); contribution.addResource(resource); }
/** * Adds the composite as a resource to the contribution. * * @param contribution the contribution * @param composite the composite * @param scdlLocation the location of the composite file */ private static void addResource(Contribution contribution, Composite composite, URL scdlLocation) { Source source = new UrlSource(scdlLocation); Resource resource = new Resource(contribution, source, Constants.COMPOSITE_CONTENT_TYPE); QName compositeName = composite.getName(); QNameSymbol symbol = new QNameSymbol(compositeName); ResourceElement<QNameSymbol, Composite> element = new ResourceElement<QNameSymbol, Composite>(symbol, composite); resource.addResourceElement(element); resource.setState(ResourceState.PROCESSED); contribution.addResource(resource); }
public void onInstall(Contribution contribution) { String sourceUrl = contribution.getLocation().toString(); if (!sourceUrl.endsWith(".war")) { // not a WAR file return; } ContributionManifest manifest = contribution.getManifest(); if (!manifest.getDeployables().isEmpty()) { return; } for (Resource resource : contribution.getResources()) { for (ResourceElement<?, ?> element : resource.getResourceElements()) { if (element.getValue() instanceof Composite) { // a composite was defined, return; return; } } } // no composites were defined, synthesize one Composite composite = createComposite(contribution); Source source = contribution.getSource(); Resource resource = createResource(contribution, composite, source); contribution.addResource(resource); QName name = composite.getName(); Deployable deployable = new Deployable(name); manifest.addDeployable(deployable); }
private void addCompositeToContribution(Composite wrapper) { QName compositeName = wrapper.getName(); URI uri = ContributionResolver.getContribution(); Contribution contribution = metaDataStore.find(uri); Resource resource = new Resource(contribution, null, Constants.COMPOSITE_CONTENT_TYPE); QNameSymbol symbol = new QNameSymbol(compositeName); ResourceElement<QNameSymbol, Composite> element = new ResourceElement<>(symbol, wrapper); resource.addResourceElement(element); resource.setState(ResourceState.PROCESSED); contribution.addResource(resource); }
private void addCompositeToContribution(Composite wrapper) { QName compositeName = wrapper.getName(); URI uri = ContributionResolver.getContribution(); Contribution contribution = metaDataStore.find(uri); Resource resource = new Resource(contribution, null, Constants.COMPOSITE_CONTENT_TYPE); QNameSymbol symbol = new QNameSymbol(compositeName); ResourceElement<QNameSymbol, Composite> element = new ResourceElement<>(symbol, wrapper); resource.addResourceElement(element); resource.setState(ResourceState.PROCESSED); contribution.addResource(resource); }
private void addCompositeToContribution(Composite wrapper) { QName compositeName = wrapper.getName(); URI uri = ContributionResolver.getContribution(); Contribution contribution = metaDataStore.find(uri); Resource resource = new Resource(contribution, null, Constants.COMPOSITE_CONTENT_TYPE); QNameSymbol symbol = new QNameSymbol(compositeName); ResourceElement<QNameSymbol, Composite> element = new ResourceElement<>(symbol, wrapper); resource.addResourceElement(element); resource.setState(ResourceState.PROCESSED); contribution.addResource(resource); }
/** * Adds the composite as a resource to the contribution. * * @param contribution the contribution * @param composite the composite */ private static void addResource(Contribution contribution, Composite composite) { Source source = new UrlSource(COMPOSITE_URL); Resource resource = new Resource(contribution, source, Constants.COMPOSITE_CONTENT_TYPE); QName compositeName = composite.getName(); QNameSymbol symbol = new QNameSymbol(compositeName); ResourceElement<QNameSymbol, Composite> element = new ResourceElement<>(symbol, composite); resource.addResourceElement(element); resource.setState(ResourceState.PROCESSED); contribution.addResource(resource); }
@SuppressWarnings("unchecked") private ResourceElement<WebComponentTypeSymbol, WebComponentType> getTypeElement(Contribution contribution) { for (Resource resource : contribution.getResources()) { for (ResourceElement<?, ?> element : resource.getResourceElements()) { if (element.getSymbol() instanceof WebComponentTypeSymbol) { return (ResourceElement<WebComponentTypeSymbol, WebComponentType>) element; } } } WebComponentType componentType = new WebComponentType(); WebComponentTypeSymbol symbol = new WebComponentTypeSymbol(); ResourceElement<WebComponentTypeSymbol, WebComponentType> element = new ResourceElement<>(symbol, componentType); Resource resource = new Resource(contribution, null, "web"); resource.addResourceElement(element); resource.setState(ResourceState.PROCESSED); contribution.addResource(resource); return element; }
public void onInstall(Contribution contribution) { if (!isWar(contribution)) { return; } if (hasImplementation(contribution)) { return; // web component was explicitly configured in the contribution } // synthesize a web implementation URI uri = createWebUri(contribution); WebImplementation implementation = new WebImplementation(uri); // retrieve the component type introspected during contribution indexing or create one if no web artifacts resulted in it being generated WebComponentType componentType = getComponentType(contribution); implementation.setComponentType(componentType); // synthesize a deployable composite IndexHelper.indexImplementation(implementation, contribution); Composite composite = createComposite(implementation, contribution); contribution.getManifest().addDeployable(new Deployable(composite.getName())); contribution.addResource(createResource(contribution, composite)); }