Package org.wso2.carbon.bam.common.clients

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


          }
      }

      public void addXpathConfiguration(String alias, String xpathKey, String expression, int serverId)
              throws BAMException {
          BAMConfigurationDSClient client = null;
          try {
              client = BAMUtil.getBAMConfigurationDSClient();
              client.addXpathData(alias, xpathKey, expression, serverId);
          } catch (BAMException e) {
              throw e;
          } finally {
              if (client != null) {
                  client.cleanup();
              }
          }
      }
View Full Code Here


          }
      }

      public void updateXpathConfiguration(String alias, String xpathKey, String expression,
                                           int serverId, int bamId) throws BAMException {
          BAMConfigurationDSClient client = null;
          try {
              client = BAMUtil.getBAMConfigurationDSClient();
              client.updateXpathData(alias, xpathKey, expression, serverId, bamId);
          } catch (BAMException e) {
              throw e;
          } finally {
              if (client != null) {
                  client.cleanup();
              }
          }
      }
View Full Code Here

              }
          }
      }

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

              }
          }
      }

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

                  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

    * 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

        }
        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

            }
        }
    }

    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

            }
        }
    }

    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

        }
        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

TOP

Related Classes of org.wso2.carbon.bam.common.clients.BAMConfigurationDSClient

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.