Example usage for javax.xml.namespace QName toString

List of usage examples for javax.xml.namespace QName toString

Introduction

In this page you can find the example usage for javax.xml.namespace QName toString.

Prototype

public String toString() 

Source Link

Document

<p><code>String</code> representation of this <code>QName</code>.</p> <p>The commonly accepted way of representing a <code>QName</code> as a <code>String</code> was <a href="http://jclark.com/xml/xmlns.htm">defined</a> by James Clark.

Usage

From source file:org.wso2.carbon.bpel.core.ode.integration.BPELBindingContextImpl.java

private BPELProcessProxy publishAxisService(ProcessConf processConfiguration, QName serviceName,
        String portName) throws AxisFault {
    // TODO: Need to fix this to suite multi-tenant environment
    // TODO: There is a problem in this, in this manner we can't have two axis services with
    // same QName
    BPELProcessProxy processProxy = new BPELProcessProxy(processConfiguration, bpelServer, serviceName,
            portName);/* w w  w .ja v  a2  s.c  om*/
    ConfigurationContext tenantConfigCtx = getConfigurationContextFromProcessConfiguration(
            processConfiguration);

    AxisService axisService;
    try {
        axisService = AxisServiceUtils.createAxisService(tenantConfigCtx.getAxisConfiguration(), processProxy);

        EndpointConfiguration endpointConfig = ((ProcessConfigurationImpl) processConfiguration)
                .getEndpointConfiguration(new WSDL11Endpoint(serviceName, portName));

        ServiceConfigurationUtil.configureService(axisService, endpointConfig, tenantConfigCtx);

    } catch (AxisFault e) {
        log.error("Error occurred creating the axis service " + serviceName.toString());
        throw new DeploymentException("BPEL Package deployment failed.", e);
    }

    processProxy.setAxisService(axisService);
    removeBPELProcessProxyAndAxisService(processConfiguration.getDeployer(), serviceName, portName);
    services.put(processConfiguration.getDeployer(), serviceName, portName, processProxy);

    ArrayList<AxisService> serviceList = new ArrayList<AxisService>();
    serviceList.add(axisService);
    DeploymentEngine.addServiceGroup(createServiceGroupForService(axisService), serviceList, null, null,
            tenantConfigCtx.getAxisConfiguration());
    //
    if (log.isDebugEnabled()) {
        log.debug("BPELProcessProxy created for process " + processConfiguration.getProcessId());
        log.debug("AxisService " + serviceName + " created for BPEL process "
                + processConfiguration.getProcessId());
    }

    return processProxy;
}

From source file:org.wso2.carbon.bpel.core.ode.integration.BPELBindingContextImpl.java

private void removeBPELProcessProxyAndAxisService(String processDeployer, QName serviceName, String portName) {

    if (log.isDebugEnabled()) {
        log.debug("Removing service " + serviceName.toString() + " port " + portName);
    }//  ww w .  j  av a2s. com
    BPELProcessProxy processProxy = (BPELProcessProxy) services.remove(processDeployer, serviceName, portName);
    if (processProxy != null) {
        try {
            String axisServiceName = processProxy.getAxisService().getName();
            AxisConfiguration axisConfig = processProxy.getAxisService().getAxisConfiguration();
            ///////////////////////////////////////////////////////////////////////////////////////////////////////
            // There is a issue in this code due to tenant unloading and loading. When we unload a tenant we don't
            // undeploy the process. So BPELBindingContextImpl#deactivateMyRoleEndpoint will not get invoked and
            // BPELProcessProxy instance will be there in the BPELBindingContextImpl#services map. So at the
            // time we load the tenant again, axisService returned from axisConfig will be null even though we
            // have a BPELProcessProxy instance in service map. This is because teant unloading logic cleans the
            // axis configuration. So if the axisService is null, we ignore the other steps after this.
            ///////////////////////////////////////////////////////////////////////////////////////////////////////
            AxisService axisService = axisConfig.getService(axisServiceName);
            if (axisService != null) {
                // first, de-allocate its schemas
                axisService.releaseSchemaList();
                // then, de-allocate its parameters
                // the service's wsdl object model is stored as one of its parameters!
                // can't stress strongly enough how important it is to clean this up.
                //                ArrayList<Parameter> parameters = (ArrayList<Parameter>) axisService.getParameters();
                //                for (Parameter parameter : parameters) {
                //                    if (!parameter.getName().equals(CarbonConstants.PRESERVE_SERVICE_HISTORY_PARAM) &&
                // !BPELProcessStoreImpl.isUndeploying) {
                //                        axisService.removeParameter(parameter);
                //                    }
                //                }
                //
                //                if (RegistryBasedProcessStoreImpl.isUndeploying) {
                //                    BPSServerImpl.getAxisConfig().getServiceGroup(axisServiceName).removeParameter(
                //                            new Parameter(CarbonConstants.PRESERVE_SERVICE_HISTORY_PARAM, "true"));
                //                }
                //
                //                if (RegistryBasedProcessStoreImpl.isUpdatingBPELPackage) {
                //                    axisService.addParameter(new Parameter(CarbonConstants.PRESERVE_SERVICE_HISTORY_PARAM, "true"));
                //                    axisService.getAxisServiceGroup().addParameter(new Parameter(CarbonConstants
                // .PRESERVE_SERVICE_HISTORY_PARAM, "true"));
                //                }
                // now, stop the service
                axisConfig.stopService(axisServiceName);
                // calling removeServiceGroup() is workaround to AXIS2-4314.
                //  It happens that Axis2 creates one group per service you add with AxisConfiguration.addService().
                // See this.createService()
                // Once this issue is fixed (hopully in Axis2-1.5), we can use removeService() again.
                axisConfig.removeServiceGroup(axisServiceName);
                // This must not done. This will cause axis configuration to cleanup deployment schedular
                // and it'll throw exception when it tries to reschedule deployer after undeplying.
                //_server._axisConfig.cleanup();
            }
        } catch (AxisFault axisFault) {
            log.error("Couldn't remove service " + serviceName);
        }
    } else {
        if (log.isDebugEnabled()) {
            log.debug("Couldn't find service " + serviceName + " port " + portName + " to remove.");
        }
    }
}

From source file:org.wso2.carbon.bpel.core.ode.integration.jmx.Instance.java

private String getTenantsProcessList(Set<QName> processIds) {
    StringBuilder tenantsProcessList = new StringBuilder();
    tenantsProcessList.append(" ");
    tenantsProcessList.append("pid=");
    for (QName pid : processIds) {
        tenantsProcessList.append(pid.toString());
        tenantsProcessList.append("|");
    }/*from   w  ww.j a v a2  s.  co  m*/
    tenantsProcessList.append(" ");
    return tenantsProcessList.toString();
}

From source file:org.wso2.carbon.bpel.core.ode.integration.mgt.services.InstanceManagementServiceSkeleton.java

private boolean isSecureFilter(InstanceFilter filter, Set<QName> processIds) {
    List<String> pids = filter.getPidFilter();
    Set<String> strPids = new HashSet<String>();

    if (pids != null) {

        for (QName pidQName : processIds) {
            strPids.add(pidQName.toString());
        }/*www. j a  v  a  2 s.c o  m*/

        for (String pid : pids) {
            if (!strPids.contains(pid)) {
                return false;
            }
        }

    }
    return true;
}

From source file:org.wso2.carbon.bpel.core.ode.integration.mgt.services.ProcessManagementServiceSkeleton.java

public java.lang.String[] getAllProcesses(String getAllProcesses) throws ProcessManagementException {
    TenantProcessStoreImpl tenantProcessStore = AdminServiceUtils.getTenantProcessStore();
    Set<QName> processIds = tenantProcessStore.getProcessConfigMap().keySet();
    List<String> pids = new ArrayList<String>();
    for (QName pid : processIds) {
        pids.add(pid.toString());
    }/*from  www  .  j  a  v a  2  s  .c o m*/

    return pids.toArray(new String[pids.size()]);
}

From source file:org.wso2.carbon.bpel.core.ode.integration.store.Utils.java

public static void deleteInstances(Collection<QName> processes) {
    if (processes != null) {
        String filter = null;//from  w  w  w  . j  a v  a  2s .  c o  m
        for (QName q : processes) {
            if (filter == null) {
                filter = "pid=" + q.toString();
            } else {
                filter += "|" + q.toString();
            }
        }
        List<Long> iids = delete(filter);
        logIids(processes, iids);
    } else {
        //This very much unlikely to happen. How to handle this situation?
        log.warn("No processes found to delete instances");
    }
}

From source file:org.wso2.carbon.bpel.core.ode.integration.store.Utils.java

/**
 * Return the instances in the given processes list
 *
 * @param processesInPackage//w ww  . j  av a 2  s .com
 * @return Instance count
 * @throws ManagementException
 */
public static long getInstanceCountForProcess(List<QName> processesInPackage) throws ManagementException {
    if (processesInPackage != null) {
        String filter = null;
        for (QName q : processesInPackage) {
            if (filter == null) {
                filter = "pid=" + q.toString();
            } else {
                filter += "|" + q.toString();
            }
        }
        try {
            final InstanceFilter instanceFilter = new InstanceFilter(filter);
            long count = (long) dbexec(new BpelDatabase.Callable<Object>() {

                public Object run(BpelDAOConnection conn) {
                    return conn.instanceCount(instanceFilter);
                }
            });
            return count;
        } catch (Exception e) {
            String errMsg = "Exception during instance count for deletion. Filter: " + filter;
            throw new ManagementException(errMsg, e);
        }

    } else {
        return 0;
    }
}

From source file:org.wso2.carbon.governance.soap.viewer.WSDLVisualizer.java

/**
 * This method adds the target namespace if the QName of an element does not have a namespace.
 *
 * @param targetNamespace Target namespace of the schema.
 * @param queueName       QName of an element.
 * @return Element type with the namespace.
 *///  w ww  .ja  v a  2 s .com
private String getTypeWithNamespace(String targetNamespace, QName queueName) {
    String typeName;
    if (queueName.getNamespaceURI().equals("")) {
        typeName = "{" + targetNamespace + "}" + queueName.toString();
    } else {
        typeName = queueName.toString();
    }
    return typeName;
}

From source file:org.wso2.carbon.humantask.core.dao.jpa.openjpa.model.Task.java

public Task(QName name, TaskType type, Integer tenantId) {
    this.createdOn = new Date();
    this.status = TaskStatus.UNDEFINED;
    this.name = name.toString();
    this.type = type;
    this.tenantId = tenantId;
}

From source file:org.wso2.carbon.humantask.core.dao.jpa.openjpa.model.Task.java

public void setDefinitionName(QName name) {
    this.taskDefinitionName = name.toString();
}