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() ) {
                        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


    public void testResourceNameAndDescription() throws Exception {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("org/drools/container/spring/beans.xml");
       
        DroolsResourceAdapter resource = (DroolsResourceAdapter)context.getBean("secureResource");
        assertNotNull(resource);
        InternalResource secureResource = (InternalResource) resource.getDroolsResource();
       
        assertEquals("/someDRLResource.drl", secureResource.getSourcePath());
        assertNull(secureResource.getDescription());
       
        resource = (DroolsResourceAdapter)context.getBean("resourceWithNameAndDescription");
        assertNotNull( resource );
        InternalResource resourceWithNameAndDescription = (InternalResource) resource.getDroolsResource();
       
        assertEquals("A Name", resourceWithNameAndDescription.getSourcePath());
        assertEquals("A Description", resourceWithNameAndDescription.getDescription());
       
    }
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()) {
                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

       
        emptyAttributeCheck( localName,
                             "type",
                             type,
                             parser );
        InternalResource resource = null;
       
        if ( src.trim().startsWith( "classpath:" ) ) {
            resource = new ClassPathResource( src.substring( src.indexOf( ':' ) + 1 ) );
        } 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,
View Full Code Here

                                                               kagentConf );

        if ( resources != null && !resources.isEmpty() ) {
            Collection<Resource> rs = new ArrayList<Resource>();
            for ( DroolsResourceAdapter res : resources ) {
                InternalResource resource = (InternalResource) res.getDroolsResource();

                resource.setResourceType( res.getResourceType() );

                if ( res.getResourceConfiguration() != null ) {
                    resource.setConfiguration( res.getResourceConfiguration() );
                }

                rs.add( resource );
            }
            ChangeSetImpl changeSet = new ChangeSetImpl();
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

                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 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.