Examples of ProxyData


Examples of net.glowstone.net.ProxyData

        // Proxies modify the hostname in the HandshakeMessage to contain
        // the client's UUID and (optionally) properties
        if (session.getServer().getProxySupport()) {
            try {
                session.setProxyData(new ProxyData(session, message.getAddress()));
            } catch (IllegalArgumentException ex) {
                session.disconnect("Invalid proxy data provided.");
                // protocol is still set here and below to prevent errors
                // trying to decode packets after this one under the wrong
                // protocol, even though client is kicked
View Full Code Here

Examples of net.glowstone.net.ProxyData

            session.setVerifyUsername(name);

            // Send created request message and wait for the response
            session.send(new EncryptionKeyRequestMessage(sessionId, publicKey, verifyToken));
        } else {
            ProxyData proxy = session.getProxyData();
            if (proxy == null) {
                UUID uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(StandardCharsets.UTF_8));
                session.setPlayer(new PlayerProfile(name, uuid));
            } else {
                session.setPlayer(proxy.getProfile(name));
            }
        }
    }
View Full Code Here

Examples of org.wso2.carbon.proxyadmin.ProxyData

    public boolean create(ServiceMetaData metaData) throws CSGException {
        if (metaData == null) {
            log.error("Service meta information is null");
            return false;
        }
        ProxyData proxyData = createProxyData(metaData);
        try {
            proxyAdmin.addProxy(proxyData);
            // enable JMS transport sender for this proxy
            enableJMSTransportSender(proxyData.getName());
        } catch (ProxyAdminException e) {
            handleException("Cloud not deploy proxy service '" + "'");
        }
        if(log.isDebugEnabled()){
            log.debug("Created proxy service '" + proxyData.getName() + ",");
        }
        return true;
    }
View Full Code Here

Examples of org.wso2.carbon.proxyadmin.ProxyData

            queueName = extractQueueName(proxyMetaData.getEndpoint());
        } else {
            queueName = proxyMetaData.getServiceName();
        }

        ProxyData proxy = new ProxyData();
        proxy.setName(queueName);
        proxy.setWsdlDef(proxyMetaData.getInLineWSDL());

        String jmsProxyTimeOut = CSGCommonUtils.getPropertyValue(CSGConstant.JMS_WAIT_REPLY,
                "30000");

        // FIXME - this is the workaround for https://issues.apache.org/jira/browse/SYNAPSE-527 and
        // https://issues.apache.org/jira/browse/AXIS2-4196
        String inSeq =
            "<inSequence xmlns=\"" + SynapseConstants.SYNAPSE_NAMESPACE + "\">" +
                "<property name=\"transportNonBlocking\" scope=\"axis2\" action=\"remove\"/>" +
                "<property name=\"transport.jms.ContentTypeProperty\" value=\"Content-Type\" scope=\"axis2\"/>";

        if (!"30000".equals(jmsProxyTimeOut)) {
            inSeq = inSeq +
                    "<property name=\"JMS_WAIT_REPLY\" value=\"" + jmsProxyTimeOut + "\" scope=\"axis2\"/>";
        }

        if (proxyMetaData.isHasInOutMEP()) {
            proxy.setOutSeqXML(
                    "<outSequence xmlns=\"" + SynapseConstants.SYNAPSE_NAMESPACE + "\">" +
                            "<property name=\"TRANSPORT_HEADERS\" scope=\"axis2\" action=\"remove\"/>" +
                            "<send/>" +
                    "</outSequence>");
        } else {
            inSeq = inSeq + "<property name=\"OUT_ONLY\" scope=\"axis2\" action=\"set\" value=\"true\"/>";
        }
        inSeq = inSeq + "</inSequence>";
        proxy.setInSeqXML(inSeq);
        proxy.setFaultSeqXML(
                "<faultSequence xmlns=\"" + SynapseConstants.SYNAPSE_NAMESPACE + "\">" +
                        "<log level=\"full\"/>" +
                        "<drop/>" +
                        "</faultSequence>");
        String endpointXML =
               "<endpoint xmlns=\"" + SynapseConstants.SYNAPSE_NAMESPACE + "\">" +
                    "<address uri=\"" + proxyMetaData.getEndpoint() + "\"/>" +
                "</endpoint>";
        endpointXML = endpointXML.replace("&", "&amp;"); // To make sure that we don't receive XML
        // parsing errors
        proxy.setEndpointXML(endpointXML);
        return proxy;
    }
View Full Code Here

Examples of org.wso2.carbon.proxyadmin.stub.types.carbon.ProxyData

        super.cleanup();
        axis2Client.destroy();
    }

    private void addWSDLBasedProxy(ProxyServiceAdminStub proxyServiceAdminStub) throws RemoteException {
        ProxyData proxyData = new ProxyData();
        proxyData.setName(PROXY_NAME);


        proxyData.setEndpointXML("<endpoint xmlns=\"http://ws.apache.org/ns/synapse\">" +
                "<wsdl uri=\"file:repository/samples/resources/proxy/sample_proxy_1.wsdl\" " +
                "service=\"SimpleStockQuoteService\" port=\"SimpleStockQuoteServiceSOAP11port_http\"/></endpoint>");
        proxyData.setOutSeqXML("<outSequence xmlns=\"http://ws.apache.org/ns/synapse\"><send /></outSequence>");
        proxyData.setWsdlURI("file:repository/samples/resources/proxy/sample_proxy_1.wsdl");

        try {
            proxyServiceAdminStub.addProxy(proxyData);
        } catch (ProxyAdminException e) {
            handleError("Error while adding the proxy: " + PROXY_NAME, e);
View Full Code Here

Examples of org.wso2.carbon.proxyadmin.stub.types.carbon.ProxyData

        getSequencesTest(proxyServiceAdminStub);
        proxyManipulationTest(proxyServiceAdminStub);
    }

    private void proxyManipulationTest(ProxyServiceAdminStub proxyServiceAdminStub) throws RemoteException {
        ProxyData proxyData = new ProxyData();
        proxyData.setName(PROXY_NAME);
        proxyData.setOutSeqXML("<outSequence xmlns=\"http://ws.apache.org/ns/synapse\"><send /></outSequence>");
        proxyData.setEndpointXML("<endpoint xmlns=\"http://ws.apache.org/ns/synapse\">" +
                "<address uri=\"http://localhost:9000/services/SimpleStockQuoteService\"/></endpoint>");
        proxyData.setWsdlURI("file:repository/samples/resources/proxy/sample_proxy_1.wsdl");

        try {
            proxyServiceAdminStub.addProxy(proxyData);
            assertNotNull(proxyServiceAdminStub.getProxy(PROXY_NAME));

            proxyServiceAdminStub.enableStatistics(PROXY_NAME);
            ProxyData newProxy = proxyServiceAdminStub.getProxy(PROXY_NAME);
            assertTrue(newProxy.getEnableStatistics());

            proxyServiceAdminStub.disableStatistics(PROXY_NAME);
            newProxy = proxyServiceAdminStub.getProxy(PROXY_NAME);
            assertFalse(newProxy.getEnableStatistics());

            proxyServiceAdminStub.enableTracing(PROXY_NAME);
            newProxy = proxyServiceAdminStub.getProxy(PROXY_NAME);
            assertTrue(newProxy.getEnableTracing());

            proxyServiceAdminStub.disableTracing(PROXY_NAME);
            newProxy = proxyServiceAdminStub.getProxy(PROXY_NAME);
            assertFalse(newProxy.getEnableTracing());

            proxyServiceAdminStub.deleteProxyService(PROXY_NAME);

        } catch (ProxyAdminException e) {
            handleError("Error while invoking proxy admin service", e);
View Full Code Here

Examples of org.wso2.carbon.proxyadmin.stub.types.carbon.ProxyData

        log.debug("ThrottlleTest Test Initialised");
    }

    @Override
    public void runSuccessCase() {
        ProxyData proxyData;
        ProxyReader handler = new ProxyReader();
        int throttleCounter = 0;
        OMElement result = null;
        log.debug("Running AddProxy SuccessCase ");
        try {
View Full Code Here

Examples of org.wso2.carbon.proxyadmin.stub.types.carbon.ProxyData

        super.cleanup();
        axis2Client.destroy();
    }

    private void createProxy(ProxyServiceAdminStub proxyServiceAdminStub) throws RemoteException {
        ProxyData proxyData = new ProxyData();
        proxyData.setName(PROXY_NAME);
        proxyData.setOutSeqXML("<outSequence xmlns=\"http://ws.apache.org/ns/synapse\"><send /></outSequence>");
        proxyData.setEndpointXML("<endpoint xmlns=\"http://ws.apache.org/ns/synapse\">" +
                "<address uri=\"http://localhost:9000/services/SimpleStockQuoteService\"/></endpoint>");
        proxyData.setWsdlURI("file:repository/samples/resources/proxy/sample_proxy_1.wsdl");

        try {
            proxyServiceAdminStub.addProxy(proxyData);
            assertNotNull(proxyServiceAdminStub.getProxy(PROXY_NAME));
        } catch (ProxyAdminException e) {
View Full Code Here

Examples of org.wso2.carbon.proxyadmin.stub.types.carbon.ProxyData

     * @param proxyXML88 proxy service configuration
     * @return the <code>ProxyData</code> object populated with given information
     * @throws AxisFault if the given XML cannot be parsed
     */
    public ProxyData getDesignView(String proxyXML88) throws AxisFault {
        ProxyData pd = new ProxyData();
        try {
            OMElement elem = new StAXOMBuilder(
                    new ByteArrayInputStream(proxyXML88.getBytes())).getDocumentElement();

            // check whether synapse namespace is present in the configuration.
            Iterator itr = elem.getAllDeclaredNamespaces();
            OMNamespace ns;
            boolean synapseNSPresent = false;
            while (itr.hasNext()) {
                ns = (OMNamespace)itr.next();
                if (XMLConfigConstants.SYNAPSE_NAMESPACE.equals(ns.getNamespaceURI())) {
                    synapseNSPresent = true;
                    break;
                }
            }
            if (!synapseNSPresent) {
                // Oops! synpase namespace is not present
                throw new AxisFault(bundle.getString("synapse.namespace.not.present"));
            }
            OMAttribute name = elem.getAttribute(new QName("name"));
            if (name != null) {
                pd.setName(name.getAttributeValue());
            }

            OMAttribute statistics = elem.getAttribute(new QName(XMLConfigConstants.STATISTICS_ATTRIB_NAME));
            if (statistics != null) {
                String statisticsValue = statistics.getAttributeValue();
                if (statisticsValue != null) {
                    if (XMLConfigConstants.STATISTICS_ENABLE.equals(statisticsValue)) {
                        pd.setEnableStatistics(true);
                    } else if (XMLConfigConstants.STATISTICS_DISABLE.equals(statisticsValue)) {
                        pd.setEnableStatistics(false);
                    }
                }
            }

            OMAttribute trans = elem.getAttribute(new QName("transports"));
            if (trans != null) {
                String transports = trans.getAttributeValue();
                if (transports == null || "".equals(transports) ||ProxyService.ALL_TRANSPORTS.equals(transports)) {
                    // default to all transports using service name as destination
                } else {
                    String [] arr = transports.split(",");
                    if (arr != null && arr.length != 0) {
                        pd.setTransports(arr);
                    }
                }
            }

            OMAttribute pinnedServers = elem.getAttribute(new QName("pinnedServers"));
            if (pinnedServers != null) {
                String pinnedServersValue = pinnedServers.getAttributeValue();
                if (pinnedServersValue == null || "".equals(pinnedServersValue)) {
                    // default to all servers
                } else {
                    String [] arr = pinnedServersValue.split(",");
                    if (arr != null && arr.length != 0) {
                        pd.setPinnedServers(arr);
                    }
                }
            }

            OMAttribute trace = elem.getAttribute(new QName(XMLConfigConstants.TRACE_ATTRIB_NAME));
            if (trace != null) {
                String traceValue = trace.getAttributeValue();
                if (traceValue != null) {
                    if (traceValue.equals(XMLConfigConstants.TRACE_ENABLE)) {
                        pd.setEnableTracing(true);
                    } else if (traceValue.equals(XMLConfigConstants.TRACE_DISABLE)) {
                        pd.setEnableTracing(false);
                    }
                }
            }

            OMAttribute startOnLoad = elem.getAttribute(new QName("startOnLoad"));
            String val;
            if (startOnLoad != null && (val = startOnLoad.getAttributeValue()) != null && !"".equals(val)) {
                pd.setStartOnLoad(Boolean.valueOf(val));
            } else {
                pd.setStartOnLoad(true);
            }

            // read definition of the target of this proxy service. The target could be an 'endpoint'
            // or a named sequence. If none of these are specified, the messages would be mediated
            // by the Synapse main mediator
            OMElement target = elem.getFirstChildWithName(
                    new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "target"));
            if (target != null) {
                OMAttribute inSequence = target.getAttribute(new QName("inSequence"));
                if (inSequence != null) {
                    pd.setInSeqKey(inSequence.getAttributeValue());
                } else {
                    OMElement inSequenceElement = target.getFirstChildWithName(
                            new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "inSequence"));
                    if (inSequenceElement != null) {
                        pd.setInSeqXML(inSequenceElement.toString());
                    }
                }
                OMAttribute outSequence = target.getAttribute(new QName("outSequence"));
                if (outSequence != null) {
                    pd.setOutSeqKey(outSequence.getAttributeValue());
                } else {
                    OMElement outSequenceElement = target.getFirstChildWithName(
                            new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "outSequence"));
                    if (outSequenceElement != null) {
                        pd.setOutSeqXML(outSequenceElement.toString());
                    }
                }
                OMAttribute faultSequence = target.getAttribute(new QName("faultSequence"));
                if (faultSequence != null) {
                    pd.setFaultSeqKey(faultSequence.getAttributeValue());
                } else {
                    OMElement faultSequenceElement = target.getFirstChildWithName(
                            new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "faultSequence"));
                    if (faultSequenceElement != null) {
                        pd.setFaultSeqXML(faultSequenceElement.toString());
                    }
                }
                OMAttribute tgtEndpt = target.getAttribute(new QName("endpoint"));
                if (tgtEndpt != null) {
                    pd.setEndpointKey(tgtEndpt.getAttributeValue());
                } else {
                    OMElement endpointElement = target.getFirstChildWithName(
                            new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "endpoint"));
                    if (endpointElement != null) {
                        pd.setEndpointXML(endpointElement.toString());
                    }
                }
            }

            Iterator props = elem.getChildrenWithName(
                    new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "parameter"));
            ArrayList <Entry> params = new ArrayList<Entry>();
            Entry entry = null;
            while (props.hasNext()) {
                Object o = props.next();
                if (o instanceof OMElement) {
                    OMElement prop = (OMElement) o;
                    OMAttribute pname = prop.getAttribute(new QName("name"));
                    OMElement propertyValue = prop.getFirstElement();
                    if (pname != null) {
                        if (propertyValue != null) {
                            entry = new Entry();
                            entry.setKey(pname.getAttributeValue());
                            entry.setValue(propertyValue.toString());
                            params.add(entry);
                        } else {
                            entry = new Entry();
                            entry.setKey(pname.getAttributeValue());
                            entry.setValue(prop.getText().trim());
                            params.add(entry);
                        }
                    }
                }
            }
            pd.setServiceParams(params.toArray(new Entry[params.size()]));


            OMElement wsdl = elem.getFirstChildWithName(
                    new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "publishWSDL"));
            if (wsdl != null) {
                OMAttribute wsdlkey = wsdl.getAttribute(
                        new QName(XMLConfigConstants.NULL_NAMESPACE, "key"));
                if (wsdlkey != null) {
                    pd.setWsdlKey(wsdlkey.getAttributeValue());
                } else {
                    OMAttribute wsdlURI = wsdl.getAttribute(
                            new QName(XMLConfigConstants.NULL_NAMESPACE, "uri"));
                    if (wsdlURI != null) {
                        pd.setWsdlURI(wsdlURI.getAttributeValue());
                    } else {
                        OMElement wsdl11 = wsdl.getFirstChildWithName(
                                new QName(WSDLConstants.WSDL1_1_NAMESPACE, "definitions"));
                        String wsdlDef;
                        if (wsdl11 != null) {
                            wsdlDef = wsdl11.toString().replaceAll("\n|\\r|\\f|\\t", "");
                            wsdlDef = wsdlDef.replaceAll("> +<", "><");
                            pd.setWsdlDef(wsdlDef);
                        } else {
                            OMElement wsdl20 = wsdl.getFirstChildWithName(
                                    new QName(WSDL2Constants.WSDL_NAMESPACE, "description"));
                            if (wsdl20 != null) {
                                wsdlDef = wsdl20.toString().replaceAll("\n|\\r|\\f|\\t", "");
                                wsdlDef = wsdlDef.replaceAll("> +<", "><");
                                pd.setWsdlDef(wsdlDef);
                            }
                        }
                    }
                }

                Iterator it = wsdl.getChildrenWithName(
                        new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "resource"));
                ArrayList <Entry> resources = new ArrayList<Entry>();
                Entry resource = null;
                while (it.hasNext()) {
                    OMElement resourceElem = (OMElement)it.next();
                    OMAttribute location = resourceElem.getAttribute
                            (new QName(XMLConfigConstants.NULL_NAMESPACE, "location"));
                    if (location == null) {
                        // todo handle exception
                    }
                    OMAttribute key = resourceElem.getAttribute(
                            new QName(XMLConfigConstants.NULL_NAMESPACE, "key"));
                    if (key == null) {
                        // todo handle exception
                    }
                    resource = new Entry();
                    resource.setKey(location.getAttributeValue());
                    resource.setValue(key.getAttributeValue());
                    resources.add(resource);
                }
                pd.setWsdlResources(resources.toArray(new Entry[resources.size()]));
            }

            OMElement enableSec = elem.getFirstChildWithName(new QName(XMLConfigConstants.SYNAPSE_NAMESPACE,
                    "enableSec"));
            if (enableSec != null) {
                pd.setEnableSecurity(true);
            }
           
        } catch (XMLStreamException e) {
            handleException(bundle.getString("unable.to.build.the.design.view.from.the.given.xml"), e);
        }
View Full Code Here

Examples of railo.runtime.net.proxy.ProxyData

        if(StringUtil.isEmpty(strCharset))strCharset="iso-8859-1";
        URL url = HTTPUtil.toURL(src,true);
     
      // set Proxy
      if(StringUtil.isEmpty(proxyserver) && config.isProxyEnableFor(url.getHost())) {
        ProxyData pd = config.getProxyData();
        proxyserver=pd==null?null:pd.getServer();
        proxyport=pd==null?0:pd.getPort();
        proxyuser=pd==null?null:pd.getUsername();
        proxypassword=pd==null?null:pd.getPassword();
      }
     
      HTTPResponse method = HTTPEngine.get(url, authUser, authPassword, -1,HTTPEngine.MAX_REDIRECT, null, userAgent,
          ProxyDataImpl.getInstance(proxyserver, proxyport, proxyuser, proxypassword),null);
     
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.