Package org.apache.beehive.controls.api.assembly

Examples of org.apache.beehive.controls.api.assembly.ControlAssemblyContext


                Class<? extends ControlAssembler> assemblerClass = a.assembler();
                if ( !assemblerClass.equals(DefaultControlAssembler.class) )
                {
                    ControlAssembler assembler = assemblerClass.newInstance();
                    Set<String> clients = controlTypeToClients.get( ct );
                    ControlAssemblyContext cac = factory.newInstance(
                        cl.loadClass(ct), null, clients, moduleRoot, moduleName, srcOutputRoot );
                    assembler.assemble( cac );
                }
            }
        }
View Full Code Here


    protected void updateEJBJar(ControlAssemblyContext.EJBModule ejbAssemblyContext,
                                EJBInfo ejbInfo,
                                String ejbLinkValue)
        throws ControlAssemblyException {
        ControlAssemblyContext cac = (ControlAssemblyContext)ejbAssemblyContext;

        cac.getMessager().printNotice("EJBControlAssembler.updateEJBJar() called");
        cac.getMessager().printNotice(" ejbInfo=" + ejbInfo );
        cac.getMessager().printNotice(" ejbLinkValue=" + ejbLinkValue );

        File ejbJarFile = ejbAssemblyContext.getEjbJarXml();
        FileInputStream ejbJarStream;
        try {
            ejbJarStream = new FileInputStream( ejbJarFile );
        }
        catch (FileNotFoundException fnfe) {
            String msg = "EJBControlAssembler aborted: " +
                "caught FileNotFoundException attempting to read file " +
                ejbJarFile.getAbsolutePath() +
                ". Message: " +
                fnfe.getMessage();
            cac.getMessager().printWarning(msg);
            return;
        }

        try
        {
            // get the existing <ejb-jar> XBean from the stream
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            dbf.setValidating(false);
            DocumentBuilder db = dbf.newDocumentBuilder();
            Document ejbDoc = db.parse(ejbJarStream);

            ejbJarStream.close();
            ejbJarStream = null;

            EJBJarDescriptorHandler ejbHandler = EJBJarDescriptorHandler.getInstance();
            ejbHandler.assemble(ejbDoc, ejbInfo, ejbLinkValue);

            // overwrite existing ejb-jar.xml file with new document
            writeXML(cac, ejbDoc, ejbJarFile);
        }
        catch(IOException ioe) {
            String msg = "EJBControlAssembler: caught IOException " +
                "attempting to write to file " +
                ejbJarFile.getAbsolutePath() +
                ". Message: " +
                ioe.getMessage();
            cac.getMessager().printError(msg);
        }
        catch (ParserConfigurationException e) {
            String msg = "EJBControlAssembler: caught ParserConfigurationException " +
                "attempting to read to file " +
                ejbJarFile.getAbsolutePath() +
                ". Message: " +
                e.getMessage();
            cac.getMessager().printError(msg);
        }
        catch (SAXException e) {
            String msg = "EJBControlAssembler: caught SAXException " +
                "attempting to read to file " +
                ejbJarFile.getAbsolutePath() +
                ". Message: " +
                e.getMessage();
            cac.getMessager().printError(msg);
        }
        finally {
            try {
                if (ejbJarStream != null)
                    ejbJarStream.close();
View Full Code Here

    protected void updateWebApp(ControlAssemblyContext.WebAppModule webAssemblyContext,
                                EJBInfo ejbInfo,
                                String ejbLinkValue)
        throws ControlAssemblyException
    {
        ControlAssemblyContext cac = (ControlAssemblyContext)webAssemblyContext;

        System.err.println("EJBControlAssembler.updateWebApp() called");
        System.err.println("ejbInfo =" + ejbInfo);
        System.err.println("ejbLinkValue =" + ejbLinkValue );
        File webXmlFile = webAssemblyContext.getWebXml();
        FileInputStream webXmlStream;
        try {
                webXmlStream = new FileInputStream( webXmlFile );
        }
        catch (FileNotFoundException fnfe) {
            String msg = "EJBControlAssembler: " +
                        "caught FileNotFoundException attempting to read file " +
                        webXmlFile.getAbsolutePath() + ". Message: " +
                        fnfe.getMessage();
            cac.getMessager().printError(msg);
                return;
            }

            try
            {
                // parse the web.xml file
                DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
                dbf.setValidating(false);
                DocumentBuilder db = dbf.newDocumentBuilder();
                Document webAppDoc = db.parse(webXmlStream);

                webXmlStream.close();
                webXmlStream = null;

                WebDescriptorHandler webHandler = WebDescriptorHandler.getInstance();
                webHandler.assemble(webAppDoc, ejbInfo, ejbLinkValue);

                // overwrite existing web.xml file with new document
                writeXML(cac, webAppDoc, webXmlFile);
            }
            catch(IOException ioe) {
                String msg = "EJBControlAssembler: caught IOException " +
                    "attempting to write to file " +
                    webXmlFile.getAbsolutePath() +
                    ". Message: " +
                    ioe.getMessage();
                cac.getMessager().printError(msg);
            }
            catch (ParserConfigurationException e) {
                String msg = "EJBControlAssembler: caught ParserConfigurationException " +
                    "attempting to read to file " +
                    webXmlFile.getAbsolutePath() +
                    ". Message: " +
                    e.getMessage();
                cac.getMessager().printError(msg);
            }
            catch (SAXException e) {
                String msg = "EJBControlAssembler: caught SAXException " +
                    "attempting to read to file " +
                    webXmlFile.getAbsolutePath() +
                    ". Message: " +
                    e.getMessage();
                cac.getMessager().printError(msg);
            }
            finally {
                try {
                    if (webXmlStream != null)
                        webXmlStream.close();
View Full Code Here

                Class<? extends ControlAssembler> assemblerClass = a.assembler();
                if ( !assemblerClass.equals(DefaultControlAssembler.class) )
                {
                    ControlAssembler assembler = assemblerClass.newInstance();
                    Set<String> clients = controlTypeToClients.get( ct );
                    ControlAssemblyContext cac = factory.newInstance(
                        cl.loadClass(ct), null, clients, moduleRoot, moduleName, srcOutputRoot );
                    assembler.assemble( cac );
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.beehive.controls.api.assembly.ControlAssemblyContext

Copyright © 2018 www.massapicom. 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.