Package org.drools.guvnor.server.builder

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


    @Path("{packageName}/source")
    @Produces(MediaType.TEXT_PLAIN)
    public Response getPackageSource(@PathParam("packageName") String packageName) {
        try {
            ModuleItem moduleItem = rulesRepository.loadModule(packageName);
            ModuleAssembler moduleAssembler = ModuleAssemblerManager.getModuleAssembler(moduleItem.getFormat(), moduleItem, null);
            String drl = moduleAssembler.getCompiledSource();
            return Response.ok(drl).header("Content-Disposition", "attachment; filename=" + packageName).
                    header("Last-Modified", createDateFormat().format(this.convertToGmt(moduleItem.getLastModified()).getTime())).build();
        } catch (Exception e) {
            //catch RulesRepositoryException and other exceptions. For example when the package does not exists.
            throw new WebApplicationException(e);
View Full Code Here


    @Produces(MediaType.APPLICATION_OCTET_STREAM)
    public Response getPackageBinary(@PathParam("packageName") String packageName) throws SerializationException {
        try {
            ModuleItem p = rulesRepository.loadModule(packageName);
           
            ModuleAssembler moduleAssembler = ModuleAssemblerManager.getModuleAssembler(p.getFormat(), p, null);

            String fileName = packageName + "." + moduleAssembler.getBinaryExtension();
            byte[] result;
            if (p.isBinaryUpToDate()) {
                result = p.getCompiledBinaryBytes();
            } else {
                BuilderResult builderResult = repositoryPackageService.buildPackage(p.getUUID(), true);
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

        rulesRepository.createModuleSnapshot(moduleName,
                snapshotName);
        ModuleItem item = rulesRepository.loadModuleSnapshot( moduleName,
                snapshotName );

       ModuleAssembler moduleAssembler = ModuleAssemblerManager.getModuleAssembler(item.getFormat(), item, assemblerConfiguration);
       List<AssetItem> listAssets= moduleAssembler.getAllNotToIncludeAssets();
       for (AssetItem itemToDelete : listAssets){
           itemToDelete.remove();
       }

        item.updateCheckinComment( comment );
View Full Code Here

        if ( !force && item.isBinaryUpToDate() ) {
            // we can just return all OK if its up to date.
            return BuilderResult.emptyResult();
        }
       
        ModuleAssembler moduleAssembler = ModuleAssemblerManager.getModuleAssembler(item.getFormat(), item, moduleAssemblerConfiguration);
        moduleAssembler.compile();

        if ( moduleAssembler.hasErrors() ) {
            BuilderResult result = new BuilderResult();
            BuilderResultHelper builderResultHelper = new BuilderResultHelper();
            result.addLines( builderResultHelper.generateBuilderResults( moduleAssembler.getErrors() ) );
            return result;
        }

        return BuilderResult.emptyResult();
    }
View Full Code Here

                        null ) );
    }

    protected String buildModuleSource(String moduleUUID) throws SerializationException {
        ModuleItem item = rulesRepository.loadModuleByUUID( moduleUUID );
        ModuleAssembler moduleAssembler = ModuleAssemblerManager.getModuleAssembler(item.getFormat(), item, null);
        return moduleAssembler.getCompiledSource();
    }
View Full Code Here

    //Drools specific
    protected String[] listRulesInPackage(String packageName) throws SerializationException {
        ModuleItem item = rulesRepository.loadModule( packageName );

        ModuleAssembler moduleAssembler = ModuleAssemblerManager.getModuleAssembler(item.getFormat(), item, null);

        List<String> result = new ArrayList<String>();
        try {

            String drl = moduleAssembler.getCompiledSource();
            if ( drl == null || "".equals( drl ) ) {
                return new String[0];
            } else {
                parseRulesToPackageList( moduleAssembler,
                        result );
View Full Code Here

            throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND)
                    .entity("Package [" + packageName + "] does not exist").build());
        }
        try {
            ModuleItem moduleItem = rulesRepository.loadModule(packageName);
            ModuleAssembler moduleAssembler = ModuleAssemblerManager.getModuleAssembler(moduleItem.getFormat(), moduleItem, null);
            String drl = moduleAssembler.getCompiledSource();
            return Response.ok(drl).header("Content-Disposition", "attachment; filename=" + packageName).
                    header("Last-Modified", createDateFormat().format(this.convertToGmt(moduleItem.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

                    .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

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.