class PackageNameWhiteListServiceImpl implements PackageNameWhiteListService {

    @Override
    public WhiteList filterPackageNames(final Module module,
                                        final Collection<String> packageNames) {
        if (packageNames == null) {
            return new WhiteList();
        } else if (module instanceof KieModule) {

            final WhiteList whiteList = load(((KieModule) module).getPackageNamesWhiteListPath());

            if (whiteList.isEmpty()) {
                return new WhiteList(packageNames);
            } else {
                for (Package aPackage : moduleService.resolvePackages(module)) {
                    whiteList.add(aPackage.getPackageName());
                }

                return new PackageNameWhiteListFilter(packageNames,
                                                      whiteList).getFilteredPackageNames();
            }
        } else {
            return new WhiteList(packageNames);
        }
    }

    public  PackageNameWhiteListServiceImpl();
    @Inject public  PackageNameWhiteListServiceImpl(final @Named("ioStrategy") IOService ioService,
                                           final KieModuleService moduleService,
                                           final PackageNameWhiteListLoader loader,
                                           final PackageNameWhiteListSaver saver);

}