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

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


                                }
                            } else {
                                serviceID = monitoringService.getId();
                            }

                            OperationDO monitoringOperation= dsAdmin.getOperation(serviceID, operationName);
                            // check whether operation is already in DB else add it
                            if (monitoringOperation == null) {

                                OperationDO operation = new OperationDO();
                                operation.setServiceID(serviceID);
                                operation.setName(operationName);
                                BAMPersistenceManager.getPersistenceManager(BAMUtil.getRegistry()).syncOperation(operation);
                            }

                            operationUserDefinedDO.setOperationID(monitoringOperation.getOperationID());
                            dsAdmin.addUserDefinedOperationData(operationUserDefinedDO);
View Full Code Here


                    " operationName: " + operation.getName(), e);
        }
    }

    public OperationDO getOperation(int serviceId, String operationName) throws BAMException {
        OperationDO operationDO = null;
        Operation[] operations = new Operation[0];

        try {
            operations = stub.getOperationFromName(serviceId, operationName);
        } catch (RemoteException e) {
View Full Code Here

        return operationDO;
    }

    public OperationDO getOperation(int operationId) throws BAMException {
        OperationDO operationDO = null;
        Operation[] adbOperationArray = new Operation[0];
        try {
            adbOperationArray = stub.getOperation(operationId);
        } catch (RemoteException e) {
            throw new BAMException("Unable to getOperation", e);
View Full Code Here

            throw new BAMException("Unable to get operations", e);
        }

        if (operations != null && operations.length > 0) {
            for (Operation operation : operations) {
                OperationDO operationDO = ClientUtil.convertOperationToOperationDO(operation);
                operationDOList.add(operationDO);
            }

        }
        return operationDOList.toArray(new OperationDO[operationDOList.size()]);
View Full Code Here

    public OperationDO getOperation(int serviceID, String operationName) throws BAMException {

        BAMConfigurationDSClient client = null;
        try {
            client = BAMUtil.getBAMConfigurationDSClient();
            OperationDO operation = client.getOperation(serviceID, operationName);

            if (operation == null) {
                operation = new OperationDO();
                operation.setName(operationName);
                operation.setServiceID(serviceID);

                client.addOperation(operation);
                operation = client.getOperation(serviceID, operationName);
            }
View Full Code Here

        }

    }

    public OperationDO getOperation(int operationID) throws BAMException {
        OperationDO operation = BAMConfigurationCache.getOperation(operationID);
        BAMConfigurationDSClient client = null;
        try {
            if (operation == null) {
                client = BAMUtil.getBAMConfigurationDSClient();
                operation = client.getOperation(operationID);
View Full Code Here

        return serviceDO;

    }

    public static OperationDO convertOperationToOperationDO(Operation operation) {
        OperationDO operationDO = new OperationDO();
        operationDO.setDescription(operation.getOperationDesc());
        operationDO.setOperationID(Integer.parseInt(operation.getOperationID()));
        operationDO.setName(operation.getOperationName());
        operationDO.setServiceID(Integer.parseInt(operation.getServiceID()));

        return operationDO;

    }
View Full Code Here

        setServer(server);
    }

    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;
        int operationId = statisticsDO.getOperationID();
        if(operationId >0){
           op = persistenceManager.getOperation(operationId);
        }else {
          op = persistenceManager.getOperation(statisticsDO.getServiceID() ,statisticsDO.getOperationName());
        }

        //if it is not, add it to DB
        if (op == null) {
            BAMPersistenceManager.getPersistenceManager(BAMUtil.getRegistry()).addOperation(tmpOp);
        }
        //now that the op is added, op.id should definitely be set
        if (op != null) {
            statisticsDO.setOperationID(op.getOperationID());
        }

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

    public OperationDO[] getOperationList(int serviceId) throws BAMException {
        List<OperationDO> ops = persistenceManager.getAllOperations(serviceId);
        List<OperationDO> opList = new ArrayList<OperationDO>();
        if (ops != null) {
            for (OperationDO op : ops) {
                OperationDO dto = new OperationDO();
                dto.setOperationID(op.getOperationID());
                dto.setName(op.getName());
                opList.add(dto);
            }
        }
        return opList.toArray(new OperationDO[opList.size()]);
    }
View Full Code Here

    serverMap.put(server.getServerURL(),server);
  }


  public static OperationDO getOperation(int serviceId,String operationName) {
    OperationDO operation = operationMap.get(String.valueOf(serviceId)+"_"+operationName);
    return operation;
  }
View Full Code Here

TOP

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

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.