public Set<Contribution> findContributions(List<URI> uris) { Set<Contribution> contributions = new LinkedHashSet<>(uris.size()); for (URI uri : uris) { Contribution contribution = metadataStore.find(uri); if (contribution == null) { throw new AssertionError("Contribution not found for: " + uri); } contributions.add(contribution); } return contributions; }
ResourceElement<QNameSymbol, ?> resourceElement; try { resourceElement = store.resolve(uri, Serializable.class, WEB_APP_JAVAEE_NAMESPACE, context); if (resourceElement == null) { resourceElement = store.resolve(uri, Serializable.class, WEB_APP_J2EE_NAMESPACE, context); if (resourceElement == null) { resourceElement = store.resolve(uri, Serializable.class, WEB_APP_NO_NAMESPACE, context); if (resourceElement == null) {
@ManagementOperation(description = "Returns metadata for all contributions deployed in a domain") public Set<ContributionInfo> getContributions() { Set<Contribution> contributions = metaDataStore.getContributions(); Set<ContributionInfo> infos = new TreeSet<ContributionInfo>(); for (Contribution contribution : contributions) { URI uri = contribution.getUri(); String state = contribution.getState().toString(); long timestamp = contribution.getTimestamp(); List<QName> deployables = new ArrayList<QName>(); for (Deployable deployable : contribution.getManifest().getDeployables()) { deployables.add(deployable.getName()); } ContributionInfo info = new ContributionInfo(uri, state, deployables, timestamp); infos.add(info); } return infos; }
/** * Transitively calculates imported contributions and required capabilities. These are then added to the extension un/provision command. * * @param contribution the contribution to calculate imports for * @param command the command to update * @throws GenerationException if an exception occurs */ private void addDependencies(Contribution contribution, AbstractExtensionsCommand command) throws GenerationException { List<ContributionWire<?, ?>> contributionWires = contribution.getWires(); for (ContributionWire<?, ?> wire : contributionWires) { URI uri = wire.getExportContributionUri(); Contribution imported = store.find(uri); addDependencies(imported, command); if (!command.getExtensionUris().contains(uri) && !Names.HOST_CONTRIBUTION.equals(uri) && !Names.BOOT_CONTRIBUTION.equals(uri)) { command.addExtensionUri(uri); } } Set<Contribution> capabilities = store.resolveCapabilities(contribution); for (Contribution capability : capabilities) { URI uri = capability.getUri(); if (!command.getExtensionUris().contains(uri)) { command.addExtensionUri(uri); } } }
manifest.addProvidedCapability(new Capability(capability)); metaDataStore.store(contribution); classLoaderRegistry.register(contributionUri, loader); return contribution;
manifest.addProvidedCapability(new Capability(capability)); metaDataStore.store(contribution); classLoaderRegistry.register(contributionUri, loader); return contribution;
public Set<Contribution> findContributions(List<URI> uris) { Set<Contribution> contributions = new LinkedHashSet<Contribution>(uris.size()); for (URI uri : uris) { Contribution contribution = metadataStore.find(uri); if (contribution == null) { throw new AssertionError("Contribution not found for: " + uri); } contributions.add(contribution); } return contributions; }
private WsdlServiceContract resolveContract(QName portTypeName, XMLStreamReader reader, IntrospectionContext context) { Location startLocation = reader.getLocation(); WsdlServiceContractSymbol symbol = new WsdlServiceContractSymbol(portTypeName); URI contributionUri = context.getContributionUri(); ResourceElement<WsdlServiceContractSymbol, WsdlServiceContract> element; try { element = store.resolve(contributionUri, WsdlServiceContract.class, symbol, context); } catch (StoreException e) { ElementLoadFailure failure = new ElementLoadFailure("Error loading element", e, startLocation); context.addError(failure); return new WsdlServiceContract(null, null); } if (element == null) { PortTypeNotFound error = new PortTypeNotFound("Port type not found: " + portTypeName); context.addError(error); return new WsdlServiceContract(null, null); } WsdlServiceContract contract = element.getValue(); // return a copy as it may be modified return contract.copy(); }
manifest.addProvidedCapability(new Capability(capability)); metaDataStore.store(contribution); classLoaderRegistry.register(contributionUri, loader); return contribution;
public Set<Contribution> findContributions(List<URI> uris) { Set<Contribution> contributions = new LinkedHashSet<>(uris.size()); for (URI uri : uris) { Contribution contribution = metadataStore.find(uri); if (contribution == null) { throw new AssertionError("Contribution not found for: " + uri); } contributions.add(contribution); } return contributions; }
ResourceElement<QNameSymbol, Composite> element = store.resolve(contributionUri, Composite.class, symbol, context); if (element == null) { String id = name.toString();
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String info = req.getPathInfo().substring(1); // path info always begins with '/' try { URI uri = new URI(info); Contribution contribution = store.find(uri); if (contribution == null) { throw new ServletException("Contribution not found: " + info + ". Request URL was: " + info); } URL url = contribution.getLocation(); copy(url.openStream(), resp.getOutputStream()); } catch (URISyntaxException e) { throw new ServletException("Invalid URI: " + info, e); } }
public DeploymentPlan findPlan(String plan) throws DeploymentException { QName planName = new QName(PLAN_NAMESPACE, plan); QNameSymbol symbol = new QNameSymbol(planName); ResourceElement<QNameSymbol, DeploymentPlan> element = metadataStore.find(DeploymentPlan.class, symbol); if (element == null) { return null; } return element.getValue(); }
public void validate(URI contributionUri, LogicalBinding<WsBindingDefinition> binding, AbstractEndpointDefinition endpointDefinition) throws EndpointValidationException { if (!enabled) { return; } try { ServiceContract otherContract = binding.getParent().getServiceContract(); DefaultIntrospectionContext context = new DefaultIntrospectionContext(); PortSymbol portSymbol = new PortSymbol(endpointDefinition.getPortName()); QName name = store.resolve(contributionUri, Port.class, portSymbol, context).getValue().getBinding().getPortType().getQName(); WsdlServiceContractSymbol contractSymbol = new WsdlServiceContractSymbol(name); WsdlServiceContract contract = store.resolve(contributionUri, WsdlServiceContract.class, contractSymbol, context).getValue(); MatchResult result = matcher.isAssignableFrom(contract, otherContract, true); if (!result.isAssignable()) { throw new EndpointValidationException(result.getError()); } } catch (StoreException e) { throw new EndpointValidationException(e); } }
public Composite findComposite(QName deployable) throws DeploymentException { QNameSymbol symbol = new QNameSymbol(deployable); ResourceElement<QNameSymbol, Composite> element = metadataStore.find(Composite.class, symbol); if (element == null) { String id = deployable.toString(); throw new DeployableNotFoundException("Deployable not found: " + id, id); } return element.getValue(); }
private void resolveExternalCallbackContract(QName callbackPortTypeName, WsdlServiceContract contract, IntrospectionContext context) { WsdlServiceContractSymbol symbol = new WsdlServiceContractSymbol(callbackPortTypeName); URI contributionUri = context.getContributionUri(); ResourceElement<WsdlServiceContractSymbol, WsdlServiceContract> resolved; try { resolved = store.resolve(contributionUri, WsdlServiceContract.class, symbol, context); } catch (StoreException e) { CallbackContractLoadError error = new CallbackContractLoadError("Error resolving callback port type:" + callbackPortTypeName, e); context.addError(error); return; } if (resolved == null) { PortTypeNotFound error = new PortTypeNotFound("Callback port type not found: " + callbackPortTypeName); context.addError(error); return; } WsdlServiceContract callbackContract = resolved.getValue(); contract.setCallbackContract(callbackContract); }
public void onEvent(RuntimeRecover event) { if (!repositoryIndex.exists()) { return; } try { mappings = parse(); List<URI> deleted = new ArrayList<>(); for (Map.Entry<URI, List<URI>> entry : mappings.entrySet()) { URI uri = entry.getKey(); Contribution contribution = store.find(uri); if (contribution == null) { deleted.add(uri); } else { contribution.addProfiles(entry.getValue()); } } for (URI uri : deleted) { mappings.remove(uri); } persist(); } catch (FileNotFoundException | InvalidRepositoryIndexException | XMLStreamException e) { monitor.error(e); } }
ResourceElement<QNameSymbol, Composite> element = store.resolve(contributionUri, Composite.class, symbol, introspectionContext); if (element == null) { String id = name.toString();
public URL resolve(URI uri) throws ResolutionException { if (!HTTP_SCHEME.equals(uri.getScheme())) { // the contribution is being provisioned locally, resolve it directly Contribution contribution = metaDataStore.find(uri); if (contribution == null) { throw new ResolutionException("Contribution not found: " + uri); } return contribution.getLocation(); } InputStream stream; try { URI decoded = URI.create(uri.getPath().substring(HttpProvisionConstants.REPOSITORY.length() + 2)); // +2 for leading and trailing '/' // check to see if the archive is cached locally URL localURL = cache.get(decoded); if (localURL == null) { // resolve remotely URL url = uri.toURL(); stream = url.openStream(); localURL = cache.cache(decoded, stream); } return localURL; } catch (IOException e) { throw new ResolutionException("Error resolving artifact: " + uri, e); } catch (CacheException e) { throw new ResolutionException("Error resolving artifact: " + uri, e); } }