Package org.wso2.carbon.bam.common.dataobjects.service

Examples of org.wso2.carbon.bam.common.dataobjects.service.ServerDO


        }

        String serverUrl = server.getServerURL();
        String severType = server.getServerType();
        int category = server.getCategory();
        ServerDO monitoredServerDO = bamConfigurationDSClient.getServer(serverUrl, tenantId, severType, category);

        try {
            if (monitoredServerDO == null) {
                server.setTenantID(tenantId);
                server.setPassword(encryptPassword(server.getPassword()));
View Full Code Here


    }


    public ServerDO getMonitoredServer(int serverID) throws BAMException {
        BAMConfigurationDSClient client = null;
        ServerDO server = null;
        try {
            client = BAMUtil.getBAMConfigurationDSClient();
            server = client.getServer(serverID);
            if (server != null && server.getPassword() != null) {
                server.setPassword(decryptPassword(server.getPassword()));
            }

        } catch (CryptoException e) {
            throw new BAMException("Cannot decrypt password for server " + server.getServerURL(), e);
        } finally {
            if (client != null) {
                client.cleanup();
            }
        }
View Full Code Here

        return server;
    }

    public ServerDO getMonitoredServer(String serverURL) throws BAMException {
        BAMConfigurationDSClient client = null;
        ServerDO server = null;
        try {
            client = BAMUtil.getBAMConfigurationDSClient();
            server = client.getServer(serverURL);
            if (server != null && server.getPassword() != null) {
                server.setPassword(decryptPassword(server.getPassword()));
            }

        } catch (CryptoException e) {
            throw new BAMException("Cannot decrypt password for server " + server.getServerURL(), e);
        } finally {
            if (client != null) {
                client.cleanup();
            }
        }
View Full Code Here

        return servicesURL + "/services/" + serviceName;
    }

    public static ServerDO convertServerToServerDO(Server monitorServer) {

        ServerDO server = new ServerDO();
        server.setServerType(monitorServer.getServerType());
        server.setId(monitorServer.getServerID());
        server.setTenantID(monitorServer.getTenentID());
        server.setDescription(monitorServer.getServerDesc());
        server.setServerURL(monitorServer.getServerURL());
        server.setActive(monitorServer.getIsActive());
        server.setServerType(monitorServer.getServerType());
        server.setCategory(monitorServer.getStatCategory());
        server.setSubscriptionID(monitorServer.getSubscriptionID());
        server.setSubscriptionEPR(monitorServer.getEpr());

        if (monitorServer.getIsActive()) {
            server.setActive(BAMConstants.SERVER_ACTIVE_STATE);
        } else {
            server.setActive(BAMConstants.SERVER_INACTIVE_STATE);
        }

        server.setPassword(monitorServer.getPassword());
        server.setUserName(monitorServer.getUsername());

        return server;
    }
View Full Code Here

        return server;
    }

    public static ServerDO convertToServerDOWithCategoryName(ServerWithCategory monitorServer) {

        ServerDO server = new ServerDO();
        server.setServerType(monitorServer.getServerType());
        server.setId(monitorServer.getServerID());
        server.setTenantID(monitorServer.getTenentID());
        server.setDescription(monitorServer.getServerDesc());
        server.setServerURL(monitorServer.getServerURL());
        server.setActive(monitorServer.getIsActive());
        server.setServerType(monitorServer.getServerType());
        server.setCategory(monitorServer.getStatCategory());
        server.setCategoryName(monitorServer.getStatCategoryName());
        server.setSubscriptionID(monitorServer.getSubscriptionID());
        server.setSubscriptionEPR(monitorServer.getEpr());
        server.setActive(monitorServer.getIsActive());
        server.setPassword(monitorServer.getPassword());
        server.setUserName(monitorServer.getUsername());

        return server;
    }
View Full Code Here

    }

    public ServerDO getServerDetails(int serverId) throws BAMException {

        ServerDO server = persistenceManager.getMonitoredServer(serverId);
        return server;
    }
View Full Code Here

//        } catch (BrokerClientException e) {
//            throw new BAMException("Failed to subscribe : " +subscriberURL+ "to topic : " +topic ,e);
        } catch (Exception e) {
            try {
                ServerDO server = new ServerDO();
                server.setServerURL(serverURL);
                server.setUserName(userName);
                server.setPassword(password);
                boolean authenticated = ClientAuthHandler.getClientAuthHandler().isAuthenticateWithServer(server);
                if (authenticated) {
                    String cookie = ClientAuthHandler.getClientAuthHandler().getSessionString(server);
                    String brokerURL_2_0_3 = serverURL + "/services/BAMServiceStatisticsPublisherService";
                    subId = BAMUtil.getBrokerClient(brokerURL_2_0_3, cookie).subscribe(topic, subscriberURL);
View Full Code Here

        return subId;

    }
    public static void unsubscribe(String brokerURL, String identifier, String serverType, String serverURL) throws BAMException {
        ServerDO monitoredServer = null;
        try {
            monitoredServer = persistenceManager.getMonitoredServer(serverURL);

            BrokerClient client = new BrokerClient(BAMUtil.getConfigurationContextService().getServerConfigContext(),
                                                   brokerURL, monitoredServer.getUserName(), monitoredServer.getPassword());
            client.unsubscribe(identifier);
        } catch (RemoteException e) {


        } catch (Exception e) {
            try {
                ServerDO server = new ServerDO();
                server.setServerURL(serverURL);
                server.setUserName(monitoredServer.getUserName());
                server.setPassword(monitoredServer.getPassword());
                boolean authenticated = ClientAuthHandler.getClientAuthHandler().isAuthenticateWithServer(server);
                if (authenticated) {
                    String cookie = ClientAuthHandler.getClientAuthHandler().getSessionString(server);
                    String brokerURL_2_0_3 = serverURL + "/services/BAMServiceStatisticsPublisherService";
                    BAMUtil.getBrokerClient(brokerURL_2_0_3, cookie).unsubscribe(identifier);
View Full Code Here

   * @param tenantId
   * @param URL
   * @return
   */
  public static ServerDO getServer(int tenantId, String URL) {
    ServerDO server = tenantServerMap.get(tenantId+"_"+URL);
    return server;
  }
View Full Code Here

    tenantServerMap.put(tenantId+"_"+server.getServerURL(),server);
  }


  public static ServerDO getServer(String URL) {
    ServerDO server = serverMap.get(URL);
    return server;
  }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.bam.common.dataobjects.service.ServerDO

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.