Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unzip plugin zip file in loadPluginFromPath() #140

Merged
merged 2 commits into from
Apr 6, 2017

Conversation

janhoy
Copy link
Member

@janhoy janhoy commented Apr 5, 2017

This is an attempt for auto unzip on load, so UpdateManager can install and update without problems. Was this the approach you had in mind?

Fixes #132

@coveralls
Copy link

coveralls commented Apr 5, 2017

Coverage Status

Coverage increased (+2.3%) to 27.693% when pulling 2df3827 on cominvent:unzip-on-load into c9f98de on decebals:master.

@decebals
Copy link
Member

decebals commented Apr 6, 2017

The code looks good with one observation on my part.
The part with plugin packed as a zip file and the unpack process before plugin loading, is available in Default implementation (DefaultPluginManager, DefaultRepository, ...), the AbstractPluginManager knows nothing about this aspect. From this reason I think that it's a good idea to move the expand zip line from AbstractPluginManager.loadPluginFromPath to DefaultPluginManager.loadPluginFromPath.

// pseudo code
public class DefaultPluginManager extends AbstractPluginManager {
 
    ... other methods

    Override
    protected PluginWrapper loadPluginFromPath(Path pluginPath) throws PluginException {
        // first unzip any ZIP files
        try {
            pluginPath = FileUtils.expandIfZip(pluginPath);
        } catch (Exception e) {
            log.warn("Failed to unzip " + pluginPath, e);
            return null;
        }

        return super.loadPluginFromPath(pluginPath); // where pluginPath is the value returned by expandIfZip
    }

}

Did what I said make sense to you?

@coveralls
Copy link

coveralls commented Apr 6, 2017

Coverage Status

Coverage increased (+2.2%) to 27.632% when pulling 8aa91a3 on cominvent:unzip-on-load into c9f98de on decebals:master.

@decebals decebals merged commit 39ef17a into pf4j:master Apr 6, 2017
@decebals
Copy link
Member

decebals commented Apr 6, 2017

Excellent. Thanks!

@janhoy janhoy deleted the unzip-on-load branch April 6, 2017 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants