Package org.drools.guvnor.server.builder

Examples of org.drools.guvnor.server.builder.ModuleAssembler


                    .entity("Package [" + packageName + "] does not exist").build());
        }
        try {
            ModuleItem p = compileModuleIfNeeded(packageName);
            byte[] result = p.getCompiledBinaryBytes();
            ModuleAssembler moduleAssembler = ModuleAssemblerManager.getModuleAssembler(p.getFormat(), p, null);
            String fileName = packageName + "." + moduleAssembler.getBinaryExtension();
            return Response.ok(result).header("Content-Disposition", "attachment; filename=" + fileName).
                    header("Last-Modified", createDateFormat().format(this.convertToGmt(p.getLastModified()).getTime())).build();
        } catch (RuntimeException e) {
            //catch RulesRepositoryException and other exceptions. For example when the package does not exists.
            throw new WebApplicationException(e);
View Full Code Here


    @Path("{packageName}/versions/{versionNumber}/source")
    @Produces(MediaType.TEXT_PLAIN)
    public Response getHistoricalPackageSource(@PathParam("packageName") String packageName,
                                               @PathParam("versionNumber") long versionNumber) {
        ModuleItem item = rulesRepository.loadModule(packageName, versionNumber);
        ModuleAssembler moduleAssembler = ModuleAssemblerManager.getModuleAssembler(item.getFormat(), item, null);
        String drl = moduleAssembler.getCompiledSource();
        return Response.ok(drl).header("Content-Disposition", "attachment; filename=" + packageName).
                    header("Last-Modified", createDateFormat().format(this.convertToGmt(item.getLastModified()).getTime())).build();
    }
View Full Code Here

        ModuleItem p = rulesRepository.loadModule(packageName, versionNumber);
        byte[] result = p.getCompiledBinaryBytes();
       
        //REVISIT: https://issues.jboss.org/browse/GUVNOR-1232: Force a package rebuild before every package check in operation.
        if (result != null) {
            ModuleAssembler moduleAssembler = ModuleAssemblerManager.getModuleAssembler(p.getFormat(), p, null);
            String fileName = packageName + "." + moduleAssembler.getBinaryExtension();
            return Response.ok(result).header("Content-Disposition", "attachment; filename=" + fileName).
                    header("Last-Modified", createDateFormat().format(this.convertToGmt(p.getLastModified()).getTime())).build();
        } else {
            return Response.status(500).entity("This package version has no compiled binary").type("text/plain").build();
        }
View Full Code Here

TOP

Related Classes of org.drools.guvnor.server.builder.ModuleAssembler

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.