org.drools.io
Class ResourceFactory

java.lang.Object
  extended by org.drools.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 Summary
ResourceFactory()
           
 
Method Summary
static ResourceChangeNotifier getResourceChangeNotifierService()
          A Service that can be started, to provide notifications of changed Resources.
static ResourceChangeScanner getResourceChangeScannerService()
          As service, that scans the disk for changes, this acts as a Monitor for the Notifer service.
static Resource newByteArrayResource(byte[] bytes)
           
static Resource newClassPathResource(String path)
           
static Resource newClassPathResource(String path, Class clazz)
           
static Resource newClassPathResource(String path, ClassLoader classLoader)
           
static Resource newClassPathResource(String path, String encoding)
           
static Resource newClassPathResource(String path, String encoding, Class clazz)
           
static Resource newClassPathResource(String path, String encoding, ClassLoader classLoader)
           
static Resource newDescrResource(KnowledgeDescr descr)
           
static Resource newFileResource(File file)
           
static Resource newFileResource(String fileName)
           
static Resource newInputStreamResource(InputStream stream)
           
static Resource newInputStreamResource(InputStream stream, String encoding)
           
static Resource newReaderResource(Reader reader)
           
static Resource newReaderResource(Reader reader, String encoding)
           
static Resource newUrlResource(String path)
           
static Resource newUrlResource(URL url)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceFactory

public ResourceFactory()
Method Detail

getResourceChangeNotifierService

public static ResourceChangeNotifier getResourceChangeNotifierService()
A Service that can be started, to provide notifications of changed Resources.

Returns:

getResourceChangeScannerService

public static ResourceChangeScanner getResourceChangeScannerService()
As service, that scans the disk for changes, this acts as a Monitor for the Notifer service.

Returns:

newUrlResource

public static Resource newUrlResource(URL url)

newUrlResource

public static Resource newUrlResource(String path)

newFileResource

public static Resource newFileResource(File file)

newFileResource

public static Resource newFileResource(String fileName)

newByteArrayResource

public static Resource newByteArrayResource(byte[] bytes)

newInputStreamResource

public static Resource newInputStreamResource(InputStream stream)

newInputStreamResource

public static Resource newInputStreamResource(InputStream stream,
                                              String encoding)

newReaderResource

public static Resource newReaderResource(Reader reader)

newReaderResource

public static Resource newReaderResource(Reader reader,
                                         String encoding)

newClassPathResource

public static Resource newClassPathResource(String path)

newClassPathResource

public static Resource newClassPathResource(String path,
                                            Class clazz)

newClassPathResource

public static Resource newClassPathResource(String path,
                                            ClassLoader classLoader)

newClassPathResource

public static Resource newClassPathResource(String path,
                                            String encoding)

newClassPathResource

public static Resource newClassPathResource(String path,
                                            String encoding,
                                            Class clazz)

newClassPathResource

public static Resource newClassPathResource(String path,
                                            String encoding,
                                            ClassLoader classLoader)

newDescrResource

public static Resource newDescrResource(KnowledgeDescr descr)


Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.