Package org.apache.jetspeed.deployment

Examples of org.apache.jetspeed.deployment.DeploymentObject


        }
    }
   
    public synchronized DeploymentStatus deploy(File aFile) throws DeploymentException
    {
        DeploymentObject deploymentObject = new StandardDeploymentObject(aFile);
        DeploymentEvent event = null;
        try
        {
            event = new DeploymentEventImpl(deploymentObject);
            dispatch(event);
        }
        finally
        {
            if ( deploymentObject != null )
            {
                try
                {
                    deploymentObject.close();
                }
                catch (IOException e)
                {                   
                }
            }
View Full Code Here


        }
    }
   
    public synchronized DeploymentStatus deploy(File aFile) throws DeploymentException
    {
        DeploymentObject deploymentObject = new StandardDeploymentObject(aFile);
        DeploymentEvent event = null;
        try
        {
            event = new DeploymentEventImpl(deploymentObject);
            dispatch(event);
        }
        finally
        {
            if ( deploymentObject != null )
            {
                try
                {
                    deploymentObject.close();
                }
                catch (IOException e)
                {                   
                }
            }
View Full Code Here

        }
    }
   
    public synchronized DeploymentStatus deploy(File aFile) throws DeploymentException
    {
        DeploymentObject deploymentObject = new StandardDeploymentObject(aFile);
        DeploymentEvent event = null;
        try
        {
            event = new DeploymentEventImpl(deploymentObject);
            dispatch(event);
        }
        finally
        {
            if ( deploymentObject != null )
            {
                try
                {
                    deploymentObject.close();
                }
                catch (IOException e)
                {                   
                }
            }
View Full Code Here

    protected void doDeploy( DeploymentEvent event ) throws DeploymentException
    {
        InputStream portletXmlStream = null;
        try
        {
            DeploymentObject deploymentObj = event.getDeploymentObject();
            portletXmlStream = deploymentObj.getConfiguration("WEB-INF/portlet.xml");
            if (portletXmlStream == null)
            {
                return;
            }

            String fileName = deploymentObj.getName();
            boolean isLocal = fileName.startsWith("jetspeed-");

            log.info("Loading portlet application from web archive " + deploymentObj.getPath());
            SAXBuilder builder = new SAXBuilder();
            Document portletXml = builder.build(portletXmlStream);
            Element portletApp = portletXml.getRootElement();
            String id = portletApp.getAttributeValue("id");
            if (id == null)
            {

                String warFileName = fileName;
                int extensionIdx = warFileName.lastIndexOf(".war");
                id = warFileName.substring(0, extensionIdx);
                log.info("Application id not defined in portlet.xml so using war name " + id);
            }

            PortletApplicationWar paWar = new PortletApplicationWar(deploymentObj.getFileObject(), id, "/" + id );

            if (registry.getPortletApplicationByIdentifier(id) != null
                    && !event.getEventType().equals(DeploymentEvent.EVENT_TYPE_REDEPLOY))
            {
                log.info("Portlet application \"" + id + "\""
                        + " already been registered.  Skipping initial deployment.");
                // still need to register the filename to the app name so
                // undeploy works correctly
                appNameToFile.put(deploymentObj.getPath(), id);
                if (isLocal)
                {               
                    portletFactory.addClassLoader(
                        registry.getPortletApplicationByIdentifier(id).getId().toString(),
                        paWar.createClassloader(getClass().getClassLoader()));
                }
                else
                {
                    try
                    {
                        ClassLoader classloader = createPortletClassloader(getClass().getClassLoader(), id);
                        if (classloader != null)
                        {
                            portletFactory.addClassLoader(
                                registry.getPortletApplicationByIdentifier(id).getId().toString(),
                                classloader);
                        }
                    }
                    catch (IOException e1)
                    {
                        log.info("Could not add Portlet Class Loader: " + id);
                    }
                }
                return;
            }

            log.info("Preparing to (re) deploy portlet app \"" + id + "\"");

            if (event.getEventType().equals(DeploymentEvent.EVENT_TYPE_DEPLOY))
            {

                if (isLocal)
                {
                    log.info(fileName + " will be registered as a local portlet applicaiton.");                   
                    pam.register(paWar);
                    MutablePortletApplication mpa = registry.getPortletApplicationByIdentifier(id);
                    if (mpa != null)
                    {
                        portletFactory.addClassLoader(
                            mpa.getId().toString(),
                            paWar.createClassloader(getClass().getClassLoader()));
                    }
                }
                else
                {
                    log.info("Deploying portlet applicaion WAR " + fileName);
                    pam.deploy(paWar);
                    try
                    {
                        ClassLoader classloader = createPortletClassloader(getClass().getClassLoader(), id);
                        if (classloader != null)
                        {
                            MutablePortletApplication mpa = registry.getPortletApplicationByIdentifier(id);
                            if (mpa != null)
                            {
                                portletFactory.addClassLoader(mpa.getId().toString(), classloader);
                            }
                        }
                    }
                    catch (IOException e1)
                    {
                        log.info("Could not add Portlet Class Loader: " + id);
                    }
                }
            }
            else if (event.getEventType().equals(DeploymentEvent.EVENT_TYPE_REDEPLOY))
            {
                if (isLocal)
                {
                    //TODO: get this working
                   
                }
                else
                {
                    log.info("Re-deploying portlet applicaion WAR " + fileName);
                    pam.redeploy(paWar);
                }
               
            }

            appNameToFile.put(deploymentObj.getPath(), id);
            log.info("Portlet app \"" + id + "\" " + "successfuly (re)deployed.");
        }
        catch (Exception e)
        {
            String msg = "Error (re)deploying portlet app: " + e.toString();
View Full Code Here

        {
            // check for new deployment
            File aFile = stagedFiles[i];
            if (!isDeployed(aFile.getAbsolutePath()))
            {
                DeploymentObject deploymentObject = null;
                try
                {
                    try
                    {
                        deploymentObject = new StandardDeploymentObject(aFile);
                    }
                    catch (FileNotDeployableException e)
                    {
                        // log.info(e.getMessage());
                        continue;
                    }

                    DeploymentEvent event = new DeploymentEventImpl(DeploymentEvent.EVENT_TYPE_DEPLOY, deploymentObject);
                    dispatch(event);
                    if (event.getStatus() == DeploymentEvent.STATUS_OKAY)
                    {
                        deployedFiles.add(aFile.getAbsolutePath());
                        // record the lastModified so we can watch for
                        // re-deployment
                        long lastModified = aFile.lastModified();
                        fileDates.put(aFile.getAbsolutePath(), new Long(lastModified));
                    }
                    else
                    {
                        log.error("Error deploying " + aFile.getAbsolutePath());
                    }

                }
                catch (Exception e1)
                {
                    log.error("Error deploying " + aFile.getAbsolutePath(), e1);
                }
                finally
                {
                    if (deploymentObject != null)
                    {
                        try
                        {
                            deploymentObject.close();
                        }
                        catch (IOException e)
                        {

                        }
View Full Code Here

            long currentModifiedDate = aFile.lastModified();

            if (currentModifiedDate > lastModifiedDate)
            {

                DeploymentObject deploymentObject = null;
                try
                {
                    deploymentObject = new StandardDeploymentObject(aFile);
                    DeploymentEvent event = new DeploymentEventImpl(DeploymentEvent.EVENT_TYPE_REDEPLOY,
                            deploymentObject);
                    log.info("Re-deploying " + aFile.getAbsolutePath());
                    dispatch(event);

                    if (event.getStatus() == DeploymentEvent.STATUS_OKAY)
                    {
                        fileDates.put(fileName, new Long(currentModifiedDate));
                    }
                    else
                    {
                        log.error("Error redeploying " + aFile.getAbsolutePath());
                    }

                }
                catch (Exception e1)
                {
                    log.error("Error undeploying " + aFile.getAbsolutePath(), e1);
                }
                finally
                {
                    if (deploymentObject != null)
                    {
                        try
                        {
                            // we are responsible for reclaiming the FSObject's
                            // resource
                            deploymentObject.close();
                        }
                        catch (IOException e)
                        {

                        }
View Full Code Here

        }
    }
   
    public synchronized DeploymentStatus deploy(File aFile) throws DeploymentException
    {
        DeploymentObject deploymentObject = new StandardDeploymentObject(aFile);
        DeploymentEvent event = null;
        try
        {
            event = new DeploymentEventImpl(deploymentObject);
            dispatch(event);
        }
        finally
        {
            if ( deploymentObject != null )
            {
                try
                {
                    deploymentObject.close();
                }
                catch (IOException e)
                {                   
                }
            }
View Full Code Here

        }
    }
   
    public synchronized DeploymentStatus deploy(File aFile) throws DeploymentException
    {
        DeploymentObject deploymentObject = new StandardDeploymentObject(aFile);
        DeploymentEvent event = null;
        try
        {
            event = new DeploymentEventImpl(deploymentObject);
            dispatch(event);
        }
        finally
        {
            if ( deploymentObject != null )
            {
                try
                {
                    deploymentObject.close();
                }
                catch (IOException e)
                {                   
                }
            }
View Full Code Here

        }
    }
   
    public synchronized DeploymentStatus deploy(File aFile) throws DeploymentException
    {
        DeploymentObject deploymentObject = new StandardDeploymentObject(aFile);
        DeploymentEvent event = null;
        try
        {
            event = new DeploymentEventImpl(deploymentObject);
            dispatch(event);
        }
        finally
        {
            if ( deploymentObject != null )
            {
                try
                {
                    deploymentObject.close();
                }
                catch (IOException e)
                {                   
                }
            }
View Full Code Here

        }
    }
   
    public synchronized DeploymentStatus deploy(File aFile) throws DeploymentException
    {
        DeploymentObject deploymentObject = new StandardDeploymentObject(aFile);
        DeploymentEvent event = null;
        try
        {
            event = new DeploymentEventImpl(deploymentObject);
            dispatch(event);
        }
        finally
        {
            if ( deploymentObject != null )
            {
                try
                {
                    deploymentObject.close();
                }
                catch (IOException e)
                {                   
                }
            }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.deployment.DeploymentObject

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.