Package org.drools.io.internal

Examples of org.drools.io.internal.InternalResource


        ChangeSet changeSet = reader.read( resource.getReader() );
        if (changeSet == null) {
            // @TODO should log an error
        }
        for (Resource nestedResource : changeSet.getResourcesAdded()) {
            InternalResource iNestedResourceResource = (InternalResource) nestedResource;
            if (iNestedResourceResource.isDirectory()) {
                for (Resource childResource : iNestedResourceResource.listResources()) {
                    if (( (InternalResource) childResource ).isDirectory()) {
                        continue; // ignore sub directories
                    }
                    ( (InternalResource) childResource ).setResourceType( iNestedResourceResource.getResourceType() );
                    addKnowledgeResource( childResource,
                                          iNestedResourceResource.getResourceType(),
                                          iNestedResourceResource.getConfiguration() );
                }
            } else {
                addKnowledgeResource( iNestedResourceResource,
                                      iNestedResourceResource.getResourceType(),
                                      iNestedResourceResource.getConfiguration() );
            }
        }
    }
View Full Code Here


                }
                public int[] getLines() { return new int[ 0 ]; }
            } );
        }
        for (Resource nestedResource : changeSet.getResourcesAdded()) {
            InternalResource iNestedResourceResource = (InternalResource) nestedResource;
            if (iNestedResourceResource.isDirectory()) {
                for (Resource childResource : iNestedResourceResource.listResources()) {
                    if (( (InternalResource) childResource ).isDirectory()) {
                        continue; // ignore sub directories
                    }
                    ( (InternalResource) childResource ).setResourceType( iNestedResourceResource.getResourceType() );
                    addKnowledgeResource( childResource,
                            iNestedResourceResource.getResourceType(),
                            iNestedResourceResource.getConfiguration() );
                }
            } else {
                addKnowledgeResource( iNestedResourceResource,
                        iNestedResourceResource.getResourceType(),
                        iNestedResourceResource.getConfiguration() );
            }
        }
    }
View Full Code Here

            return type.getTypeClassName();
        }
    }

    public void registerBuildResource( final Resource resource, ResourceType type ) {
        InternalResource ires = (InternalResource) resource;
        if ( ires.getResourceType() == null ) {
            ires.setResourceType( type );
        } else if ( ires.getResourceType() != type ) {
            this.results.add( new ResourceTypeDeclarationWarning( resource, ires.getResourceType(), type ) );
        }
        if ( ResourceType.CHANGE_SET == type ) {
            try {
                ChangeSet changeSet = parseChangeSet( resource );
                List<Resource> resources = new ArrayList<Resource>(  );
View Full Code Here

       
        Assert.assertNotNull(resourcesAdded);
       
        Assert.assertEquals(4, resourcesAdded.size());
       
        InternalResource resource1 = null;
        InternalResource resource2 = null;
        InternalResource resource3 = null;
        InternalResource secureResource = null;
       
        for (Resource r : resourcesAdded) {
            InternalResource resource = (InternalResource) r;
            if (resource.getSourcePath() != null && resource.getSourcePath().equals("resource1")){
                resource1 = resource;
            } else if (resource.getSourcePath() != null && resource.getSourcePath().equals("secureResource")){
                secureResource = resource;
            } else if (resource.getSourcePath() == null && resource.getDescription() == null){
                resource3 = resource;
            } else if (resource.getSourcePath() == null){
                resource2 = resource;
            }
        }
       
        Assert.assertNotNull(resource1);
View Full Code Here

                ChangeSet changeSet = reader.read( resource.getReader() );
                if ( changeSet == null ) {
                    // @TODO should log an error
                }
                for ( Resource nestedResource : changeSet.getResourcesAdded() ) {
                    InternalResource iNestedResourceResource = (InternalResource) nestedResource;
                    if ( iNestedResourceResource.isDirectory() ) {
                        this.resourceDirectories.add( iNestedResourceResource );
                        for ( Resource childResource : iNestedResourceResource.listResources() ) {
                            if ( ((InternalResource) childResource).isDirectory() ) {
                                continue; // ignore sub directories
                            }
                            ((InternalResource) childResource).setResourceType( iNestedResourceResource.getResourceType() );
                            addKnowledgeResource( childResource,
                                                  iNestedResourceResource.getResourceType(),
                                                  iNestedResourceResource.getConfiguration() );
                        }
                    } else {
                        addKnowledgeResource( iNestedResourceResource,
                                              iNestedResourceResource.getResourceType(),
                                              iNestedResourceResource.getConfiguration() );
                    }
                }
            } else if ( ResourceType.XSD.equals( type ) ) {
                JaxbConfigurationImpl confImpl = (JaxbConfigurationImpl) configuration;
                String[] classes = DroolsJaxbHelperProviderImpl.addXsdModel( resource,
View Full Code Here

                ChangeSet changeSet = reader.read( resource.getReader() );
                if ( changeSet == null ) {
                    // @TODO should log an error
                }
                for ( Resource nestedResource : changeSet.getResourcesAdded() ) {
                    InternalResource iNestedResourceResource = (InternalResource) nestedResource;
                    if ( iNestedResourceResource.isDirectory() ) {
                        this.resourceDirectories.add( iNestedResourceResource );
                        for ( Resource childResource : iNestedResourceResource.listResources() ) {
                            if ( ((InternalResource) childResource).isDirectory() ) {
                                continue; // ignore sub directories
                            }
                            ((InternalResource) childResource).setResourceType( iNestedResourceResource.getResourceType() );
                            addKnowledgeResource( childResource,
                                                  iNestedResourceResource.getResourceType(),
                                                  iNestedResourceResource.getConfiguration() );
                        }
                    } else {
                        addKnowledgeResource( iNestedResourceResource,
                                              iNestedResourceResource.getResourceType(),
                                              iNestedResourceResource.getConfiguration() );
                    }
                }
            } else {
                ResourceTypeBuilder builder = ResourceTypeBuilderRegistry.getInstance().getResourceTypeBuilder( type );
                if ( builder != null ) {
View Full Code Here

       
        emptyAttributeCheck( localName,
                             "type",
                             type,
                             parser );
        InternalResource resource = null;
       
        if ( src.trim().startsWith( "classpath:" ) ) {
            resource = new ClassPathResource( src.substring( src.indexOf( ':' ) + 1 ), parser.getClassLoader() );
        } else {
            resource = new UrlResource( src );
            ((UrlResource)resource).setBasicAuthentication(basicAuthentication);
            ((UrlResource)resource).setUsername(username);
            ((UrlResource)resource).setPassword(password);
        }
       
        resource.setResourceType( ResourceType.getResourceType( type ) );
       
        resource.setName(name);
        resource.setDescription(description);
        resource.setCategories(categories);
       
        return resource;
    }
View Full Code Here

                ChangeSet changeSet = reader.read( resource.getReader() );
                if ( changeSet == null ) {
                    // @TODO should log an error
                }
                for ( Resource nestedResource : changeSet.getResourcesAdded() ) {
                    InternalResource iNestedResourceResource = (InternalResource) nestedResource;
                    if ( iNestedResourceResource.isDirectory() ) {
                        this.resourceDirectories.add( iNestedResourceResource );
                        for ( Resource childResource : iNestedResourceResource.listResources() ) {
                            if ( ((InternalResource) childResource).isDirectory() ) {
                                continue; // ignore sub directories
                            }
                            ((InternalResource) childResource).setResourceType( iNestedResourceResource.getResourceType() );
                            addKnowledgeResource( childResource,
                                                  iNestedResourceResource.getResourceType(),
                                                  iNestedResourceResource.getConfiguration() );
                        }
                    } else {
                        addKnowledgeResource( iNestedResourceResource,
                                              iNestedResourceResource.getResourceType(),
                                              iNestedResourceResource.getConfiguration() );
                    }
                }
            } else if ( ResourceType.XSD.equals( type ) ) {
                JaxbConfigurationImpl confImpl = (JaxbConfigurationImpl) configuration;
                String[] classes = DroolsJaxbHelperProviderImpl.addXsdModel( resource,
View Full Code Here

       
        emptyAttributeCheck( localName,
                             "type",
                             type,
                             parser );       
        InternalResource resource = null;
       
        if ( src.trim().startsWith( "classpath:" ) ) {
            resource = new ClassPathResource( src.substring( src.indexOf( ':' ) + 1 ), ( Class ) parser.getMetaData().get( "clazz" ), parser.getClassLoader() );
        } else {
            resource = new UrlResource( src );
            ((UrlResource)resource).setBasicAuthentication(basicAuthentication);
            ((UrlResource)resource).setUsername(username);
            ((UrlResource)resource).setPassword(password);          
        }
       
        resource.setResourceType( ResourceType.getResourceType( type ) );
       
        return resource;
    }
View Full Code Here

                ChangeSet changeSet = reader.read( resource.getReader() );
                if ( changeSet == null ) {
                    // @TODO should log an error
                }
                for ( Resource nestedResource : changeSet.getResourcesAdded() ) {
                    InternalResource iNestedResourceResource = (InternalResource) nestedResource;
                    if ( iNestedResourceResource.isDirectory() ) {
                        this.resourceDirectories.add( iNestedResourceResource );
                        for ( Resource childResource : iNestedResourceResource.listResources() ) {
                            if ( ((InternalResource) childResource).isDirectory() ) {
                                continue; // ignore sub directories
                            }
                            ((InternalResource) childResource).setResourceType( iNestedResourceResource.getResourceType() );
                            addKnowledgeResource( childResource,
                                                  iNestedResourceResource.getResourceType(),
                                                  iNestedResourceResource.getConfiguration() );
                        }
                    } else {
                        addKnowledgeResource( iNestedResourceResource,
                                              iNestedResourceResource.getResourceType(),
                                              iNestedResourceResource.getConfiguration() );
                    }
                }
            }  else if ( ResourceType.XSD.equals( type ) ) {
                JaxbConfigurationImpl confImpl = ( JaxbConfigurationImpl ) configuration;
                String[] classes = DroolsJaxbHelperProviderImpl.addXsdModel( resource, this, confImpl.getXjcOpts(), confImpl.getSystemId() );
View Full Code Here

TOP

Related Classes of org.drools.io.internal.InternalResource

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.