Search in sources :

Example 16 with Start

use of org.wso2.carbon.humantask.core.engine.commands.Start in project siddhi by wso2.

the class TriggerTestCase method testQuery4.

@Test
public void testQuery4() throws InterruptedException {
    log.info("testTrigger4 - OUT 0");
    SiddhiManager siddhiManager = new SiddhiManager();
    String streams = "" + "define stream StockStream (triggered_time long); " + "define trigger StockStream at 'start' ";
    SiddhiAppRuntime siddhiAppRuntime = siddhiManager.createSiddhiAppRuntime(streams);
    siddhiAppRuntime.start();
    siddhiAppRuntime.shutdown();
}
Also used : SiddhiAppRuntime(org.wso2.siddhi.core.SiddhiAppRuntime) SiddhiManager(org.wso2.siddhi.core.SiddhiManager) Test(org.testng.annotations.Test)

Example 17 with Start

use of org.wso2.carbon.humantask.core.engine.commands.Start in project carbon-apimgt by wso2.

the class BrokerManager method initConfigProvider.

/**
 * Loads configurations during the broker start up.
 * method will try to <br/>
 * (1) Load the configuration file specified in 'broker.file' (e.g. -Dbroker.file=<FilePath>). <br/>
 * (2) If -Dbroker.file is not specified, the broker.yaml file exists in current directory and load it. <br/>
 * <p>
 * <b>Note: </b> if provided configuration file cannot be read broker will not start.
 *
 * @param startupContext startup context of the broker
 */
private static void initConfigProvider(StartupContext startupContext) throws ConfigurationException {
    Path brokerYamlFile;
    String brokerFilePath = System.getProperty(BrokerConfiguration.SYSTEM_PARAM_BROKER_CONFIG_FILE);
    if (brokerFilePath == null || brokerFilePath.trim().isEmpty()) {
        // use current path.
        brokerYamlFile = Paths.get("", BrokerConfiguration.BROKER_FILE_NAME).toAbsolutePath();
    } else {
        brokerYamlFile = Paths.get(brokerFilePath).toAbsolutePath();
    }
    ConfigProvider configProvider = ConfigProviderFactory.getConfigProvider(brokerYamlFile, null);
    startupContext.registerService(BrokerConfigProvider.class, (BrokerConfigProvider) configProvider::getConfigurationObject);
}
Also used : Path(java.nio.file.Path) BrokerConfigProvider(org.wso2.broker.common.BrokerConfigProvider) ConfigProvider(org.wso2.carbon.config.provider.ConfigProvider)

Example 18 with Start

use of org.wso2.carbon.humantask.core.engine.commands.Start in project carbon-apimgt by wso2.

the class BundleActivator method start.

@Activate
protected void start(BundleContext bundleContext) {
    try {
        // Set default timestamp to UTC
        java.util.TimeZone.setDefault(java.util.TimeZone.getTimeZone("Etc/UTC"));
        Context ctx = jndiContextManager.newInitialContext();
        DataSource dataSourceAMDB = new DataSourceImpl((HikariDataSource) ctx.lookup("java:comp/env/jdbc/WSO2AMDB"));
        DAOUtil.initialize(dataSourceAMDB);
        boolean isAnalyticsEnabled = ServiceReferenceHolder.getInstance().getAPIMConfiguration().getAnalyticsConfigurations().isEnabled();
        if (isAnalyticsEnabled) {
            DataSource dataSourceStatDB = new DataSourceImpl((HikariDataSource) ctx.lookup("java:comp/env/jdbc/WSO2AMSTATSDB"));
            DAOUtil.initializeAnalyticsDataSource(dataSourceStatDB);
        }
        WorkflowExtensionsConfigBuilder.build(configProvider);
        ServiceDiscoveryConfigBuilder.build(configProvider);
        ContainerBasedGatewayConfigBuilder.build(configProvider);
        BrokerManager.start();
        Broker broker = new BrokerImpl();
        BrokerUtil.initialize(broker);
    } catch (NamingException e) {
        log.error("Error occurred while jndi lookup", e);
    }
    // deploying default policies
    try {
        ThrottlerUtil.addDefaultAdvancedThrottlePolicies();
        if (log.isDebugEnabled()) {
            log.debug("Checked default throttle policies successfully");
        }
    } catch (APIManagementException e) {
        log.error("Error occurred while deploying default policies", e);
    }
    // securing files
    try {
        boolean fileEncryptionEnabled = ServiceReferenceHolder.getInstance().getAPIMConfiguration().getFileEncryptionConfigurations().isEnabled();
        if (fileEncryptionEnabled) {
            FileEncryptionUtility fileEncryptionUtility = FileEncryptionUtility.getInstance();
            fileEncryptionUtility.init();
            fileEncryptionUtility.encryptFiles();
        }
    } catch (APIManagementException e) {
        log.error("Error occurred while encrypting files", e);
    }
}
Also used : Context(javax.naming.Context) BundleContext(org.osgi.framework.BundleContext) BrokerImpl(org.wso2.carbon.apimgt.core.impl.BrokerImpl) Broker(org.wso2.carbon.apimgt.core.api.Broker) APIManagementException(org.wso2.carbon.apimgt.core.exception.APIManagementException) FileEncryptionUtility(org.wso2.carbon.apimgt.core.impl.FileEncryptionUtility) DataSourceImpl(org.wso2.carbon.apimgt.core.dao.impl.DataSourceImpl) NamingException(javax.naming.NamingException) DataSource(org.wso2.carbon.apimgt.core.dao.impl.DataSource) HikariDataSource(com.zaxxer.hikari.HikariDataSource) Activate(org.osgi.service.component.annotations.Activate)

Example 19 with Start

use of org.wso2.carbon.humantask.core.engine.commands.Start in project carbon-apimgt by wso2.

the class SubscriptionMappingUtil method fromSubscriptionListToDTO.

/**
 * Converts a List object of SubscribedAPIs into a DTO
 *
 * @param subscriptions a list of SubscribedAPI objects
 * @param limit max number of objects returned
 * @param offset starting index
 * @return SubscriptionListDTO object containing SubscriptionDTOs
 */
public static SubscriptionListDTO fromSubscriptionListToDTO(List<Subscription> subscriptions, Integer limit, Integer offset) {
    SubscriptionListDTO subscriptionListDTO = new SubscriptionListDTO();
    List<SubscriptionDTO> subscriptionDTOs = subscriptionListDTO.getList();
    if (subscriptionDTOs == null) {
        subscriptionDTOs = new ArrayList<>();
        subscriptionListDTO.setList(subscriptionDTOs);
    }
    // identifying the proper start and end indexes
    int size = subscriptions.size();
    int start = offset < size && offset >= 0 ? offset : Integer.MAX_VALUE;
    int end = offset + limit - 1 <= size - 1 ? offset + limit - 1 : size - 1;
    for (int i = start; i <= end; i++) {
        Subscription subscription = subscriptions.get(i);
        subscriptionDTOs.add(fromSubscriptionToDTO(subscription));
    }
    subscriptionListDTO.setCount(subscriptionDTOs.size());
    return subscriptionListDTO;
}
Also used : Subscription(org.wso2.carbon.apimgt.core.models.Subscription) SubscriptionDTO(org.wso2.carbon.apimgt.rest.api.store.dto.SubscriptionDTO) SubscriptionListDTO(org.wso2.carbon.apimgt.rest.api.store.dto.SubscriptionListDTO)

Example 20 with Start

use of org.wso2.carbon.humantask.core.engine.commands.Start in project carbon-apimgt by wso2.

the class TagMappingUtil method fromTagListToDTO.

/**
 * Converts a List object of Tags into a DTO
 *
 * @param tags  a list of Tag objects
 * @param limit  max number of objects returned
 * @param offset starting index
 * @return TierListDTO object containing TierDTOs
 */
public static TagListDTO fromTagListToDTO(List<Tag> tags, int limit, int offset) {
    TagListDTO tagListDTO = new TagListDTO();
    List<TagDTO> tierDTOs = tagListDTO.getList();
    if (tierDTOs == null) {
        tierDTOs = new ArrayList<>();
        tagListDTO.setList(tierDTOs);
    }
    // identifying the proper start and end indexes
    int size = tags.size();
    int start = offset < size && offset >= 0 ? offset : Integer.MAX_VALUE;
    int end = offset + limit - 1 <= size - 1 ? offset + limit - 1 : size - 1;
    for (int i = start; i <= end; i++) {
        Tag tag = tags.get(i);
        tierDTOs.add(fromTagToDTO(tag));
    }
    tagListDTO.setCount(tierDTOs.size());
    return tagListDTO;
}
Also used : TagListDTO(org.wso2.carbon.apimgt.rest.api.store.dto.TagListDTO) TagDTO(org.wso2.carbon.apimgt.rest.api.store.dto.TagDTO) Tag(org.wso2.carbon.apimgt.core.models.Tag)

Aggregations

SVGCoordinates (org.wso2.carbon.bpel.ui.bpel2svg.SVGCoordinates)57 ActivityInterface (org.wso2.carbon.bpel.ui.bpel2svg.ActivityInterface)47 Test (org.testng.annotations.Test)17 SiddhiAppRuntime (org.wso2.siddhi.core.SiddhiAppRuntime)17 SiddhiManager (org.wso2.siddhi.core.SiddhiManager)17 Event (org.wso2.siddhi.core.event.Event)17 InputHandler (org.wso2.siddhi.core.stream.input.InputHandler)13 SVGDimension (org.wso2.carbon.bpel.ui.bpel2svg.SVGDimension)11 StreamEventPool (org.wso2.siddhi.core.event.stream.StreamEventPool)11 ArrayList (java.util.ArrayList)10 OMElement (org.apache.axiom.om.OMElement)10 DiagnosticPos (org.wso2.ballerinalang.compiler.util.diagnotic.DiagnosticPos)10 Element (org.w3c.dom.Element)9 StreamCallback (org.wso2.siddhi.core.stream.output.StreamCallback)9 TopLevelNode (org.ballerinalang.model.tree.TopLevelNode)7 APIManagementException (org.wso2.carbon.apimgt.core.exception.APIManagementException)7 ZoneId (java.time.ZoneId)5 HashMap (java.util.HashMap)5 Analyzer (org.wso2.carbon.apimgt.core.api.Analyzer)5 ErrorDTO (org.wso2.carbon.apimgt.rest.api.common.dto.ErrorDTO)5