Class ResourceFactory

java.lang.Object
org.kie.internal.io.ResourceFactory

public class ResourceFactory extends Object

Convenience Factory to provide Resource implementations for the desired IO resource.

 KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
 kbuilder.add( ResourceFactory.newUrlResource( "htp://www.domain.org/myProcess.bpmn2" ),
               ResourceType.BPMN2 );
 
 KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
 kbuilder.add( ResourceFactory.newClassPathResource( "htp://www.domain.org/myrules.drl", getClass() ),
               ResourceType.DRL );
 
  • Constructor Details

    • ResourceFactory

      public ResourceFactory()
  • Method Details

    • newFileResource

      public static org.kie.api.io.Resource newFileResource(File file)
    • newFileResource

      public static org.kie.api.io.Resource newFileResource(String fileName)
    • newByteArrayResource

      public static org.kie.api.io.Resource newByteArrayResource(byte[] bytes)
    • newInputStreamResource

      public static org.kie.api.io.Resource newInputStreamResource(InputStream stream)
    • newInputStreamResource

      public static org.kie.api.io.Resource newInputStreamResource(InputStream stream, String encoding)
    • newReaderResource

      public static org.kie.api.io.Resource newReaderResource(Reader reader)
    • newReaderResource

      public static org.kie.api.io.Resource newReaderResource(Reader reader, String encoding)
    • newClassPathResource

      public static org.kie.api.io.Resource newClassPathResource(String path)
    • newClassPathResource

      public static org.kie.api.io.Resource newClassPathResource(String path, Class clazz)
    • newClassPathResource

      public static org.kie.api.io.Resource newClassPathResource(String path, ClassLoader classLoader)
    • newClassPathResource

      public static org.kie.api.io.Resource newClassPathResource(String path, String encoding)
    • newClassPathResource

      public static org.kie.api.io.Resource newClassPathResource(String path, String encoding, Class clazz)
    • newClassPathResource

      public static org.kie.api.io.Resource newClassPathResource(String path, String encoding, ClassLoader classLoader)
    • newDescrResource

      public static org.kie.api.io.Resource newDescrResource(KnowledgeDescr descr)