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

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


            throw new BAMException("activateServer failed", e);
        }
    }

    public ServiceDO getService(int serviceId) throws BAMException {
        ServiceDO service = null;
        Service[] services = new Service[0];

        try {
            services = stub.getService(serviceId);
        } catch (RemoteException e) {
View Full Code Here


        return service;
    }

    public ServiceDO getService(int serverId, String serviceName) throws BAMException {
        ServiceDO service = null;
        Service[] services = new Service[0];

        try {
            services = stub.getServiceForServer(serverId, serviceName);
        } catch (RemoteException e) {
View Full Code Here

        return service;
    }

    public ServiceDO[] getAllServices(int serverId) throws BAMException {
        List<ServiceDO> serviceDOList = new ArrayList<ServiceDO>();
        ServiceDO service;
        Service[] services = new Service[0];

        try {
            services = stub.getAllServices(serverId);
        } catch (RemoteException e) {
View Full Code Here

            }
        }
    }

    public ServiceDO getService(int serviceID) throws BAMException {
        ServiceDO service = BAMConfigurationCache.getService(serviceID);
        BAMConfigurationDSClient client = null;
        try {
            if (service == null) {
                client = BAMUtil.getBAMConfigurationDSClient();
                return client.getService(serviceID);
View Full Code Here

            }
        }
    }

    public ServiceDO getService(int serverID, String serviceName) throws BAMException {
        ServiceDO cashService = BAMConfigurationCache.getService(serverID, serviceName);
        ServiceDO service = null;
        BAMConfigurationDSClient configurationDSClient = null;

        try {
            if (cashService == null) {
                configurationDSClient = BAMUtil.getBAMConfigurationDSClient();
                // load service from DB
                service = configurationDSClient.getService(serverID, serviceName);
                if (service == null) {
                    // service not there in the DB, hence we need to add it
                    service = new ServiceDO();
                    service.setName(serviceName);
                    service.setServerID(serverID);
                    // This is to guard against occasional race condition of service
                    // being added while operation is also being added.
                    boolean raceCondition = false;
                    try {
                        configurationDSClient.addService(service);
View Full Code Here

        return server;
    }

    public static ServiceDO convertServiceToServiceDO(Service service) {

        ServiceDO serviceDO = new ServiceDO();
        serviceDO.setId(Integer.parseInt(service.getServiceID()));
        serviceDO.setName(service.getServiceName());
        serviceDO.setDescription(service.getServiceDesc());
        serviceDO.setServerID(Integer.parseInt(service.getServerID()));

        return serviceDO;

    }
View Full Code Here

    public StatisticsDO pullData(Object ctx) throws BAMException, RemoteException {
       BAMPersistenceManager persistenceManager = BAMPersistenceManager.getPersistenceManager(BAMUtil.getRegistry());
        OperationDO tmpOp = (OperationDO) ctx;
        String sessionCookie = ClientAuthHandler.getClientAuthHandler().getSessionString(getServer());
        StatisticsAdminClient client = new StatisticsAdminClient(getServer().getServerURL(), sessionCookie);
        ServiceDO svc = persistenceManager.getService(tmpOp.getServiceID());
        OperationStatistics opStatistics = client.getOperationStatistics(svc.getName(), tmpOp.getName());
        OperationStatisticsDO statisticsDO = new OperationStatisticsDO();
        statisticsDO.setServiceID(tmpOp.getServiceID());
        statisticsDO.setOperationName(tmpOp.getName());
        //This should set op.id if the service is already in DB
        OperationDO op = null;
View Full Code Here

    public ServiceDO[] getServiceList(int serverID) throws BAMException {
        List<ServiceDO> services = persistenceManager.getAllServices(serverID);
        List<ServiceDO> svcList = new ArrayList<ServiceDO>();
        if (services != null) {
            for (ServiceDO svc : services) {
                ServiceDO dto = new ServiceDO();
                dto.setId(svc.getId());
                dto.setName(svc.getName());
                svcList.add(dto);
            }
        }
        return svcList.toArray(new ServiceDO[svcList.size()]);
    }
View Full Code Here

        statisticsDO.setServerID(getServer().getId());
        statisticsDO.setServerURL(getServer().getServerURL());
        statisticsDO.setServiceName(svcName);

        //This should set svc.serviceID if the service is already in DB
          ServiceDO svc ;
        int serviceId = statisticsDO.getServiceID();

        if (serviceId > 0) {
            svc = pm.getService(serviceId);
        } else {
            svc = pm.getService(statisticsDO.getServerID(), statisticsDO.getServiceName());
        }


        if (svc == null) {
            svc = new ServiceDO();
            svc.setName(svcName);
            svc.setServerID(getServer().getId());
            BAMPersistenceManager.getPersistenceManager(BAMUtil.getRegistry()).addService(svc);
            //now that the service was added, this should definitely set serviceID.
           // svc = statisticsDO.getService();
        }

        statisticsDO.setServiceID(svc.getId());

        //TODO Where should we set the timestamp?
        statisticsDO.setTimestamp(Calendar.getInstance());
        populateServiceStatisticsDO(statisticsDO, svcStatistics);
        return statisticsDO;
View Full Code Here

   * @param serverID
   * @param serviceName
   * @return
   */
  public static ServiceDO getService(int serverID, String serviceName) {
    ServiceDO service = serviceMap.get(serverID+"_"+serviceName);
    return service;
  }
View Full Code Here

TOP

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

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.