Package org.apache.pluto.portalImpl.om.portlet.impl

Examples of org.apache.pluto.portalImpl.om.portlet.impl.PortletApplicationDefinitionImpl


            // modified by YCLI: START :: to ignore extra elements and attributes
            unmarshaller.setIgnoreExtraElements(true);
            unmarshaller.setIgnoreExtraAttributes(true);
            // modified by YCLI: END

            PortletApplicationDefinitionImpl portletApp =
                (PortletApplicationDefinitionImpl) unmarshaller.unmarshal(
                    portletDocument);

            // refill structure with necessary information
            Vector structure = new Vector();
            structure.add(webModule);
            structure.add(null);
            structure.add(null);
            portletApp.preBuild(structure);

            if (debug) {
                System.out.println(portletApp);
            }

            // now generate web part

            WebApplicationDefinitionImpl webApp = null;

            if (webXml.exists()) {
                org.w3c.dom.Document webDocument =
                    XmlParser.parseWebXml(new FileInputStream(webXml));

                Unmarshaller unmarshallerWeb = new Unmarshaller(mappingWebXml);

                // modified by YCLI: START :: to ignore extra elements and attributes
                unmarshallerWeb.setIgnoreExtraElements(true);
                unmarshallerWeb.setIgnoreExtraAttributes(true);
                // modified by YCLI: END

                webApp =
                    (WebApplicationDefinitionImpl) unmarshallerWeb.unmarshal(
                        webDocument);
            } else {
                webApp = new WebApplicationDefinitionImpl();
                DisplayNameImpl dispName = new DisplayNameImpl();
                dispName.setDisplayName(webModule);
                dispName.setLocale(Locale.ENGLISH);
                DisplayNameSetImpl dispSet = new DisplayNameSetImpl();
                dispSet.add(dispName);
                webApp.setDisplayNames(dispSet);
                DescriptionImpl desc = new DescriptionImpl();
                desc.setDescription("Automated generated Application Wrapper");
                desc.setLocale(Locale.ENGLISH);
                DescriptionSetImpl descSet = new DescriptionSetImpl();
                descSet.add(desc);
                webApp.setDescriptions(descSet);
            }

            org.apache.pluto.om.ControllerFactory controllerFactory =
                new org.apache.pluto.portalImpl.om.ControllerFactoryImpl();

            ServletDefinitionListCtrl servletDefinitionSetCtrl =
                (ServletDefinitionListCtrl) controllerFactory.get(
                    webApp.getServletDefinitionList());
            Collection servletMappings = webApp.getServletMappings();

            Iterator portlets =
                portletApp.getPortletDefinitionList().iterator();
            while (portlets.hasNext()) {

                PortletDefinition portlet = (PortletDefinition) portlets.next();

                // check if already exists
View Full Code Here


            // modified by YCLI: START :: to ignore extra elements and attributes
            unmarshaller.setIgnoreExtraElements(true);
            unmarshaller.setIgnoreExtraAttributes(true);
            // modified by YCLI: END

            PortletApplicationDefinitionImpl portletApp =
                (PortletApplicationDefinitionImpl) unmarshaller.unmarshal(
                    portletDocument);

            // refill structure with necessary information
            Vector structure = new Vector();
            structure.add(webModule);
            structure.add(null);
            structure.add(null);
            portletApp.preBuild(structure);

            if (debug) {
                System.out.println(portletApp);
            }

            // now generate web part

            WebApplicationDefinitionImpl webApp = null;

            if (webXml.exists()) {
                org.w3c.dom.Document webDocument =
                    XmlParser.parseWebXml(new FileInputStream(webXml));

                Unmarshaller unmarshallerWeb = new Unmarshaller(mappingWebXml);

                // modified by YCLI: START :: to ignore extra elements and attributes
                unmarshallerWeb.setIgnoreExtraElements(true);
                unmarshallerWeb.setIgnoreExtraAttributes(true);
                // modified by YCLI: END

                webApp =
                    (WebApplicationDefinitionImpl) unmarshallerWeb.unmarshal(
                        webDocument);
            } else {
                webApp = new WebApplicationDefinitionImpl();
                DisplayNameImpl dispName = new DisplayNameImpl();
                dispName.setDisplayName(webModule);
                dispName.setLocale(Locale.ENGLISH);
                DisplayNameSetImpl dispSet = new DisplayNameSetImpl();
                dispSet.add(dispName);
                webApp.setDisplayNames(dispSet);
                DescriptionImpl desc = new DescriptionImpl();
                desc.setDescription("Automated generated Application Wrapper");
                desc.setLocale(Locale.ENGLISH);
                DescriptionSetImpl descSet = new DescriptionSetImpl();
                descSet.add(desc);
                webApp.setDescriptions(descSet);
            }

            org.apache.pluto.om.ControllerFactory controllerFactory =
                new org.apache.pluto.portalImpl.om.ControllerFactoryImpl();

            ServletDefinitionListCtrl servletDefinitionSetCtrl =
                (ServletDefinitionListCtrl) controllerFactory.get(
                    webApp.getServletDefinitionList());
            Collection servletMappings = webApp.getServletMappings();

            Iterator portlets =
                portletApp.getPortletDefinitionList().iterator();
            while (portlets.hasNext()) {

                PortletDefinition portlet = (PortletDefinition) portlets.next();

                // check if already exists
View Full Code Here

            InputSource source = new InputSource(new FileInputStream(portletXml));
            source.setSystemId(portletXml.toURL().toExternalForm());
           
            Unmarshaller unmarshaller = new Unmarshaller(this.mappingPortletXml);
      unmarshaller.setIgnoreExtraElements(true);
            PortletApplicationDefinitionImpl portletApp =
                (PortletApplicationDefinitionImpl)unmarshaller.unmarshal( source );

            WebApplicationDefinitionImpl webApp = null;

            if (webXml.exists())
            {
                org.w3c.dom.Document webDocument =
                XmlParser.parseWebXml(new FileInputStream(webXml));

                unmarshaller = new Unmarshaller(this.mappingWebXml);
        unmarshaller.setIgnoreExtraElements(true);
                webApp =
                    (WebApplicationDefinitionImpl)unmarshaller.unmarshal(webDocument);

                Vector structure = new Vector();
                structure.add(portletApp);
                structure.add("/" + resolveURI(webModule));

                webApp.postLoad(structure);

                // refill structure with necessary information
                webApp.preBuild(structure);

                webApp.postBuild(structure);

                if (log.isDebugEnabled())
                {
                    log.debug(webApp.toString());
                }
            }
            else
            {
                if (log.isDebugEnabled())
                {
                    log.debug("no web.xml...");
                }
                Vector structure = new Vector();
                structure.add("/" + resolveURI(webModule));
                structure.add(null);
                structure.add(null);

                portletApp.postLoad(structure);
               
                portletApp.preBuild(structure);
               
                portletApp.postBuild(structure);
            }

            registry.add( portletApp );

            if (log.isDebugEnabled())
            {
                if (webApp!=null)
                {
                    log.debug("Dumping content of web.xml...");
                    log.debug(webApp.toString());
                }
                log.debug("Dumping content of portlet.xml...");
                log.debug(portletApp.toString());
            }
        }

    }
View Full Code Here

            // modified by YCLI: START :: to ignore extra elements and attributes
            unmarshaller.setIgnoreExtraElements(true);
            unmarshaller.setIgnoreExtraAttributes(true);
            // modified by YCLI: END

            PortletApplicationDefinitionImpl portletApp =
                (PortletApplicationDefinitionImpl) unmarshaller.unmarshal(
                    portletDocument);

            // refill structure with necessary information
            Vector structure = new Vector();
            structure.add(webModule);
            structure.add(null);
            structure.add(null);
            portletApp.preBuild(structure);

            if (debug) {
                System.out.println(portletApp);
            }

            // now generate web part

            WebApplicationDefinitionImpl webApp = null;

            if (webXml.exists()) {
                org.w3c.dom.Document webDocument =
                    XmlParser.parseWebXml(new FileInputStream(webXml));

                Unmarshaller unmarshallerWeb = new Unmarshaller(mappingWebXml);

                // modified by YCLI: START :: to ignore extra elements and attributes
                unmarshallerWeb.setIgnoreExtraElements(true);
                unmarshallerWeb.setIgnoreExtraAttributes(true);
                // modified by YCLI: END

                webApp =
                    (WebApplicationDefinitionImpl) unmarshallerWeb.unmarshal(
                        webDocument);
            } else {
                webApp = new WebApplicationDefinitionImpl();
                DisplayNameImpl dispName = new DisplayNameImpl();
                dispName.setDisplayName(webModule);
                dispName.setLocale(Locale.ENGLISH);
                DisplayNameSetImpl dispSet = new DisplayNameSetImpl();
                dispSet.add(dispName);
                webApp.setDisplayNames(dispSet);
                DescriptionImpl desc = new DescriptionImpl();
                desc.setDescription("Automated generated Application Wrapper");
                desc.setLocale(Locale.ENGLISH);
                DescriptionSetImpl descSet = new DescriptionSetImpl();
                descSet.add(desc);
                webApp.setDescriptions(descSet);
            }

            org.apache.pluto.om.ControllerFactory controllerFactory =
                new org.apache.pluto.portalImpl.om.ControllerFactoryImpl();

            ServletDefinitionListCtrl servletDefinitionSetCtrl =
                (ServletDefinitionListCtrl) controllerFactory.get(
                    webApp.getServletDefinitionList());
            Collection servletMappings = webApp.getServletMappings();

            Iterator portlets =
                portletApp.getPortletDefinitionList().iterator();
            while (portlets.hasNext()) {

                PortletDefinition portlet = (PortletDefinition) portlets.next();

                // check if already exists
View Full Code Here

            unmarshaller.setEntityResolver(new EntityResolver(Constants.RES_PORTLET_DTDS, Constants.RES_PORTLET_DTD_NAMES));
        } catch (MappingException e) {
            throw (UnavailableException) new UnavailableException("Unable to construct unmarshaller for portlet.xml").initCause(e);
        }
        unmarshaller.setIgnoreExtraElements(true);
        PortletApplicationDefinitionImpl portletApp;
        try {
            portletApp = (PortletApplicationDefinitionImpl) unmarshaller.unmarshal(source);
        } catch (MarshalException e) {
            throw (UnavailableException) new UnavailableException("Unable to unmarshal portlet.xml from context " + appContext.getServletContextName()).initCause(e);
        } catch (ValidationException e) {
View Full Code Here

            unmarshaller.setEntityResolver(new EntityResolver(Constants.RES_PORTLET_DTDS, Constants.RES_PORTLET_DTD_NAMES));
        } catch (MappingException e) {
            throw (UnavailableException) new UnavailableException("Unable to construct unmarshaller for portlet.xml").initCause(e);
        }
        unmarshaller.setIgnoreExtraElements(true);
        PortletApplicationDefinitionImpl portletApp;
        try {
            portletApp = (PortletApplicationDefinitionImpl) unmarshaller.unmarshal(source);
        } catch (MarshalException e) {
            throw (UnavailableException) new UnavailableException("Unable to unmarshal portlet.xml from context " + appContext.getServletContextName()).initCause(e);
        } catch (ValidationException e) {
View Full Code Here

            InputSource source = new InputSource(new FileInputStream(portletXml));
            source.setSystemId(portletXml.toURL().toExternalForm());
           
            Unmarshaller unmarshaller = new Unmarshaller(this.mappingPortletXml);
      unmarshaller.setIgnoreExtraElements(true);
            PortletApplicationDefinitionImpl portletApp =
                (PortletApplicationDefinitionImpl)unmarshaller.unmarshal( source );

            WebApplicationDefinitionImpl webApp = null;

            if (webXml.exists())
            {
                org.w3c.dom.Document webDocument =
                XmlParser.parseWebXml(new FileInputStream(webXml));

                unmarshaller = new Unmarshaller(this.mappingWebXml);
        unmarshaller.setIgnoreExtraElements(true);
                webApp =
                    (WebApplicationDefinitionImpl)unmarshaller.unmarshal(webDocument);

                Vector structure = new Vector();
                structure.add(portletApp);
                structure.add("/" + resolveURI(webModule));

                webApp.postLoad(structure);

                // refill structure with necessary information
                webApp.preBuild(structure);

                webApp.postBuild(structure);

                if (log.isDebugEnabled())
                {
                    log.debug(webApp.toString());
                }
            }
            else
            {
                if (log.isDebugEnabled())
                {
                    log.debug("no web.xml...");
                }
                Vector structure = new Vector();
                structure.add("/" + resolveURI(webModule));
                structure.add(null);
                structure.add(null);

                portletApp.postLoad(structure);
               
                portletApp.preBuild(structure);
               
                portletApp.postBuild(structure);
            }

            registry.add( portletApp );

            if (log.isDebugEnabled())
            {
                if (webApp!=null)
                {
                    log.debug("Dumping content of web.xml...");
                    log.debug(webApp.toString());
                }
                log.debug("Dumping content of portlet.xml...");
                log.debug(portletApp.toString());
            }
        }

    }
View Full Code Here

            unmarshaller.setEntityResolver(new EntityResolver(Constants.RES_PORTLET_DTDS, Constants.RES_PORTLET_DTD_NAMES));
        } catch (MappingException e) {
            throw (UnavailableException) new UnavailableException("Unable to construct unmarshaller for portlet.xml at context " + contextName).initCause(e);
        }
        unmarshaller.setIgnoreExtraElements(true);
        PortletApplicationDefinitionImpl portletApp;
        try {
            portletApp = (PortletApplicationDefinitionImpl) unmarshaller.unmarshal(source);
        } catch (MarshalException e) {
            throw (UnavailableException) new UnavailableException("Unable to unmarshal portlet.xml from context " + contextName).initCause(e);
        } catch (ValidationException e) {
View Full Code Here

            // modified by YCLI: START :: to ignore extra elements and attributes
            unmarshaller.setIgnoreExtraElements(true);
            unmarshaller.setIgnoreExtraAttributes(true);
            // modified by YCLI: END

            PortletApplicationDefinitionImpl portletApp =
                (PortletApplicationDefinitionImpl) unmarshaller.unmarshal(
                    portletDocument);

            // refill structure with necessary information
            Vector structure = new Vector();
            structure.add(webModule);
            structure.add(null);
            structure.add(null);
            portletApp.preBuild(structure);

            if (debug) {
                System.out.println(portletApp);
            }

            // now generate web part

            WebApplicationDefinitionImpl webApp = null;

            if (webXml.exists()) {
                org.w3c.dom.Document webDocument =
                    XmlParser.parseWebXml(new FileInputStream(webXml));

                Unmarshaller unmarshallerWeb = new Unmarshaller(mappingWebXml);

                // modified by YCLI: START :: to ignore extra elements and attributes
                unmarshallerWeb.setIgnoreExtraElements(true);
                unmarshallerWeb.setIgnoreExtraAttributes(true);
                // modified by YCLI: END

                webApp =
                    (WebApplicationDefinitionImpl) unmarshallerWeb.unmarshal(
                        webDocument);
            } else {
                webApp = new WebApplicationDefinitionImpl();
                DisplayNameImpl dispName = new DisplayNameImpl();
                dispName.setDisplayName(webModule);
                dispName.setLocale(Locale.ENGLISH);
                DisplayNameSetImpl dispSet = new DisplayNameSetImpl();
                dispSet.add(dispName);
                webApp.setDisplayNames(dispSet);
                DescriptionImpl desc = new DescriptionImpl();
                desc.setDescription("Automated generated Application Wrapper");
                desc.setLocale(Locale.ENGLISH);
                DescriptionSetImpl descSet = new DescriptionSetImpl();
                descSet.add(desc);
                webApp.setDescriptions(descSet);
            }

            org.apache.pluto.om.ControllerFactory controllerFactory =
                new org.apache.pluto.portalImpl.om.ControllerFactoryImpl();

            ServletDefinitionListCtrl servletDefinitionSetCtrl =
                (ServletDefinitionListCtrl) controllerFactory.get(
                    webApp.getServletDefinitionList());
            Collection servletMappings = webApp.getServletMappings();

            Iterator portlets =
                portletApp.getPortletDefinitionList().iterator();
            while (portlets.hasNext()) {

                PortletDefinition portlet = (PortletDefinition) portlets.next();

                // check if already exists
View Full Code Here

     * @return the portlet application definition (portlet.xml)
     * @throws IOException
     */
    public static PortletApplicationDefinition prepareArchive(File file, File tmp, String appName) throws IOException
    {
        PortletApplicationDefinitionImpl portletApp = null;
        try
        {
          Mapping pdmXml = new Mapping();
            try
            {
              URL url = Deploy.class.getResource("/" + PORTLET_MAPPING);
                pdmXml.loadMapping(url);
            }
            catch (Exception e)
            {
                throw new IOException("Failed to load mapping file " + PORTLET_MAPPING);
            }
            
            // Open the jar file.
            JarFile jar = new JarFile(file);

            // Extract and parse portlet.xml
            ZipEntry portletEntry = jar.getEntry(PORTLET_XML);
            if (portletEntry == null)
            {
                throw new IOException("Unable to find portlet.xml");
            }
           
            InputStream pisDebug = jar.getInputStream(portletEntry);
            StringBuffer sb = new StringBuffer();
            int i;
            while((i = pisDebug.read()) > -1)
            {
                sb.append((char)i);
            }
            pisDebug.close();
           
      InputSource xmlSource = new InputSource(new ByteArrayInputStream(sb.toString().getBytes("UTF-8")));
      DOMParser parser = new DOMParser();
      parser.parse(xmlSource);
      Document portletDocument = parser.getDocument();
           
            //InputStream pis = jar.getInputStream(portletEntry);
            //Document portletDocument = XmlParser.parsePortletXml(pis);
            //pis.close();
            InputStream pis = jar.getInputStream(portletEntry);
           
            ZipEntry webEntry = jar.getEntry(WEB_XML);
            InputStream wis = null;
            if (webEntry != null)
            {
                wis = jar.getInputStream(webEntry);
                /*  webDocument = XmlParser.parseWebXml(wis);
                wis.close();
                */
            }
           
            Unmarshaller unmarshaller = new Unmarshaller(pdmXml);
            unmarshaller.setWhitespacePreserve(true);
            unmarshaller.setIgnoreExtraElements(true);
            unmarshaller.setIgnoreExtraAttributes(true);

            portletApp = (PortletApplicationDefinitionImpl) unmarshaller.unmarshal(portletDocument);

            // refill structure with necessary information
            Vector structure = new Vector();
            structure.add(appName);
            structure.add(null);
            structure.add(null);
            portletApp.preBuild(structure);

            /*
            // now generate web part
            WebApplicationDefinitionImpl webApp = null;
            if (webDocument != null) {
View Full Code Here

TOP

Related Classes of org.apache.pluto.portalImpl.om.portlet.impl.PortletApplicationDefinitionImpl

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.