Package org.kie.services.client.api.builder.exception

Examples of org.kie.services.client.api.builder.exception.InsufficientInfoToBuildException


    static void checkAndFinalizeConfig(RemoteConfiguration config, RemoteRuntimeEngineBuilder builder ) {
        if( builder instanceof RemoteJmsRuntimeEngineBuilderImpl ) {
            RemoteJmsRuntimeEngineBuilderImpl jmsBuilder = (RemoteJmsRuntimeEngineBuilderImpl) builder;
            // check
            if( config.getUserName() == null ) {
                throw new InsufficientInfoToBuildException("A user name is required to access the JMS queues!");
            }
            if( config.getPassword() == null ) {
                throw new InsufficientInfoToBuildException("A password is required to access the JMS queues!");
            }

            // Connection Factory
            if( jmsBuilder.createOwnFactory ) {
                ConnectionFactory createdConnectionFactory = null;
                if( jmsBuilder.hostName == null ) {
                    throw new InsufficientInfoToBuildException("A host name or IP address is required to create a JMS ConnectionFactory!");
                }
                if( jmsBuilder.jmsConnectorPort == null ) {
                    throw new InsufficientInfoToBuildException("A connector port is required to create a JMS ConnectionFactory!");
                }
                Map<String, Object> connParams;
                if( config.getUseUssl() ) {
                    connParams = new HashMap<String, Object>(7)
                    connParams.put(TransportConstants.PORT_PROP_NAME, jmsBuilder.jmsConnectorPort)
                    connParams.put(TransportConstants.HOST_PROP_NAME, jmsBuilder.hostName);

                    jmsBuilder.checkKeyAndTruststoreInfo();

                    // SSL
                    connParams.put(TransportConstants.SSL_ENABLED_PROP_NAME, true)
                    connParams.put(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, jmsBuilder.keystorePassword);
                    connParams.put(TransportConstants.KEYSTORE_PATH_PROP_NAME, jmsBuilder.keystoreLocation);
                    connParams.put(TransportConstants.TRUSTSTORE_PASSWORD_PROP_NAME, jmsBuilder.truststorePassword);
                    connParams.put(TransportConstants.TRUSTSTORE_PATH_PROP_NAME, jmsBuilder.truststoreLocation);
                } else {
                    // setup
                    connParams = new HashMap<String, Object>(3)
                    connParams.put(TransportConstants.PORT_PROP_NAME, jmsBuilder.jmsConnectorPort)
                    connParams.put(TransportConstants.HOST_PROP_NAME, jmsBuilder.hostName);
                    connParams.put(TransportConstants.SSL_ENABLED_PROP_NAME, false)
                }
                // create connection factory
                createdConnectionFactory = new HornetQJMSConnectionFactory(false,
                        new TransportConfiguration(NettyConnectorFactory.class.getName(), connParams));
                config.setConnectionFactory(createdConnectionFactory);
            }

            if( jmsBuilder.jbossServerHostName != null && jmsBuilder.remoteInitialContext == null ) {
                jmsBuilder.remoteInitialContext = getRemoteJbossInitialContext(jmsBuilder.jbossServerHostName, config.getUserName(), config.getPassword());
            }

            if( jmsBuilder.remoteInitialContext != null ) {
                // sets connection factory, if null
                config.setRemoteInitialContext(jmsBuilder.remoteInitialContext);
            } else {
                config.checkValidJmsValues();
            }
        } else if( builder instanceof RemoteRestRuntimeEngineBuilderImpl ) {
            if( config.getServerBaseRestUrl() == null ) {
                throw new InsufficientInfoToBuildException("A URL is required to build the factory.");
            }
            if( config.getUserName() == null ) {
                throw new InsufficientInfoToBuildException("A user name is required to build the factory.");
            }
            if( config.getPassword() == null ) {
                throw new InsufficientInfoToBuildException("A password is required to build the factory.");
            }
        }
        if( config.getExtraJaxbClasses() != null && ! config.getExtraJaxbClasses().isEmpty() ) {
           if( config.getDeploymentId() == null ) {
                throw new InsufficientInfoToBuildException("A deployment id is required if user-defined class instances are being sent.");
           }
        }
    }
View Full Code Here


            truststoreLocation = keystoreLocation;
            truststorePassword = keystorePassword;
        }
       
        if( keystorePassword == null ) {
            throw new InsufficientInfoToBuildException("A keystore password is required to build the SSL JMS connection factory.");
        }
        if( truststorePassword == null ) {
            throw new InsufficientInfoToBuildException("A truststore password is required to build the SSL JMS connection factory.");
        }
       
        String [][] pathInfos = {
                { keystoreLocation, "keystore" },
                { truststoreLocation, "truststore" }
        };
       
        for( String [] pathInfo : pathInfos ) {
            String path = pathInfo[0];
            String name = pathInfo[1];
            if( path == null ) {
                throw new InsufficientInfoToBuildException("A " + name + " location is required to build the SSL JMS connection factory.");
            }
            if( path.startsWith("/") ) {
                File storeFile = new File(path);
                if( ! storeFile.exists() ) {
                    throw new InsufficientInfoToBuildException("No " + name + " file could be found at '" + path + "'");
                }
            } else {
                URL storeFile = this.getClass().getResource("/" + path);
                if( storeFile == null ) {
                    throw new InsufficientInfoToBuildException("No " + name + " file could be found on the classpath at '" + path + "'");
                }
            }
        }
    }
View Full Code Here

    }
   
    private static void checkValidValues(ConnectionFactory connectionFactory, Queue ksessionQueue, Queue taskQueue, Queue responseQueue)
            throws InsufficientInfoToBuildException {
        if (connectionFactory == null) {
            throw new InsufficientInfoToBuildException("The connection factory argument may not be null.");
        }
        if (ksessionQueue == null && taskQueue == null) {
            throw new InsufficientInfoToBuildException("At least a ksession queue or task queue is required.");
        }
        if (responseQueue == null) {
            throw new InsufficientInfoToBuildException("The response queue argument may not be null.");
        }
    }
View Full Code Here

TOP

Related Classes of org.kie.services.client.api.builder.exception.InsufficientInfoToBuildException

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.