Search in sources :

Example 11 with InstanceManagementException

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException in project carbon-business-process by wso2.

the class InstanceManagementServiceSkeleton method getInstanceInformation.

private InstanceInfoType getInstanceInformation(final long iid) throws InstanceManagementException {
    final InstanceInfoType instanceInfo = new InstanceInfoType();
    instanceInfo.setIid(Long.toString(iid));
    dbexec(new BpelDatabase.Callable<Object>() {

        public Object run(BpelDAOConnection conn) throws InstanceManagementException {
            ProcessInstanceDAO instance = conn.getInstanceEagerly(iid, false);
            if (instance == null) {
                String errMsg = "Instance " + iid + " not found.";
                log.error(errMsg);
                throw new InstanceManagementException(errMsg);
            }
            fillInstanceInfo(instanceInfo, instance);
            return null;
        }
    });
    return instanceInfo;
}
Also used : InstanceManagementException(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException) ProcessInstanceDAO(org.apache.ode.bpel.dao.ProcessInstanceDAO) BpelDatabase(org.apache.ode.bpel.engine.BpelDatabase) BpelDAOConnection(org.apache.ode.bpel.dao.BpelDAOConnection) InstanceInfoType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.InstanceInfoType) LimitedInstanceInfoType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.LimitedInstanceInfoType)

Example 12 with InstanceManagementException

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException in project carbon-business-process by wso2.

the class InstanceManagementServiceSkeleton method getActivityLifeCycleEvents.

private ActivityLifeCycleEventsType getActivityLifeCycleEvents(final long iid) throws InstanceManagementException {
    final ActivityLifeCycleEventsType activityLifeCycleEvents = new ActivityLifeCycleEventsType();
    activityLifeCycleEvents.setIid(Long.toString(iid));
    dbexec(new BpelDatabase.Callable<Object>() {

        public Object run(BpelDAOConnection conn) throws InstanceManagementException {
            ProcessInstanceDAO instance = conn.getInstanceEagerly(iid, true);
            if (instance == null) {
                String errMsg = "Instance " + iid + " not found.";
                log.error(errMsg);
                throw new InstanceManagementException(errMsg);
            }
            fillActivityLifeCycleEvents(activityLifeCycleEvents, instance);
            return null;
        }
    });
    return activityLifeCycleEvents;
}
Also used : InstanceManagementException(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException) ProcessInstanceDAO(org.apache.ode.bpel.dao.ProcessInstanceDAO) BpelDatabase(org.apache.ode.bpel.engine.BpelDatabase) BpelDAOConnection(org.apache.ode.bpel.dao.BpelDAOConnection) ActivityLifeCycleEventsType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ActivityLifeCycleEventsType)

Example 13 with InstanceManagementException

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException in project carbon-business-process by wso2.

the class InstanceManagementServiceSkeleton method getScopeInfoWithEvents.

private ScopeInfoWithEventsType getScopeInfoWithEvents(ScopeDAO scope) throws InstanceManagementException {
    final ScopeInfoWithEventsType scopeInfoWithEvents = new ScopeInfoWithEventsType();
    /*dbexec(new BpelDatabase.Callable<Object>() {
            public Object run(BpelDAOConnection conn) throws InstanceManagementException {
                ScopeDAO scope = conn.getScopeEagerly(siid);
                if (scope == null) {
                    String errMsg = "Scope " + siid + " not found.";
                    log.error(errMsg);
                    throw new InstanceManagementException(errMsg);
                }
                fillScopeInfoWithEvents(scopeInfoWithEvents, scope);
                return null;
            }
        });*/
    fillScopeInfoWithEvents(scopeInfoWithEvents, scope);
    return scopeInfoWithEvents;
}
Also used : ScopeInfoWithEventsType(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.ScopeInfoWithEventsType)

Example 14 with InstanceManagementException

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException in project carbon-business-process by wso2.

the class InstanceManagementServiceSkeleton method getInstanceSummary.

public InstanceSummaryE getInstanceSummary() throws InstanceManagementException {
    InstanceSummaryE instanceSummary = new InstanceSummaryE();
    Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    TenantProcessStoreImpl tenantProcessStore = (TenantProcessStoreImpl) bpelServer.getMultiTenantProcessStore().getTenantsProcessStore(tenantId);
    instanceSummary.setActive(getInstanceCountByState(getTenantsProcessList(tenantProcessStore.getProcessConfigMap().keySet()), INSTANCE_STATUS_ACTIVE).intValue());
    instanceSummary.setCompleted(getInstanceCountByState(getTenantsProcessList(tenantProcessStore.getProcessConfigMap().keySet()), INSTANCE_STATUS_COMPLETED).intValue());
    instanceSummary.setFailed(getInstanceCountByState(getTenantsProcessList(tenantProcessStore.getProcessConfigMap().keySet()), INSTANCE_STATUS_FAILED).intValue());
    instanceSummary.setSuspended(getInstanceCountByState(getTenantsProcessList(tenantProcessStore.getProcessConfigMap().keySet()), INSTANCE_STATUS_SUSPENDED).intValue());
    instanceSummary.setTerminated(getInstanceCountByState(getTenantsProcessList(tenantProcessStore.getProcessConfigMap().keySet()), INSTANCE_STATUS_TERMINATED).intValue());
    return instanceSummary;
}
Also used : InstanceSummaryE(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.InstanceSummaryE) TenantProcessStoreImpl(org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl)

Example 15 with InstanceManagementException

use of org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException in project carbon-business-process by wso2.

the class InstanceManagementServiceSkeleton method getInstanceCountByState.

private Long getInstanceCountByState(String processList, String instanceState) throws InstanceManagementException {
    if (isProcessListEmpty(processList)) {
        return (long) 0;
    }
    final List<Long> instanceCountList = new ArrayList<Long>();
    StringBuilder filter = new StringBuilder();
    if (!isProcessListEmpty(processList)) {
        filter.append(processList);
    }
    filter.append("status=");
    filter.append(instanceState);
    final InstanceFilter instanceFilter = new InstanceFilter(filter.toString(), null, Integer.MAX_VALUE);
    try {
        BpelDatabase bpelDb = bpelServer.getODEBPELServer().getBpelDb();
        bpelDb.exec(new BpelDatabase.Callable<Object>() {

            public Object run(BpelDAOConnection conn) throws AxisFault {
                instanceCountList.add(conn.instanceCount(instanceFilter));
                return null;
            }
        });
    } catch (Exception e) {
        String errMsg = "Error querying instances from database. Filter: " + instanceFilter.toString();
        log.error(errMsg, e);
        throw new InstanceManagementException(errMsg, e);
    }
    return instanceCountList.get(0);
}
Also used : AxisFault(org.apache.axis2.AxisFault) InstanceFilter(org.apache.ode.bpel.common.InstanceFilter) BpelDatabase(org.apache.ode.bpel.engine.BpelDatabase) ArrayList(java.util.ArrayList) BpelDAOConnection(org.apache.ode.bpel.dao.BpelDAOConnection) ProcessNotFoundException(org.apache.ode.bpel.pmapi.ProcessNotFoundException) InstanceManagementException(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException) ProcessingException(org.apache.ode.bpel.pmapi.ProcessingException) InstanceManagementException(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException)

Aggregations

InstanceManagementException (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException)16 BpelDAOConnection (org.apache.ode.bpel.dao.BpelDAOConnection)10 BpelDatabase (org.apache.ode.bpel.engine.BpelDatabase)10 ProcessInstanceDAO (org.apache.ode.bpel.dao.ProcessInstanceDAO)9 ProcessNotFoundException (org.apache.ode.bpel.pmapi.ProcessNotFoundException)6 ProcessingException (org.apache.ode.bpel.pmapi.ProcessingException)6 TenantProcessStoreImpl (org.wso2.carbon.bpel.core.ode.integration.store.TenantProcessStoreImpl)6 Collection (java.util.Collection)5 InstanceFilter (org.apache.ode.bpel.common.InstanceFilter)5 LimitedInstanceInfoType (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.LimitedInstanceInfoType)5 ArrayList (java.util.ArrayList)3 DebuggerSupport (org.apache.ode.bpel.engine.DebuggerSupport)3 PaginatedInstanceList (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.types.PaginatedInstanceList)3 QName (javax.xml.namespace.QName)2 ActivityRecoveryDAO (org.apache.ode.bpel.dao.ActivityRecoveryDAO)2 LinkedList (java.util.LinkedList)1 AxisFault (org.apache.axis2.AxisFault)1 BpelEngineImpl (org.apache.ode.bpel.engine.BpelEngineImpl)1 BpelProcess (org.apache.ode.bpel.engine.BpelProcess)1 ProcessConf (org.apache.ode.bpel.iapi.ProcessConf)1