Example usage for com.liferay.portal.kernel.deploy.hot HotDeployException HotDeployException

List of usage examples for com.liferay.portal.kernel.deploy.hot HotDeployException HotDeployException

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.deploy.hot HotDeployException HotDeployException.

Prototype

public HotDeployException(String msg, Throwable cause) 

Source Link

Usage

From source file:eu.ibacz.extlet.conflict.ExtletConflictRegister.java

License:Open Source License

public void register(List<File> jars) throws HotDeployException {
    int count = 0;
    synchronized (lock) {
        count = extletsOverridenFiles.size();
    }/* ww w.j ava  2  s.  c  om*/
    for (File jar : jars) {
        try {
            RegistryInfo info = createRegistryInfo(jar);
            registerClasses(info);
        } catch (IOException ex) {
            throw new HotDeployException("Cannot open extlet jar file for conflict checking", ex);
        }
    }
    synchronized (lock) {
        count = extletsOverridenFiles.size() - count;
    }
    _log.info("Conflict checking: Indexed " + count + " files for " + event.getServletContextName());
}

From source file:eu.ibacz.extlet.conflict.ExtletConflictRegister.java

License:Open Source License

public void checkConflict(List<File> jars) throws HotDeployException {
    _log.info("Checking conflict files for " + event.getServletContextName());
    for (File jar : jars) {
        try {//from   www.ja va 2 s .c  o m
            RegistryInfo info = createRegistryInfo(jar);
            checkConflict(info);
        } catch (IOException ex) {
            throw new HotDeployException("Cannot open extlet jar file for conflict checking", ex);
        }
    }
    _log.info("No conflicts found - OK");
}

From source file:eu.ibacz.extlet.deploy.hot.ExtletHotDeployer.java

License:Open Source License

/**
 * Returns files from webapp that should be copied into the portal WEB-INF/lib location
 *///ww w. ja  v  a 2  s.  c  o m
public File[] getExtletImplJars() throws HotDeployException {
    String[] extletImplJarNames = getExtletImplJarNames();
    File[] extletImplJars = new File[extletImplJarNames.length];
    for (int i = 0; i < extletImplJarNames.length; i++) {
        try {
            File extletImplJar = getApplicationFile(extletImplJarNames[i]);
            extletImplJars[i] = extletImplJar;
        } catch (MalformedURLException ex) {
            throw new HotDeployException(ex.getMessage(), ex);
        }
    }
    return extletImplJars;
}

From source file:eu.ibacz.extlet.deploy.hot.ExtletHotDeployer.java

License:Open Source License

/**
 * Returns files from webapp that should be copied into the portal service location
 *//* w  w w.  j a  va  2s.  com*/
public File[] getExtletServiceJars() throws HotDeployException {
    String[] extletServiceJarNames = getExtletServiceJarNames();

    File[] extletServiceJars = new File[extletServiceJarNames.length];
    for (int i = 0; i < extletServiceJarNames.length; i++) {
        try {
            File extletServiceJar = getApplicationFile(extletServiceJarNames[i]);
            extletServiceJars[i] = extletServiceJar;
        } catch (MalformedURLException ex) {
            throw new HotDeployException(ex.getMessage(), ex);
        }
    }
    return extletServiceJars;
}

From source file:eu.ibacz.extlet.deploy.hot.ExtletHotDeployer.java

License:Open Source License

/**
 * Tries to locate path for the classloader where the services are saved.<br />
 *
 * Use the ReleaseInfo class from portal-kernel.jar for locating the directory.
 * @return directory where portal-kernel.jar is saved
 * @throws com.liferay.portal.kernel.deploy.hot.HotDeployException
 *///  ww w  .  j  av  a  2s. com
private File getPortalServiceJarParent() throws HotDeployException {
    try {
        File file = new File(com.liferay.portal.kernel.util.ReleaseInfo.class.getProtectionDomain()
                .getCodeSource().getLocation().toURI().getPath());
        if (_log.isDebugEnabled()) {
            _log.info("Path to global classloader: " + file.getParent());
        }
        return file.getParentFile();
    } catch (URISyntaxException e) {
        throw new HotDeployException("Cannot localize directory for global classloader!", e);
    }
}

From source file:eu.ibacz.extlet.deploy.hot.ExtletPropsUtils.java

License:Open Source License

protected static Properties getExtletProperties(HotDeployEvent event) throws HotDeployException {
    for (String propertiesLocation : EXTLET_PROPERTIES) {
        if (_log.isDebugEnabled()) {
            _log.debug("Loading extlet properties: " + propertiesLocation);
        }//from   w  ww  .ja  va  2 s.  c o  m
        URL properties;
        try {
            properties = event.getServletContext().getResource(propertiesLocation);
        } catch (MalformedURLException e) {
            throw new HotDeployException("Cannot open property file", e);
        }

        if (_log.isDebugEnabled()) {
            _log.debug("Loading extlet properties from " + properties);
        }
        InputStream is = null;

        try {
            if (properties != null) {
                is = properties.openStream();
            }

            if (is != null) {
                String propertiesString = StringUtil.read(is);

                if (_log.isDebugEnabled()) {
                    _log.debug("Extlet properties loaded from " + properties);
                }
                return PropertiesUtil.load(propertiesString);
            }

        } catch (Exception e) {
            _log.error(event.getServletContextName() + ": " + e.toString(), e);
        } finally {
            if (is != null) {
                try {
                    is.close();
                } catch (IOException ioe) {
                    if (_log.isDebugEnabled()) {
                        _log.debug(ioe);
                    }
                }
            }
        }
    }

    if (_log.isDebugEnabled()) {
        _log.debug(event.getServletContextName() + " does not have any of these: "
                + Arrays.asList(EXTLET_PROPERTIES));
    }

    return null;
}