Examples of NodeException


Examples of org.apache.tuscany.sca.node.NodeException

   
   
    public void addContributionFromDomain(String contributionURI, URL contributionURL, ClassLoader contributionClassLoader ) throws NodeException {
       
        if (nodeStarted){
            throw new NodeException("Can't add contribution " + contributionURI + " when the node is running. Call stop() on the node first");
        }
      
        if (contributionURI == null){
            throw new NodeException("Contribution URI cannot be null");
        }
       
        if (contributionURL == null){
            throw new NodeException("Contribution URL cannot be null");
        }
       
        if (contributions.containsKey(contributionURI)) {
            throw new NodeException("Contribution " + contributionURI + " has already been added");
        }
       
        try {         

          //FIXME What to do when a contribution uses a separate class loader ? (e.g contributionClassLoader != null)
           
            // Add the contribution to the node
            ContributionService contributionService = nodeRuntime.getContributionService();
            Contribution contribution = contributionService.contribute(contributionURI,
                                                                       contributionURL,
                                                                       false);
           
            // remember the contribution
            contributions.put(contributionURI, contribution);
               
            // remember all the composites that have been found
            for (Artifact artifact : contribution.getArtifacts()) {
                if (artifact.getModel() instanceof Composite) {
                    Composite composite = (Composite)artifact.getModel();
                    composites.put(composite.getName(), composite);
                    compositeFiles.put(composite.getURI(), composite);
                }
            }
                   
        } catch (Exception ex) {
            throw new NodeException(ex);
        }       
    }  
View Full Code Here

Examples of org.apache.tuscany.sca.node.NodeException

    }  
   
    public void removeContributionFromDomain(String contributionURI) throws NodeException {
       
        if (nodeStarted){
            throw new NodeException("Can't remove contribution " + contributionURI + " when the node is running. Call stop() on the node first");
        }
      
        if (contributionURI == null){
            throw new NodeException("Contribution URI cannot be null");
        }
       
        if (!contributions.containsKey(contributionURI)) {
            throw new NodeException("Contribution " + contributionURI + " has not been added");
        }       
       
        try {

            Contribution contribution = contributions.get(contributionURI);
           
            // remove the local record of composites associated with this contribution
            for (Artifact artifact : contribution.getArtifacts()) {
                if (artifact.getModel() instanceof Composite) {
                    Composite composite = (Composite)artifact.getModel();
                    composites.remove(composite.getName());
                    compositeFiles.remove(composite.getURI());
                }
            }           
       
            // remove the contribution from the contribution service
            nodeRuntime.getContributionService().remove(contributionURI);
           
            // remove any deployed composites from the node level composite
            for (Composite composite : contribution.getDeployables()) {
                if (nodeComposite.getIncludes().contains(composite)){
                    // deactivate it
                    deactivateComposite(composite);
                   
                    // remove it
                    nodeComposite.getIncludes().remove(composite);
                }
            }
           
            // remove the local record of the contribution
            contributions.remove(contributionURI);               
           
        } catch (Exception ex) {
            throw new NodeException(ex);
       
    }  
View Full Code Here

Examples of org.apache.tuscany.sca.node.NodeException

  
    public void addContribution(String contributionURI, String contributionURL) throws NodeException {
        try {
            node.addContributionFromDomain(contributionURI, new URL(contributionURL), null);
        } catch (MalformedURLException ex){
            throw new NodeException(ex);
        }           
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.