Package org.drools.io

Examples of org.drools.io.InternalResource


       
        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 );
        }
       
        resource.setResourceType( ResourceType.getResourceType( type ) );
       
        return resource;
    }
View Full Code Here


    public Object end(String uri,
                      String localName,
                      ExtensibleXmlParser parser) throws SAXException {
        final Element element = parser.endElementBuilder();
        final InternalResource resource = (InternalResource) parser.getParent();
        ResourceConfiguration dtConf = (ResourceConfiguration) parser.getCurrent();
        resource.setConfiguration( dtConf );
       
        return dtConf;
    }
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 );
        }
       
        resource.setResourceType( ResourceType.valueOf( type ) );
       
        return resource;
    }
View Full Code Here

                ChangeSet chageSet = reader.read( resource.getReader() );
                if ( chageSet == null ) {
                    // @TODO should log an error
                }
                for ( Resource nestedResource : chageSet.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

                    ChangeSet chageSet = reader.read( resource.getReader() );
                    if ( chageSet == null ) {
                        // @TODO should log an error
                    }
                    for ( Resource nestedResource : chageSet.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() );
                        }
                    }
                }
            }
        } catch ( RuntimeException e ) {
View Full Code Here

   public void testInternalResource() throws Exception
   {
      Resource root = findResource("/mc/io/root");
      assertTrue(root instanceof InternalResource);
      InternalResource resource = InternalResource.class.cast(root);

      assertTrue(resource.isDirectory());
      assertTrue(resource.hasURL());
      assertNotNull(resource.getURL());

      assertEquals(-1l, resource.getLastRead());
      assertNotNull(resource.getInputStream());
      assertFalse(-1l == resource.getLastRead());

      Collection<Resource> resources = resource.listResources();
      assertNotNull(resources);
      assertEquals(2, resources.size());
      for (Resource child : resources)
      {
         assertNotNull(child.getInputStream());
View Full Code Here

                ChangeSet chageSet = reader.read( resource.getReader() );
                if ( chageSet == null ) {
                    // @TODO should log an error
                }
                for ( Resource nestedResource : chageSet.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

                ChangeSet chageSet = reader.read( resource.getReader() );
                if ( chageSet == null ) {
                    // @TODO should log an error
                }
                for ( Resource nestedResource : chageSet.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

                    ChangeSet chageSet = reader.read( resource.getReader() );
                    if ( chageSet == null ) {
                        // @TODO should log an error
                    }
                    for ( Resource nestedResource : chageSet.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() );
                        }
                    }
                }
            }
        } catch ( RuntimeException e ) {
View Full Code Here

TOP

Related Classes of org.drools.io.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.