private static void serializeExecutors(OMElement definitions, Map<String, PriorityExecutor> executors) { for (PriorityExecutor exec : executors.values()) { PriorityExecutorSerializer.serialize(definitions, exec, XMLConfigConstants.SYNAPSE_NAMESPACE); } }
private static NextQueueAlgorithm<Runnable> createNextQueueAlgo( String className) throws AxisFault { try { Class c = Class.forName(className); Object o = c.newInstance(); if (o instanceof NextQueueAlgorithm) { return (NextQueueAlgorithm<Runnable>) o; } else { handlerException("NextQueue algorithm class, " + className + " is not type of BeforeExecuteHandler"); } } catch (ClassNotFoundException e1) { handlerException("NextQueue algorithm class, " + className + " is not found"); } catch (IllegalAccessException e1) { handlerException("NextQueue algorithm class, " + className + " cannot be accessed"); } catch (InstantiationException e1) { handlerException("NextQueue algorithm class, " + className + " cannot be instantiated"); } return null; }
private PriorityExecutor createPriorityExecutor(final OMElement definitions) throws AxisFault { assert definitions != null; OMElement executorElem = definitions.getFirstChildWithName( new QName(ExecutorConstants.PRIORITY_EXECUTOR)); if (executorElem == null) { handleException(ExecutorConstants.PRIORITY_EXECUTOR + " configuration is mandatory for priority based routing"); } PriorityExecutor executor = PriorityExecutorFactory.createExecutor( null, executorElem, false, new Properties()); executor.init(); return executor; }
Properties properties) throws AxisFault { QName queuesQName = createQname(namespace, ExecutorConstants.QUEUES); QName queueQName = createQname(namespace, ExecutorConstants.QUEUE); QName threadsQName = createQname(namespace, ExecutorConstants.THREADS); executor.setName(nameAtt.getAttributeValue()); } else if (requireName){ handlerException(ExecutorConstants.NAME + " is required for a " + ExecutorConstants.PRIORITY_EXECUTOR); if (handlerAtt != null) { BeforeExecuteHandler beh = createExecuteBeforeHandler(handlerAtt.getAttributeValue()); executor.setBeforeExecuteHandler(beh); nqa = createNextQueueAlgo(nextQueueAtt.getAttributeValue()); = createQueues(queueQName, queuesEle, isFixedSize); handlerException("Queues configuration is mandatory");
public static PriorityExecutor defineExecutor(SynapseConfiguration config, OMElement elem, Properties properties) { PriorityExecutor executor = null; try { executor = PriorityExecutorFactory.createExecutor( XMLConfigConstants.SYNAPSE_NAMESPACE, elem, true, properties); assert executor != null; config.addPriorityExecutor(executor.getName(), executor); } catch (AxisFault axisFault) { String msg = "Executor configuration cannot be built"; handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_EXECUTORS, msg, axisFault); } return executor; }
private static void serializeExecutors(OMElement definitions, Map<String, PriorityExecutor> executors) { for (PriorityExecutor exec : executors.values()) { PriorityExecutorSerializer.serialize(definitions, exec, XMLConfigConstants.SYNAPSE_NAMESPACE); } }
private static NextQueueAlgorithm<Runnable> createNextQueueAlgo( String className) throws AxisFault { try { Class c = Class.forName(className); Object o = c.newInstance(); if (o instanceof NextQueueAlgorithm) { return (NextQueueAlgorithm<Runnable>) o; } else { handlerException("NextQueue algorithm class, " + className + " is not type of BeforeExecuteHandler"); } } catch (ClassNotFoundException e1) { handlerException("NextQueue algorithm class, " + className + " is not found"); } catch (IllegalAccessException e1) { handlerException("NextQueue algorithm class, " + className + " cannot be accessed"); } catch (InstantiationException e1) { handlerException("NextQueue algorithm class, " + className + " cannot be instantiated"); } return null; }
public static PriorityExecutor defineExecutor(SynapseConfiguration config, OMElement elem, Properties properties) { PriorityExecutor executor = null; try { executor = PriorityExecutorFactory.createExecutor( XMLConfigConstants.SYNAPSE_NAMESPACE, elem, true, properties); assert executor != null; config.addPriorityExecutor(executor.getName(), executor); } catch (AxisFault axisFault) { String msg = "Executor configuration cannot be built"; handleConfigurationError(SynapseConstants.FAIL_SAFE_MODE_EXECUTORS, msg, axisFault); } return executor; }
@Override public void restoreSynapseArtifact(String artifactName) { if (log.isDebugEnabled()) { log.debug("Restoring PriorityExecutor with name : " + artifactName + " : Started"); } try { PriorityExecutor e = getSynapseConfiguration().getPriorityExecutors().get(artifactName); OMElement entryElem = PriorityExecutorSerializer.serialize(null, e, SynapseConstants.SYNAPSE_NAMESPACE); if (e.getFileName() != null) { String fileName = getServerConfigurationInformation().getSynapseXMLLocation() + File.separator + MultiXMLConfigurationBuilder.EXECUTORS_DIR + File.separator + e.getFileName(); writeToFile(entryElem, fileName); if (log.isDebugEnabled()) { log.debug("Restoring the PriorityExecutor with name : " + artifactName + " : Completed"); } log.info("PriorityExecutor named '" + artifactName + "' has been restored"); } else { handleSynapseArtifactDeploymentError("Couldn't restore the PriorityExecutor named '" + artifactName + "', filename cannot be found"); } } catch (Exception e) { handleSynapseArtifactDeploymentError( "Restoring of the PriorityExecutor named '" + artifactName + "' has failed", e); } } }
private static BeforeExecuteHandler createExecuteBeforeHandler( String className) throws AxisFault { try { Class c = Class.forName(className); Object o = c.newInstance(); if (o instanceof BeforeExecuteHandler) { return (BeforeExecuteHandler) o; } else { handlerException("Before execute handler class, " + className + " is not type of BeforeExecuteHandler"); } } catch (ClassNotFoundException e1) { handlerException("Before execute handler class, " + className + " is not found"); } catch (IllegalAccessException e1) { handlerException("Before execute handler class, " + className + " cannot be accessed"); } catch (InstantiationException e1) { handlerException("Before execute handler class, " + className + " cannot be instantiated"); } return null; }
PriorityExecutor e = PriorityExecutorFactory.createExecutor( SynapseConstants.SYNAPSE_NAMESPACE, artifactConfig, true, properties); if (e != null) {
@Override public void restoreSynapseArtifact(String artifactName) { if (log.isDebugEnabled()) { log.debug("Restoring PriorityExecutor with name : " + artifactName + " : Started"); } try { PriorityExecutor e = getSynapseConfiguration().getPriorityExecutors().get(artifactName); OMElement entryElem = PriorityExecutorSerializer.serialize(null, e, SynapseConstants.SYNAPSE_NAMESPACE); if (e.getFileName() != null) { String fileName = getServerConfigurationInformation().getSynapseXMLLocation() + File.separator + MultiXMLConfigurationBuilder.EXECUTORS_DIR + File.separator + e.getFileName(); writeToFile(entryElem, fileName); if (log.isDebugEnabled()) { log.debug("Restoring the PriorityExecutor with name : " + artifactName + " : Completed"); } log.info("PriorityExecutor named '" + artifactName + "' has been restored"); } else { handleSynapseArtifactDeploymentError("Couldn't restore the PriorityExecutor named '" + artifactName + "', filename cannot be found"); } } catch (Exception e) { handleSynapseArtifactDeploymentError( "Restoring of the PriorityExecutor named '" + artifactName + "' has failed", e); } } }
private static BeforeExecuteHandler createExecuteBeforeHandler( String className) throws AxisFault { try { Class c = Class.forName(className); Object o = c.newInstance(); if (o instanceof BeforeExecuteHandler) { return (BeforeExecuteHandler) o; } else { handlerException("Before execute handler class, " + className + " is not type of BeforeExecuteHandler"); } } catch (ClassNotFoundException e1) { handlerException("Before execute handler class, " + className + " is not found"); } catch (IllegalAccessException e1) { handlerException("Before execute handler class, " + className + " cannot be accessed"); } catch (InstantiationException e1) { handlerException("Before execute handler class, " + className + " cannot be instantiated"); } return null; }
PriorityExecutor e = PriorityExecutorFactory.createExecutor( SynapseConstants.SYNAPSE_NAMESPACE, artifactConfig, true, properties); if (e != null) {
public OMElement serializeExecutor(PriorityExecutor source, SynapseConfiguration synapseConfig, OMElement parent) throws Exception { File executorDir = createDirectory(currentDirectory, MultiXMLConfigurationBuilder.EXECUTORS_DIR); OMElement eventDirElem = PriorityExecutorSerializer.serialize(null, source, SynapseConstants.SYNAPSE_NAMESPACE); File entriesDir = createDirectory(currentDirectory, MultiXMLConfigurationBuilder.EXECUTORS_DIR); String fileName = source.getFileName(); if (source.getFileName() != null) { if (currentDirectory == rootDirectory) { handleDeployment(entriesDir, fileName, source.getName(), synapseConfig.getArtifactDeploymentStore()); } File eventSrcFile = new File(executorDir, source.getFileName()); writeToFile(eventDirElem, eventSrcFile); } else if (parent != null) { parent.addChild(eventDirElem); } return eventDirElem; }
p = Integer.parseInt(priority); } else { handlerException("Priority must be specified"); isFixedSize = true; } else if (isFixedSize) { handlerException("Queues should have a " + ExecutorConstants.SIZE);
PriorityExecutor e = PriorityExecutorFactory.createExecutor( SynapseConstants.SYNAPSE_NAMESPACE, artifactConfig, true, properties); if (e == null) {
public OMElement serializeExecutor(PriorityExecutor source, SynapseConfiguration synapseConfig, OMElement parent) throws Exception { File executorDir = createDirectory(currentDirectory, MultiXMLConfigurationBuilder.EXECUTORS_DIR); OMElement eventDirElem = PriorityExecutorSerializer.serialize(null, source, SynapseConstants.SYNAPSE_NAMESPACE); File entriesDir = createDirectory(currentDirectory, MultiXMLConfigurationBuilder.EXECUTORS_DIR); String fileName = source.getFileName(); if (source.getFileName() != null) { if (currentDirectory == rootDirectory) { handleDeployment(entriesDir, fileName, source.getName(), synapseConfig.getArtifactDeploymentStore()); } File eventSrcFile = new File(executorDir, source.getFileName()); writeToFile(eventDirElem, eventSrcFile); } else if (parent != null) { parent.addChild(eventDirElem); } return eventDirElem; }
p = Integer.parseInt(priority); } else { handlerException("Priority must be specified"); isFixedSize = true; } else if (isFixedSize) { handlerException("Queues should have a " + ExecutorConstants.SIZE);
PriorityExecutor e = PriorityExecutorFactory.createExecutor( SynapseConstants.SYNAPSE_NAMESPACE, artifactConfig, true, properties); if (e == null) {