Examples of EventException


Examples of org.wso2.event.exceptions.EventException

                    }           
                }
                node.setTopicNodes(nodes.toArray(new TopicNode[0]));
            }
        } catch (RegistryException e) {
            throw new EventException(e.getMessage(),e);
        } catch (AxisFault e) {
            throw new EventException(e.getMessage(),e);
        }
  }
View Full Code Here

Examples of org.wso2.event.exceptions.EventException

                   return topicDetails;
               }else{
                   return null;   
               }
        } catch (RegistryException e) {
            throw new EventException("Error getting topic details "+ e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.wso2.event.exceptions.EventException

            String topicInfo = getTopicInfoPath(topicDetails.getTopicName());
            if(registry.resourceExists(topicInfo)){
                TopicDetails currentTopicDetails = getTopicDetails(topicDetails.getTopicName());
                Resource resource = registry.get(topicInfo);
                if(currentTopicDetails.isSecureTopic() && !currentTopicDetails.getOwner().equals(EventBrokerUtils.getLoggedInUserName())){
                    throw new EventException("Current user do not have permission to change this topic");
                }
                resource.setProperty("topicName", topicDetails.getTopicName());
                if(topicDetails.getDescription() != null){
                    resource.setProperty("description", topicDetails.getDescription());   
                }
                if(topicDetails.getSchemaDescription() != null){
                    resource.setProperty("schemaDescription", topicDetails.getSchemaDescription());   
                }
                if(topicDetails.isSecureTopic()){
                    resource.setProperty("isSecureTopic", String.valueOf(topicDetails.isSecureTopic()));   
                }
                registry.put(topicInfo,resource);
            }else{
                Resource resource = registry.newResource();
                ByteArrayOutputStream outStream = new ByteArrayOutputStream();
                resource.setContent(outStream.toByteArray());
               
                resource.setProperty("topicName", topicDetails.getTopicName());
                if(topicDetails.getDescription() != null){
                    resource.setProperty("description", topicDetails.getDescription());   
                }
                if(topicDetails.getSchemaDescription() != null){
                    resource.setProperty("schemaDescription", topicDetails.getSchemaDescription());   
                }
                if(topicDetails.isSecureTopic()){
                    resource.setProperty("isSecureTopic", String.valueOf(topicDetails.isSecureTopic()));   
                }
                resource.setProperty(OWNER,EventBrokerUtils.getLoggedInUserName());
                registry.put(topicInfo,resource);
            }
        } catch (RegistryException e) {
            throw new EventException("Error getting topic details "+ e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.wso2.event.exceptions.EventException

            if(!registry.resourceExists(path)){
                return false;
            }
            return "true".equals(registry.get(path).getProperty("isSecureTopic"));
        } catch (RegistryException e) {
            throw new EventException(e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.wso2.event.exceptions.EventException

                javaScriptExecuter.execuateScript(script, "onEvent", new Object[]{stringWriter.toString()});
                return true;
            }
            return false;
        } catch (XMLStreamException e) {
            throw new EventException("Error at running the java script "+ e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.wso2.event.exceptions.EventException

                if (topicNode != null) {
                    topic = topicNode.getText();
                }
            } catch (JaxenException e) {
                log.error("Topic not found");
                throw new EventException("Topic not found", e);
            }
            event.setTopic(topic);
        }
        return super.getMatchingSubscriptions(event);
    }
View Full Code Here

Examples of org.wso2.event.exceptions.EventException

                client.getOptions().setAction("Event");
               
                ByteArrayInputStream in = new ByteArrayInputStream(messageAsStr.getBytes());
                client.sendReceive(new StAXOMBuilder(in).getDocumentElement());
            } catch (AxisFault e) {
                throw new EventException("Error sending a message from java script",e);
            } catch (XMLStreamException e) {
                throw new EventException("Error sending a message from java script", e);
            }
        }
View Full Code Here

Examples of org.wso2.event.exceptions.EventException

            throws EventException {
        try {
            String property = (String) subscription.getSubscriptionData()
                    .getProperty(FORMATTER_XSLT_SOURCE);
            if (property == null) {
                throw new EventException("XSLT for formatter not found");
            }
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            element.serialize(out);
            ByteArrayInputStream in = new ByteArrayInputStream(out
                    .toByteArray());

            TransformerFactory tFactory = TransformerFactory.newInstance();
            Transformer transformer = tFactory.newTransformer(new StreamSource(
                    new StringReader(property)));
            ByteArrayOutputStream finalResultAsBytes = new ByteArrayOutputStream();
            transformer.transform(new javax.xml.transform.stream.StreamSource(
                    in), new javax.xml.transform.stream.StreamResult(
                    finalResultAsBytes));
            ByteArrayInputStream resultIn = new ByteArrayInputStream(
                    finalResultAsBytes.toByteArray());
            return new StAXOMBuilder(resultIn).getDocumentElement();
        } catch (TransformerConfigurationException e) {
            throw new EventException("Error at XSLT formatter "
                    + e.getMessage(), e);
        } catch (TransformerFactoryConfigurationError e) {
            throw new EventException("Error at XSLT formatter "
                    + e.getMessage(), e);
        } catch (TransformerException e) {
            throw new EventException("Error at XSLT formatter "
                    + e.getMessage(), e);
        } catch (XMLStreamException e) {
            throw new EventException("Error at XSLT formatter "
                    + e.getMessage(), e);
        }
    }
View Full Code Here

Examples of org.wso2.event.exceptions.EventException

            if (topicNode != null) {
                topic = topicNode.getText();
            }
        } catch (JaxenException e) {
            log.error("Topic not found");
            throw new EventException("Topic not found", e);
        }
        event.setTopic(topic);
        return super.getMatchingSubscriptions(event);
    }
View Full Code Here

Examples of org.wso2.event.exceptions.EventException

        return role.equals("admin");
    }
   
    public static String subsctractPath(String str1, String str2) throws EventException{
        if(!str1.startsWith(str2)){
            throw new EventException(str1 + " is not a substring of "+ str2);
        }
        String path = str1.substring(str2.length());
        if(!path.startsWith("/")){
            return "/"+path;
        }else{
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.