Examples of SubscriptionManager


Examples of org.jacorb.notification.SubscriptionManager

        controlTaskProcessor_ = MockControl.createControl(TaskProcessor.class);
        mockTaskProcessor_ = (TaskProcessor) controlTaskProcessor_.getMock();
        controlTaskExecutor_ = MockControl.createControl(TaskExecutor.class);
        objectUnderTest_ = new StructuredProxyPushSupplierImpl(mockAdmin, getORB(), getPOA(),
                getConfiguration(), mockTaskProcessor_, new DirectExecutorPushTaskExecutorFactory(), new OfferManager(),
                new SubscriptionManager(), null);

        assertEquals(new Integer(10), objectUnderTest_.getID());
    }
View Full Code Here

Examples of org.jboss.ws.extensions.eventing.mgmt.SubscriptionManager

      {
         EventingEndpointDeployment deploymentInfo = new EventingEndpointDeployment("http://schemas.xmlsoap.org/ws/2004/08/eventing/Warnings", null, null);
         deploymentInfo.setEndpointAddress("http://localhost:8080/jaxws-wseventing/manage");
         deploymentInfo.setPortName(new QName("http://schemas.xmlsoap.org/ws/2004/08/eventing","SubscriptionManagerPort"));

         subscriptionManager = new SubscriptionManager();
         subscriptionManager.registerEventSource(deploymentInfo);
         subscriptionManager.registerEventSource(deploymentInfo);
         subscriptionManager.start();

         eventSinkEndpoint = new EndpointReferenceType();
View Full Code Here

Examples of org.wso2.carbon.event.core.subscription.SubscriptionManager

import org.apache.axiom.om.OMElement;

public class InMemorySubscriptionManagerFactory implements SubscriptionManagerFactory{
   
    public SubscriptionManager getSubscriptionManager(OMElement config) {
        SubscriptionManager subscriptionManager = new InMemorySubscriptionManager();
        return subscriptionManager;
    }
View Full Code Here

Examples of org.wso2.event.SubscriptionManager

    }
   
    @SuppressWarnings("unchecked")
    private EventBrokerService buildEventSource(OMElement configElement)
            throws Exception {
        SubscriptionManager subscriptionManager;
        NotificationManager notificationManager;
        EventDispatcher eventDispatcher;
       
        if(configElement != null){

            String eventSourceName = null;
            OMAttribute eventSourceNameAttribute = configElement.getAttribute(
                    new QName(ATTR_NAME)) ;
            if (eventSourceNameAttribute != null) {
                eventSourceName = eventSourceNameAttribute.getAttributeValue();
            }
            OMElement subscriptionManagerElement = configElement.getFirstChildWithName(new QName(
                    BROKER_CONFIG_NAMESPACE, LOCAL_NAME_SUBSCRIPTION_MANAGER_CONFIG));
            String subscriptionManagerClass = subscriptionManagerElement.getAttribute(
                    new QName(ATTR_CLASS)).getAttributeValue();
            try {
                subscriptionManager =
                        (SubscriptionManager) Class.forName(subscriptionManagerClass).newInstance();
            } catch(Exception e) {
                String message = "Error while creating Subscription Manager";
                log.error(message, e);
                if (e instanceof ClassNotFoundException) {
                    throw (ClassNotFoundException)e;
                }
                throw new ActivationException(message, e);
            }
   
            Map<String, String> subscriptionManagerParameters = getParameters(
                    subscriptionManagerElement.getChildrenWithName(new QName(
                            BROKER_CONFIG_NAMESPACE, LOCAL_NAME_PARAMETER)));
            Set<Map.Entry<String, String>> parameters = subscriptionManagerParameters.entrySet();
            for(Map.Entry<String, String> e : parameters) {
                subscriptionManager.addProperty(e.getKey(), e.getValue());
            }
   
            OMElement notificationManagerElement = configElement.getFirstChildWithName(new QName(
                    BROKER_CONFIG_NAMESPACE, LOCAL_NAME_NOTIFICATION_MANAGER_CONFIG));
            String notificationManagerClass = notificationManagerElement.getAttribute(
                    new QName(ATTR_CLASS)).getAttributeValue();
            try {
                notificationManager =
                        (NotificationManager) Class.forName(notificationManagerClass).newInstance();
                if (notificationManager instanceof CarbonNotificationManager) {
                    Map<String, String> notificationManagerParameters = getParameters(
                            notificationManagerElement.getChildrenWithName(new QName(
                                    BROKER_CONFIG_NAMESPACE, LOCAL_NAME_PARAMETER)));
                    ((CarbonNotificationManager) notificationManager).init(
                            notificationManagerParameters);
                }
            } catch(Exception e) {
                String message = "Error while creating Notification Manager";
                log.error(message, e);
                if (e instanceof ClassNotFoundException) {
                    throw (ClassNotFoundException)e;
                }
                throw new ActivationException(message, e);
            }
   
            /*String eventDispatcherName = configElement.getFirstChildWithName(new QName(
                    BROKER_CONFIG_NAMESPACE, LOCAL_NAME_EVENT_DISPATCHER_CONFIG)).getText().trim();
            try {
                eventDispatcher = (EventDispatcher) Class.forName(eventDispatcherName).newInstance();
                if (eventDispatcher instanceof CarbonEventDispatcher) {
                    ((CarbonEventDispatcher)eventDispatcher).init(serverConfigurationContext);
                }
            } catch(Exception e) {
                String message = "Error while creating Event Dispatcher";
                log.error(message, e);
                if (e instanceof ClassNotFoundException) {
                    throw (ClassNotFoundException)e;
                }
                throw new ActivationException(message, e);
            }*/
        }else{
            notificationManager = new CarbonNotificationManager();
            ((CarbonNotificationManager)notificationManager).init(new HashMap<String, String>());
            subscriptionManager = new EmbeddedRegistryBasedSubscriptionManager();
        }

        try {
            CarbonEventBroker broker = (CarbonEventBroker)CarbonEventBroker.getInstance();
            broker.registerSubscriptionManager(subscriptionManager);
            broker.registerNotificationManager(notificationManager);
            subscriptionManager.init();
            return broker;
        } catch(Exception e) {
            String message = "Error while initializing Event Source";
            log.error(message, e);
            throw new ActivationException(message, e);
View Full Code Here

Examples of org.wso2.eventing.SubscriptionManager

                    .getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE, "class"));
            if (clazz != null) {
                String className = clazz.getAttributeValue();
                try {
                    Class subscriptionManagerClass = Class.forName(className);
                    SubscriptionManager manager =
                            (SubscriptionManager) subscriptionManagerClass.newInstance();
                    Iterator itr = subscriptionManagerElem.getChildrenWithName(PROPERTIES_QNAME);
                    while (itr.hasNext()) {
                        OMElement propElem = (OMElement) itr.next();
                        String propName =
                                propElem.getAttribute(new QName("name")).getAttributeValue();
                        String propValue =
                                propElem.getAttribute(new QName("value")).getAttributeValue();
                        if (propName != null && !"".equals(propName.trim()) &&
                                propValue != null && !"".equals(propValue.trim())) {

                            propName = propName.trim();
                            propValue = propValue.trim();

                            PasswordManager passwordManager =
                                    PasswordManager.getInstance();
                            String key = eventSource.getName() + "." + propName;

                            if (passwordManager.isInitialized()
                                    && passwordManager.isTokenProtected(key)) {
                                eventSource.putConfigurationProperty(propName, propValue);
                                propValue = passwordManager.resolve(propValue);
                            }

                            manager.addProperty(propName, propValue);
                        }
                    }
                    eventSource.setSubscriptionManager(manager);
                    eventSource.getSubscriptionManager()
                            .init(); // Initialise before doing further processing, required for static subscriptions
View Full Code Here

Examples of org.wso2.eventing.SubscriptionManager

     * @param eventSourceDTO Event source description to be built
     * @return a Synapse event source instance
     */
    private SynapseEventSource buildEventSource(EventSourceDTO eventSourceDTO) {
        SynapseEventSource synapseEventSource = new SynapseEventSource(eventSourceDTO.getName());
        SubscriptionManager subscriptionManager;
        try {
            if (eventSourceDTO.getType().equals("DefaultInMemory")) {
                subscriptionManager = new DefaultInMemorySubscriptionManager();
            }else  if (eventSourceDTO.getType().equals("EmbRegistry")) {
                subscriptionManager = (SubscriptionManager) Class.forName(
                        "org.wso2.carbon.eventing.impl.EmbeddedRegistryBasedSubscriptionManager")
                        .newInstance();
                subscriptionManager.init();
            } else {
                subscriptionManager = (SubscriptionManager) Class.forName(
                        "org.wso2.carbon.eventing.impl.RemoteRegistryBasedSubscriptionManager")
                        .newInstance();
            }
            subscriptionManager
                    .addProperty("topicHeaderName", eventSourceDTO.getTopicHeaderName());
            subscriptionManager
                    .addProperty("topicHeaderNS", eventSourceDTO.getTopicHeaderNS());
            //TODO this needs to be change to support any Subscription manager inherit from Subacription Manager
            if (eventSourceDTO.getType().equals("Registry")) {
                if (eventSourceDTO.getRegistryUrl() != null) {
                    subscriptionManager
                            .addProperty("registryURL", eventSourceDTO.getRegistryUrl());
                }
                if (eventSourceDTO.getUsername() != null) {
                    subscriptionManager
                            .addProperty("username", eventSourceDTO.getUsername());
                }
                if (eventSourceDTO.getRegistryUrl() != null) {
                    subscriptionManager
                            .addProperty("password", eventSourceDTO.getPassword());
                }
            }
            synapseEventSource.setSubscriptionManager(subscriptionManager);
        } catch (ClassNotFoundException e) {
View Full Code Here

Examples of org.wso2.eventing.SubscriptionManager

   * @return
   * @throws AxisFault
   */
  public String[] getValidSubscriptions(String serviceName) throws AxisFault {
    AxisService service = null;
    SubscriptionManager manager = null;
    Parameter parameter = null;
    ArrayList<String> subscribers = null;

    service = getAxisService(serviceName);
    parameter = service.getParameter(SavanConstants.SUBSCRIBER_STORE);

    if (parameter == null) {
      parameter = service.getParameter(EventingConstants.SUBSCRIPTION_MANAGER);
    }

    subscribers = new ArrayList<String>();

    List<Subscription> list = null;
    Subscription subscription = null;

    if (parameter == null) {
      manager = new SubscriptionManagerAdapter(serviceName);
    } else {
      manager = (SubscriptionManager) parameter.getValue();
    }

    try {
      list = manager.getSubscriptions();
      for (Iterator<Subscription> iterator = list.iterator(); iterator.hasNext();) {
        subscription = iterator.next();
        if (!checkExpired(subscription)) {
          subscribers.add(subscription.getId());
        }
View Full Code Here

Examples of org.wso2.eventing.SubscriptionManager

   * @return
   * @throws AxisFault
   */
  public String[] getExpiredSubscriptions(String serviceName) throws AxisFault {
    AxisService service = null;
    SubscriptionManager manager = null;
    Parameter parameter = null;
    ArrayList<String> subscribers = null;

    service = getAxisService(serviceName);
    parameter = service.getParameter(SavanConstants.SUBSCRIBER_STORE);

    if (parameter == null) {
      parameter = service.getParameter(EventingConstants.SUBSCRIPTION_MANAGER);
    }

    subscribers = new ArrayList<String>();

    List<Subscription> list = null;
    Subscription subscription = null;

    if (parameter == null) {
      manager = new SubscriptionManagerAdapter(serviceName);
    } else {
      manager = (SubscriptionManager) parameter.getValue();
    }

    try {
      list = manager.getSubscriptions();
      for (Iterator<Subscription> iterator = list.iterator(); iterator.hasNext();) {
        subscription = iterator.next();
        if (checkExpired(subscription)) {
          subscribers.add(subscription.getId());
        }
View Full Code Here

Examples of org.wso2.eventing.SubscriptionManager

  public SubscriptionDTO getSubscriptionDetails(String serviceName, String subscriberId)
      throws AxisFault {
    AxisService service = null;
    Parameter parameter = null;
    SubscriptionDTO details = null;
    SubscriptionManager manager = null;

    service = getAxisService(serviceName);
    parameter = service.getParameter(SavanConstants.SUBSCRIBER_STORE);

    if (parameter == null) {
      parameter = service.getParameter(EventingConstants.SUBSCRIPTION_MANAGER);
    }

    Subscription subscription = null;

    if (parameter == null) {
      manager = new SubscriptionManagerAdapter(serviceName);
    } else {
      manager = (SubscriptionManager) parameter.getValue();
    }
   
    try {
      subscription = manager.getSubscription(subscriberId);
    } catch (EventException e) {
      String message = "Error while retrieving subscription details for " + subscriberId;
      log.error(message, e);
      throw new AxisFault(message, e);
    }
View Full Code Here

Examples of org.wso2.eventing.SubscriptionManager

                    .getAttribute(new QName(XMLConfigConstants.NULL_NAMESPACE, "class"));
            if (clazz != null) {
                String className = clazz.getAttributeValue();
                try {
                    Class subscriptionManagerClass = Class.forName(className);
                    SubscriptionManager manager =
                            (SubscriptionManager) subscriptionManagerClass.newInstance();
                    Iterator itr = subscriptionManagerElem.getChildrenWithName(PROPERTIES_QNAME);
                    while (itr.hasNext()) {
                        OMElement propElem = (OMElement) itr.next();
                        String propName =
                                propElem.getAttribute(new QName("name")).getAttributeValue();
                        String propValue =
                                propElem.getAttribute(new QName("value")).getAttributeValue();
                        if (propName != null && !"".equals(propName.trim()) &&
                                propValue != null && !"".equals(propValue.trim())) {

                            propName = propName.trim();
                            propValue = propValue.trim();

                            PasswordManager passwordManager =
                                    PasswordManager.getInstance();
                            String key = eventSource.getName() + "." + propName;

                            if (passwordManager.isInitialized()
                                    && passwordManager.isTokenProtected(key)) {
                                eventSource.putConfigurationProperty(propName, propValue);
                                propValue = passwordManager.resolve(propValue);
                            }

                            manager.addProperty(propName, propValue);
                        }
                    }
                    eventSource.setSubscriptionManager(manager);
                    eventSource.getSubscriptionManager()
                            .init(); // Initialise before doing further processing, required for static subscriptions
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.