Package org.drools.repository

Examples of org.drools.repository.RulesRepository.loadPackage()


        String[] path = getPath( uri );
        try {
            RulesRepository repo = getRepo();
            if ( path.length == 3 && path[0].equals( "packages" ) && checkPackagePermission( path[1],
                                                                                             RoleTypes.PACKAGE_READONLY ) ) {
                PackageItem pkg = repo.loadPackage( path[1] );
                AssetItem asset = pkg.loadAsset( AssetItem.getAssetNameFromFileName( path[2] )[0] );
                return asset.getContentLength();
            } else if ( path.length == 4 && path[0].equals( "snapshots" ) && checkPackagePermission( path[1],
                                                                                                     RoleTypes.PACKAGE_READONLY ) ) {
                PackageItem pkg = repo.loadPackageSnapshot( path[1],
View Full Code Here


        String[] path = getPath( uri );
        if ( path.length < 3 ) return false;
        if ( !(path[0].equals( "packages" ) || path[0].equals( "snapshots" )) ) return false;
        if ( repository.containsPackage( path[1] ) ) {
            if ( path[0].equals( "packages" ) ) {
                PackageItem pkg = repository.loadPackage( path[1] );
                if ( path[2].startsWith( "._" ) ) {
                    return osxDoubleData.containsKey( uri );
                }
                return pkg.containsAsset( AssetItem.getAssetNameFromFileName( path[2] )[0] );
            } else {
View Full Code Here

                return false;
            }

            if ( path[0].equals( "packages" ) ) {
                if ( path.length == 2 ) {
                    PackageItem pkg = repository.loadPackage( path[1] );
                    return !pkg.isArchived();
                } else {
                    PackageItem pkg = repository.loadPackage( path[1] );
                    if ( path[2].startsWith( "._" ) ) {
                        return this.osxDoubleData.containsKey( uri );
View Full Code Here

            if ( path[0].equals( "packages" ) ) {
                if ( path.length == 2 ) {
                    PackageItem pkg = repository.loadPackage( path[1] );
                    return !pkg.isArchived();
                } else {
                    PackageItem pkg = repository.loadPackage( path[1] );
                    if ( path[2].startsWith( "._" ) ) {
                        return this.osxDoubleData.containsKey( uri );
                    }
                    String assetName = AssetItem.getAssetNameFromFileName( path[2] )[0];
View Full Code Here

            throw new IllegalArgumentException();
        }
        if ( path[0].equals( "packages" ) && checkPackagePermission( path[1],
                                                                     RoleTypes.PACKAGE_DEVELOPER ) ) {
            String packName = path[1];
            PackageItem pkg = repository.loadPackage( packName );
            if ( path.length == 3 ) {
                //delete asset
                if ( path[2].startsWith( "._" ) ) {
                    osxDoubleData.remove( uri );
                    return;
View Full Code Here

                    throw new RuntimeException( e );
                }
                return 0;
            }
            String[] assetName = AssetItem.getAssetNameFromFileName( path[2] );
            PackageItem pkg = repository.loadPackage( packageName );
            AssetItem asset = pkg.loadAsset( assetName[0] );
            asset.updateBinaryContentAttachment( content );
            //here we could save, or check in, depending on if enough time has passed to justify
            //a new version. Otherwise we will pollute the version history with lots of trivial versions.
            //if (shouldCreateNewVersion(asset.getLastModified())) {
View Full Code Here

        //Create a history package with no compiled binary stored.
        pkg.checkout();
        pkg.checkin( "version1" );
        //Verify history package binary.
        PackageItem p = repo.loadPackage( "testGetHistoryPackageBinary",
                                          2 );
        assertEquals( "version1",
                      p.getCheckinComment() );
        assertFalse( p.isBinaryUpToDate() );
        byte[] result = p.getCompiledPackageBytes();
View Full Code Here

        BuilderResult result = repositoryPackageService.buildPackage( pkg.getUUID(),
                                                                      true );
        assertFalse( result.hasLines() );

        pkg = repo.loadPackage( "testBinaryPackageCompile" );
        byte[] binPackage = pkg.getCompiledPackageBytes();

        assertNotNull( binPackage );

        Package[] binPkgs = (Package[]) DroolsStreamUtils.streamIn( binPackage );
View Full Code Here

                System.err.println( result.getLines().get( i ).getMessage() );
            }
        }
        assertFalse( result.hasLines() );

        pkg = repo.loadPackage( "testBinaryPackageCompileBRL" );
        byte[] binPackage = pkg.getCompiledPackageBytes();

        // Here is where we write it out is needed... set to true if needed for
        // the binary test below "testLoadAndExecBinary"
        boolean saveBinPackage = false;
View Full Code Here

        AssetItem item = repo.loadAssetByUUID( uuid );
        assertNotNull( item.getBinaryContentAsBytes() );
        assertEquals( item.getBinaryContentAttachmentFileName(),
                      "billasurf.jar" );

        PackageItem pkg = repo.loadPackage( "com.billasurf.manufacturing.plant" );
        DroolsHeader.updateDroolsHeader( "import com.billasurf.Board\nimport com.billasurf.Person" + "\n\nglobal com.billasurf.Person prs",
                                                  pkg );
        pkg.checkin( "added imports" );

        SuggestionCompletionEngine eng = serv.loadSuggestionCompletionEngine( "com.billasurf.manufacturing.plant" );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.