Package org.wso2.carbon.mashup.imwrapper.core

Examples of org.wso2.carbon.mashup.imwrapper.core.IMException


    }

    public byte[] getProcessImage(String processId) {

        QName qName = decode(processId);
        SVGInterface svg = createSVG(qName);
        return svg.toPNGBytes();
    }
View Full Code Here


    private SVGInterface createSVG(QName qName) {

        // generate new
        InputStream in = getBpelDescriptor(qName);

        SVGInterface svg = null;

        try {
            svg = BPEL2SVGUtil.generate(in);

            if (svg == null)
View Full Code Here

   
    protected static SVGImpl generateSVGImpl(java.io.InputStream is) throws java.io.IOException {
      byte[] b=new byte[is.available()];
      is.read(b);
   
      BPELInterface bpel = new BPELImpl();
        OMElement bpelStr = bpel.load(new String(b));
       
        bpel.processBpelString(bpelStr);

        LayoutManager layoutManager = BPEL2SVGFactory.getInstance().getLayoutManager();
        layoutManager.setVerticalLayout(true);
        layoutManager.setYSpacing(20);
        layoutManager.setYSpacing(50);
        layoutManager.layoutSVG(bpel.getRootActivity());

        SVGImpl svg = new SVGImpl();
        svg.setRootActivity(bpel.getRootActivity());
       
        return(svg);
    }
View Full Code Here

   * @param transformer The optional image transformer
   * @throws java.io.IOException Failed to generate the representation
   */
    public static void generate(java.io.InputStream is, java.io.OutputStream os,
                SVGImageTransformer transformer) throws java.io.IOException {
        SVGImpl svg = generateSVGImpl(is);
       
        if (transformer == null) {
          String str=svg.getHeaders()+svg.generateSVGString();
          os.write(str.getBytes());
        } else {
          transformer.transform(svg, os);
        }
    }
View Full Code Here

        layoutManager.setVerticalLayout(true);
        layoutManager.setYSpacing(20);
        layoutManager.setYSpacing(50);
        layoutManager.layoutSVG(bpel.getRootActivity());

        SVGImpl svg = new SVGImpl();
        svg.setRootActivity(bpel.getRootActivity());
       
        return(svg);
    }
View Full Code Here

            Method method = sessionClass.getMethod("login", String.class, String.class);
            method.invoke(session, userID, password);
            loggedIn = true;
            loginProcessed = true;
        } catch (ClassNotFoundException e) {
            throw new IMException(EXCEPTION);
        } catch (IllegalAccessException e) {
            throw new IMException(EXCEPTION);
        } catch (InstantiationException e) {
            throw new IMException(EXCEPTION);
        } catch (NoSuchMethodException e) {
            throw new IMException(EXCEPTION);
        } catch (Exception e) {
            Throwable throwable = e.getCause();
            if (throwable!= null && "ymsg.network.LoginRefusedException".equals(throwable.getClass().getName())) {
                loggedIn = false;
                loginProcessed = true;
                throw new IMException(throwable.getMessage());
            }
        }
    }
View Full Code Here

        if (loginProcessed && loggedIn) {
            try {
                Method method = sessionClass.getMethod("sendMessage", String.class, String.class);
                method.invoke(session, to, message);
            } catch (NoSuchMethodException e) {
                throw new IMException(EXCEPTION);
            } catch (InvocationTargetException e) {
                throw new IMException(EXCEPTION);
            } catch (IllegalAccessException e) {
                throw new IMException(EXCEPTION);
            }
        } else {
            log.error("Got to Log in before a message can be sent.");
            throw new IMException("Got to Log in before a message can be sent.");
        }
    }
View Full Code Here

                Method method = sessionClass.getMethod("logout");
                method.invoke(session);
                loginProcessed = false;
                loggedIn = false;
            } catch (NoSuchMethodException e) {
                throw new IMException(EXCEPTION);
            } catch (InvocationTargetException e) {
                throw new IMException(EXCEPTION);
            } catch (IllegalAccessException e) {
                throw new IMException(EXCEPTION);
            }
        } else {
            log.error("Cannot disconnect cause the connection is not made as yet");
            throw new IMException("Cannot disconnect cause the connection is not made as yet");
        }
    }
View Full Code Here

                log.error(e);
            }
        } while (!loginProcessed);

        if (!loggedIn) {
            throw new IMException("Connection was not succesfull");
        }
    }
View Full Code Here

        }
    }

    public void sendMessage(String to, String message) throws IMException {
        if (disconnectCalled) {
            throw new IMException("Unable to send message cause the IM connection is been " +
                    "disconnected");
        }
        if (loginProcessed && loggedIn) {
            ImConversation imConversation = aimConnection.getIcbmService()
                    .getImConversation(new Screenname(to));
            imConversation.open();
            imConversation.addConversationListener(new AimConversationListener());
            if (imConversation.canSendMessage()) {
                messageCount++;
                imConversation.sendMessage(new SimpleMessage(message));
            } else {
                log.error("Cound not send the message to: " + to);
                throw new IMException("Cound not send the message to: " + to);
            }
            imConversation.close();
        } else {
            log.error("Got to Log in before a message can be sent.");
            throw new IMException("Got to Log in before a message can be sent.");
        }
    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.mashup.imwrapper.core.IMException

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.