Examples of BAMConfigurationDSClient


Examples of org.wso2.carbon.bam.common.clients.BAMConfigurationDSClient

                  client.cleanup();
              }
          }
      }
      public void updateMessageProperty(String value, int messagePropertyKeyId) throws BAMException {
          BAMConfigurationDSClient client = null;
          try {
              client = BAMUtil.getBAMConfigurationDSClient();
              client.updateMessageProperty(value, messagePropertyKeyId);
          } catch (BAMException e) {
              throw e;
          } finally {
              if (client != null) {
                  client.cleanup();
              }
          }
      }
View Full Code Here

Examples of org.wso2.carbon.bam.common.clients.BAMConfigurationDSClient

    * SERVER NEED TO GET RID OF REGISTRY Consider USERNAME/PASSWORD/POLLINGINTERVAL
    */

    public int addMonitoredServer(ServerDO server) throws BAMException {
        int addingServerStatus = -1;
        BAMConfigurationDSClient bamConfigurationDSClient = BAMUtil.getBAMConfigurationDSClient();
        int tenantId;
        if (server.getTenantID() == NO_TENANT_MODE) {
            BAMTenantAdmin bamTenantAdmin = new BAMTenantAdmin();
            tenantId = bamTenantAdmin.getTenantId();
        } else {
            tenantId = server.getTenantID();
        }

        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()));
                int serverID = bamConfigurationDSClient.addServer(server);
                if (serverID != BAMConstants.UNASSIGNED_SERVER_ID) {
                    addingServerStatus = BAMConstants.SERVER_SUCCESSFULLY_ADDED;
                }
            } else {
                addingServerStatus = BAMConstants.SERVER_ALREADY_EXIST;
            }
        } catch (CryptoException e) {
            throw new BAMException("Unable to encrypt password of server " + serverUrl, e);
        } finally {
            if (bamConfigurationDSClient != null) {
                bamConfigurationDSClient.cleanup();
            }
        }
        return addingServerStatus;
    }
View Full Code Here

Examples of org.wso2.carbon.bam.common.clients.BAMConfigurationDSClient

        }
        return decryptedPassword;
    }

    public void removeMonitoredServer(int serverID) throws BAMException {
        BAMConfigurationDSClient client = null;
        try {
            client = BAMUtil.getBAMConfigurationDSClient();
            try {
                client.removeServer(serverID);
            } catch (Exception e) {
                log.error("Can not delete monitored server entry from DB", e);
            }

        } finally {
            if (client != null) {
                client.cleanup();
            }
        }
    }
View Full Code Here

Examples of org.wso2.carbon.bam.common.clients.BAMConfigurationDSClient

            }
        }
    }

    public void updateMonitoredServer(ServerDO server) throws BAMException {
        BAMConfigurationDSClient client = null;
        try {
            client = BAMUtil.getBAMConfigurationDSClient();
            server.setPassword(encryptPassword(server.getPassword()));

            try {
                client.updateServer(server);
            } catch (Exception e) {
                log.error("Could not update the server in DB", e);
            }
            BAMUtil.getServersListCache().addServer(server);
        } catch (CryptoException e) {
            throw new BAMException("Unable to encrypt password of server " + server.getServerURL(), e);
        } finally {
            if (client != null) {
                client.cleanup();
            }
        }
    }
View Full Code Here

Examples of org.wso2.carbon.bam.common.clients.BAMConfigurationDSClient

            }
        }
    }

    public List<ServerDO> getMonitoredServers(int tenantID) throws BAMException {
        BAMConfigurationDSClient client = BAMUtil.getBAMConfigurationDSClient();

        ServerDO[] servers;
        try {
            if (tenantID == NO_TENANT_MODE) {
                servers = client.getAllServers();
            } else {
                servers = client.getServersForTenant(tenantID);
            }
            if (servers != null) {
                for (ServerDO server : servers) {
                    if (server.getPassword() != null) {
                        server.setPassword(decryptPassword(server.getPassword()));
                    }
                }
                return Arrays.asList(servers);
            }
        } catch (CryptoException e) {
            throw new BAMException("Cannot decrypt password for server ", e);
        } finally {
            if (client != null) {
                client.cleanup();
            }
        }
        return new ArrayList<ServerDO>();
    }
View Full Code Here

Examples of org.wso2.carbon.bam.common.clients.BAMConfigurationDSClient

        }
        return new ArrayList<ServerDO>();
    }

    public List<ServerDO> getMonitoredServerListWithCategoryName(int tenantID) throws BAMException {
        BAMConfigurationDSClient client = BAMUtil.getBAMConfigurationDSClient();

        ServerDO[] servers;
        try {
            if (tenantID == NO_TENANT_MODE) {
                servers = client.getAllServersWithCategoryName();
            } else {
                servers = client.getServersWithCategoryNameForTenant(tenantID);
            }
            if (servers != null) {
                for (ServerDO server : servers) {
                    server.setPassword(decryptPassword(server.getPassword()));
                }
                return Arrays.asList(servers);
            }
        } catch (CryptoException e) {
            throw new BAMException("Cannot decrypt password for server ", e);
        } finally {
            if (client != null) {
                client.cleanup();
            }
        }
        return new ArrayList<ServerDO>();
    }
View Full Code Here

Examples of org.wso2.carbon.bam.common.clients.BAMConfigurationDSClient

        return new ArrayList<ServerDO>();
    }


    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();
            }
        }
        return server;
    }
View Full Code Here

Examples of org.wso2.carbon.bam.common.clients.BAMConfigurationDSClient

        }
        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();
            }
        }
        return server;
    }
View Full Code Here

Examples of org.wso2.carbon.bam.common.clients.BAMConfigurationDSClient

    public Registry getRegistry() {
        return registry;
    }

    public void deactivateServer(int serverID) throws BAMException {
        BAMConfigurationDSClient client = null;

        try {
            client = BAMUtil.getBAMConfigurationDSClient();
            client.deactivateServer(serverID);
            BAMUtil.getServersListCache().removeServer(serverID);
        } finally {
            if (client != null) {
                client.cleanup();
            }
        }
    }
View Full Code Here

Examples of org.wso2.carbon.bam.common.clients.BAMConfigurationDSClient

            }
        }
    }

    public void activateServer(int serverID, String subscriptionID) throws BAMException {
        BAMConfigurationDSClient client = null;

        try {
            client = BAMUtil.getBAMConfigurationDSClient();
            client.activateServer(serverID, subscriptionID);
        } catch (BAMException e) {
            throw e;
        } finally {
            if (client != null) {
                client.cleanup();
            }
        }
    }
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.