Examples of CSGServerBean


Examples of org.wso2.carbon.cloud.csg.common.CSGServerBean

        AuthenticationClient authClient = new AuthenticationClient();
        return authClient.getSessionCookie(serverUrl, userName, password, hostName, domainName);
    }

    public static CSGServerBean getCSGServerBean(Resource resource) throws CSGException {
        CSGServerBean bean = new CSGServerBean();
        try {
            bean.setHost(resource.getProperty(CSGConstant.HOST));
            bean.setName(resource.getProperty(CSGConstant.NAME));
            bean.setUserName(resource.getProperty(CSGConstant.USER_NAME));
            bean.setPort(resource.getProperty(CSGConstant.PORT));
            bean.setDomainName(resource.getProperty(CSGConstant.DOMAIN_NAME));

            CryptoUtil cryptoUtil = CryptoUtil.getDefaultCryptoUtil();
            String plainPassWord = new String(cryptoUtil.base64DecodeAndDecrypt(
                    resource.getProperty(CSGConstant.PASS_WORD)));
            bean.setPassWord(plainPassWord);

            return bean;
        } catch (CryptoException e) {
            throw new CSGException("Cloud not get the CSG server information from the resource: " +
                    resource,e);
View Full Code Here

Examples of org.wso2.carbon.cloud.csg.common.CSGServerBean

        if (serviceName == null) {
            log.error("The service name is null");
            return false;
        }
        try {
            CSGServerBean csgServer = getCSGServerBean(serverName);
            if (csgServer == null) {
                throw new CSGException("No persist information found for the server name : " +
                        serverName);
            }
            String userName = csgServer.getUserName();
            String passWord = csgServer.getPassWord();
      String domainName = csgServer.getDomainName();

            String sessionCookie = CSGAgentUtils.getSessionCookie(getAuthServiceURL(csgServer),
                    userName, passWord, domainName, csgServer.getHost());
            CSGAdminClient csgAdminClient;
            if (CSGAgentUtils.isClientAxis2XMLExists()) {
                ConfigurationContext configCtx = ConfigurationContextFactory.
                        createConfigurationContextFromFileSystem(null, CSGConstant.CLIENT_AXIS2_XML);
                csgAdminClient = new CSGAdminClient(sessionCookie, getProxyURL(csgServer), configCtx);
            } else {
                csgAdminClient = new CSGAdminClient(sessionCookie, getProxyURL(csgServer));
            }

            boolean isExposedOnJMS = isExposedOnJMS(serviceName);

            ServiceAdmin serverAdmin = new ServiceAdmin(axis2Conf);
            serverAdmin.addTransportBinding(serviceName, CSGConstant.JMS_PREFIX);

            AxisService service = axis2Conf.getService(serviceName);

            // enable JMS transport sender if required
            // Note: we need to enable JMS sender before JMS listener otherwise
            // AbstractTransportListener.java:96 ( where we initialize transportOut) will be initialized
            // to a null value which causes the response to be lost and JMSSender at client side is
            // end up with a warning for not receiving the response
            if(hasInOutOperations(service)){
                enableJMSTransportSender(serviceName);
            }

            // enable JMS listener for this service
            enableJMSTransportListner(serviceName, csgAdminClient, userName, passWord,
                    csgServer.getHost(), csgServer.getDomainName());
            // deploy the proxy on CSG server
            csgAdminClient.deployProxy(getServiceMetaData(service, domainName));
           
            // flag the service as published
            flagServicePublishing(serviceName, serverName, true, isExposedOnJMS);
View Full Code Here

Examples of org.wso2.carbon.cloud.csg.common.CSGServerBean

                        transportAdmin.removeExposedTransports(serviceName, CSGConstant.JMS_PREFIX);
                        isJMSEnabled = false;
                    }
                }

                CSGServerBean csgServer = getCSGServerBean(serverName);
                if (csgServer == null) {
                    throw new CSGException("No CSG server information found with the name : " +
                            serverName);
                }
                String sessionCookie = CSGAgentUtils.getSessionCookie(
                        getAuthServiceURL(csgServer),
                        csgServer.getUserName(),
                        csgServer.getPassWord(),
                        csgServer.getDomainName(),
                        csgServer.getHost());
                CSGAdminClient csgAdminClient;
                if (CSGAgentUtils.isClientAxis2XMLExists()) {
                    ConfigurationContext configCtx = ConfigurationContextFactory.
                            createConfigurationContextFromFileSystem(null, CSGConstant.CLIENT_AXIS2_XML);
                    csgAdminClient = new CSGAdminClient(sessionCookie, getProxyURL(csgServer), configCtx);
                } else {
                    csgAdminClient = new CSGAdminClient(sessionCookie, getProxyURL(csgServer));
                }
                csgAdminClient.unDeployProxy(csgServer.getDomainName() + serviceName + "Proxy");

                // flag the service as unpublished
                flagServicePublishing(serviceName, serverName, false, isJMSEnabled);
            } catch (Exception e) {
                handleException("Cloud not remove the JMS transport from the service '" +
View Full Code Here

Examples of org.wso2.carbon.cloud.csg.common.CSGServerBean

        }
        return jndiBuf + "&" + "userName=" + userName + "&passWord=" + passWord;
    }

    private CSGServerBean getCSGServerBean(String csgServerName) throws CSGException {
        CSGServerBean bean = null;
        try {
            String resourceName = CSGConstant.REGISTRY_SERVER_RESOURCE_PATH + "/" + csgServerName;
            if (registry.resourceExists(resourceName)) {
                Resource resource = registry.get(resourceName);
                try {
                    bean = new CSGServerBean();
                    bean.setHost(resource.getProperty(CSGConstant.HOST));
                    bean.setName(resource.getProperty(CSGConstant.NAME));
                    bean.setUserName(resource.getProperty(CSGConstant.USER_NAME));
                    bean.setPort(resource.getProperty(CSGConstant.PORT));
                    bean.setDomainName(resource.getProperty(CSGConstant.DOMAIN_NAME));

                    CryptoUtil cryptoUtil = CryptoUtil.getDefaultCryptoUtil();

                    bean.setPassWord(new String(cryptoUtil.base64DecodeAndDecrypt(
                            resource.getProperty("password"))));
                } catch (CryptoException e) {
                    handleException("Cloud not convert into an AXIOM element");
                }
            } 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.