Package org.kie.io

Examples of org.kie.io.ResourceConfiguration


        }
        return add(resource, currentType);
    }

    public CompositeKnowledgeBuilder add(Resource resource, ResourceType type) {
        ResourceConfiguration configuration = resource instanceof BaseResource ? ((BaseResource) resource).getConfiguration() : null;
        return add(resource, type, configuration);
    }
View Full Code Here


    public KnowledgeBuilderImpl(PackageBuilder pkgBuilder) {
        this.pkgBuilder = pkgBuilder;
    }

    public void add(Resource resource, ResourceType type) {
        ResourceConfiguration resourceConfiguration = resource instanceof BaseResource ? ((BaseResource) resource).getConfiguration() : null;
        add(resource, type, resourceConfiguration;
    }
View Full Code Here

    public KieFileSystem write(Resource resource) {
        try {
            String target = resource.getTargetPath() != null ? resource.getTargetPath() : resource.getSourcePath();
            if( target != null ) {
                write( RESOURCE_PATH_PREFIX+target, readBytesFromInputStream(resource.getInputStream()) );
                ResourceConfiguration conf = resource.getConfiguration();
                if( conf != null ) {
                    Properties prop = ResourceTypeImpl.toProperties( conf );
                    ByteArrayOutputStream buff = new ByteArrayOutputStream();
                    prop.store( buff, "Configuration properties for resource: "+target );
                    write( RESOURCE_PATH_PREFIX+target+".properties", buff.toByteArray() );
View Full Code Here

                                KieBaseModel kieBaseModel,
                                InternalKieModule kieModule) {
        int fileCount = 0;
        for ( String fileName : kieModule.getFileNames() ) {
            if ( filterFileInKBase(kieBaseModel, fileName) && !fileName.endsWith( ".properties" ) ) {
                ResourceConfiguration conf = null;
                if( kieModule.isAvailable( fileName+".properties" ) ) {
                    // configuration file available
                    Properties prop = new Properties();
                    try {
                        prop.load( new ByteArrayInputStream( kieModule.getBytes(fileName+".properties") ) );
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

                                  KieBaseModel kieBaseModel,
                                  InternalKieModule kieModule ) {
        int fileCount = 0;
        for ( String fileName : kieModule.getFileNames() ) {
            if ( filterFileInKBase(kieBaseModel, fileName) && !fileName.endsWith( ".properties" ) ) {
                ResourceConfiguration conf = getResourceConfiguration(kieModule, fileName);
                byte[] bytes = kieModule.getBytes( fileName );
                if ( bytes == null || bytes.length == 0 ) {
                    continue;
                }
                if ( conf == null ) {
View Full Code Here

        }

    }

    public static ResourceConfiguration getResourceConfiguration(InternalKieModule kieModule, String fileName) {
        ResourceConfiguration conf = null;
        if( kieModule.isAvailable( fileName+".properties" ) ) {
            // configuration file available
            Properties prop = new Properties();
            try {
                prop.load( new ByteArrayInputStream( kieModule.getBytes(fileName+".properties") ) );
View Full Code Here

            return false;
        }
        Resource resource = KieServices.Factory.get().getResources().newByteArrayResource(bytes).setSourcePath(resourceName);

        if ( filterFileInKBase(kieBaseModel, resourceName) ) {
            ResourceConfiguration conf = getResourceConfiguration(kieModule, resourceName);
            if ( conf == null ) {
                ckbuilder.add( resource, ResourceType.determineResourceType(resourceName) );
            } else {
                ckbuilder.add( resource, ResourceType.determineResourceType(resourceName), conf );
            }
View Full Code Here

    public KieFileSystem write(Resource resource) {
        try {
            String target = resource.getTargetPath() != null ? resource.getTargetPath() : resource.getSourcePath();
            if( target != null ) {
                write( RESOURCE_PATH_PREFIX+target, readBytesFromInputStream(resource.getInputStream()) );
                ResourceConfiguration conf = resource.getConfiguration();
                if( conf != null ) {
                    Properties prop = ResourceTypeImpl.toProperties( conf );
                    ByteArrayOutputStream buff = new ByteArrayOutputStream();
                    prop.store( buff, "Configuration properties for resource: "+target );
                    write( RESOURCE_PATH_PREFIX+target+".properties", buff.toByteArray() );
View Full Code Here

        }
        return add(resource, currentType);
    }

    public CompositeKnowledgeBuilder add(Resource resource, ResourceType type) {
        ResourceConfiguration configuration = resource instanceof BaseResource ? ((BaseResource) resource).getConfiguration() : null;
        return add(resource, type, configuration);
    }
View Full Code Here

TOP

Related Classes of org.kie.io.ResourceConfiguration

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.