use of org.wso2.carbon.bpel.core.ode.integration.jmx.Instance in project carbon-apimgt by wso2.
the class ServiceReferenceHolderTestCase method testGetEnvironmentConfigurations.
@Test
public void testGetEnvironmentConfigurations() {
ServiceReferenceHolder instance = ServiceReferenceHolder.getInstance();
// //Happy Path
ConfigProvider configProvider = Mockito.mock(ConfigProvider.class);
instance.setConfigProvider(configProvider);
APIMUIConfigurations apimUIConfigurations = instance.getApimUIConfigurations();
Assert.assertNotNull(apimUIConfigurations);
// //ConfigProvider is null
instance.setConfigProvider(null);
apimUIConfigurations = instance.getApimUIConfigurations();
Assert.assertNotNull(apimUIConfigurations);
// //CarbonConfigurationException when reading configs
configProvider = new ConfigProvider() {
@Override
public <T> T getConfigurationObject(Class<T> configClass) throws ConfigurationException {
throw new ConfigurationException("Error while creating configuration instance");
}
@Override
public Object getConfigurationObject(String namespace) throws ConfigurationException {
throw new ConfigurationException("Error while creating configuration instance");
}
public <T> T getConfigurationObject(String s, Class<T> aClass) throws ConfigurationException {
return null;
}
};
instance.setConfigProvider(configProvider);
apimUIConfigurations = instance.getApimUIConfigurations();
Assert.assertNotNull(apimUIConfigurations);
}
use of org.wso2.carbon.bpel.core.ode.integration.jmx.Instance in project wso2-synapse by wso2.
the class DataSourceInformationFactory method createDataSourceInformation.
/**
* Factory method to create a DataSourceInformation instance based on given properties
*
* @param dsName DataSource Name
* @param properties Properties to create and configure DataSource
* @return DataSourceInformation instance
*/
public static DataSourceInformation createDataSourceInformation(String dsName, Properties properties) {
if (dsName == null || "".equals(dsName)) {
if (log.isDebugEnabled()) {
log.debug("DataSource name is either empty or null, ignoring..");
}
return null;
}
StringBuffer buffer = new StringBuffer();
buffer.append(DataSourceConstants.PROP_SYNAPSE_PREFIX_DS);
buffer.append(DataSourceConstants.DOT_STRING);
buffer.append(dsName);
buffer.append(DataSourceConstants.DOT_STRING);
// Prefix for getting particular data source's properties
String prefix = buffer.toString();
String driver = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_DRIVER_CLS_NAME, null);
if (driver == null) {
handleException(prefix + DataSourceConstants.PROP_DRIVER_CLS_NAME + " cannot be found.");
}
String url = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_URL, null);
if (url == null) {
handleException(prefix + DataSourceConstants.PROP_URL + " cannot be found.");
}
DataSourceInformation datasourceInformation = new DataSourceInformation();
datasourceInformation.setAlias(dsName);
datasourceInformation.setDriver(driver);
datasourceInformation.setUrl(url);
String dataSourceName = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_DS_NAME, dsName, String.class);
datasourceInformation.setDatasourceName(dataSourceName);
String dsType = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_TYPE, DataSourceConstants.PROP_BASIC_DATA_SOURCE, String.class);
datasourceInformation.setType(dsType);
String repositoryType = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_REGISTRY, DataSourceConstants.PROP_REGISTRY_MEMORY, String.class);
datasourceInformation.setRepositoryType(repositoryType);
Integer maxActive = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_MAX_ACTIVE, GenericObjectPool.DEFAULT_MAX_ACTIVE, Integer.class);
datasourceInformation.setMaxActive(maxActive);
Integer maxIdle = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_MAX_IDLE, GenericObjectPool.DEFAULT_MAX_IDLE, Integer.class);
datasourceInformation.setMaxIdle(maxIdle);
Long maxWait = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_MAX_WAIT, GenericObjectPool.DEFAULT_MAX_WAIT, Long.class);
datasourceInformation.setMaxWait(maxWait);
// Construct DriverAdapterCPDS reference
String suffix = DataSourceConstants.PROP_CPDS_ADAPTER + DataSourceConstants.DOT_STRING + DataSourceConstants.PROP_CLASS_NAME;
String className = MiscellaneousUtil.getProperty(properties, prefix + suffix, DataSourceConstants.PROP_CPDS_ADAPTER_DRIVER);
datasourceInformation.addParameter(suffix, className);
suffix = DataSourceConstants.PROP_CPDS_ADAPTER + DataSourceConstants.DOT_STRING + DataSourceConstants.PROP_FACTORY;
String factory = MiscellaneousUtil.getProperty(properties, prefix + suffix, DataSourceConstants.PROP_CPDS_ADAPTER_DRIVER);
datasourceInformation.addParameter(suffix, factory);
suffix = DataSourceConstants.PROP_CPDS_ADAPTER + DataSourceConstants.DOT_STRING + DataSourceConstants.PROP_NAME;
String name = MiscellaneousUtil.getProperty(properties, prefix + suffix, "cpds");
datasourceInformation.addParameter(suffix, name);
boolean defaultAutoCommit = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_DEFAULT_AUTO_COMMIT, true, Boolean.class);
boolean defaultReadOnly = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_DEFAULT_READ_ONLY, false, Boolean.class);
boolean testOnBorrow = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_TEST_ON_BORROW, true, Boolean.class);
boolean testOnReturn = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_TEST_ON_RETURN, false, Boolean.class);
long timeBetweenEvictionRunsMillis = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_TIME_BETWEEN_EVICTION_RUNS_MILLIS, GenericObjectPool.DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS, Long.class);
int numTestsPerEvictionRun = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_NUM_TESTS_PER_EVICTION_RUN, GenericObjectPool.DEFAULT_NUM_TESTS_PER_EVICTION_RUN, Integer.class);
long minEvictableIdleTimeMillis = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_MIN_EVICTABLE_IDLE_TIME_MILLIS, GenericObjectPool.DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS, Long.class);
boolean testWhileIdle = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_TEST_WHILE_IDLE, false, Boolean.class);
String validationQuery = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_VALIDATION_QUERY, null);
int minIdle = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_MIN_IDLE, GenericObjectPool.DEFAULT_MIN_IDLE, Integer.class);
int initialSize = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_INITIAL_SIZE, 0, Integer.class);
int defaultTransactionIsolation = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_DEFAULT_TRANSACTION_ISOLATION, -1, Integer.class);
String defaultCatalog = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_DEFAULT_CATALOG, null);
boolean accessToUnderlyingConnectionAllowed = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_ACCESS_TO_UNDERLYING_CONNECTION_ALLOWED, false, Boolean.class);
boolean removeAbandoned = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_REMOVE_ABANDONED, false, Boolean.class);
int removeAbandonedTimeout = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_REMOVE_ABANDONED_TIMEOUT, 300, Integer.class);
boolean logAbandoned = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_LOG_ABANDONED, false, Boolean.class);
boolean poolPreparedStatements = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_POOL_PREPARED_STATEMENTS, false, Boolean.class);
int maxOpenPreparedStatements = MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_MAX_OPEN_PREPARED_STATEMENTS, GenericKeyedObjectPool.DEFAULT_MAX_TOTAL, Integer.class);
datasourceInformation.setDefaultAutoCommit(defaultAutoCommit);
datasourceInformation.setDefaultReadOnly(defaultReadOnly);
datasourceInformation.setTestOnBorrow(testOnBorrow);
datasourceInformation.setTestOnReturn(testOnReturn);
datasourceInformation.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
datasourceInformation.setNumTestsPerEvictionRun(numTestsPerEvictionRun);
datasourceInformation.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
datasourceInformation.setTestWhileIdle(testWhileIdle);
datasourceInformation.setMinIdle(minIdle);
datasourceInformation.setDefaultTransactionIsolation(defaultTransactionIsolation);
datasourceInformation.setAccessToUnderlyingConnectionAllowed(accessToUnderlyingConnectionAllowed);
datasourceInformation.setRemoveAbandoned(removeAbandoned);
datasourceInformation.setRemoveAbandonedTimeout(removeAbandonedTimeout);
datasourceInformation.setLogAbandoned(logAbandoned);
datasourceInformation.setPoolPreparedStatements(poolPreparedStatements);
datasourceInformation.setMaxOpenPreparedStatements(maxOpenPreparedStatements);
datasourceInformation.setInitialSize(initialSize);
if (validationQuery != null && !"".equals(validationQuery)) {
datasourceInformation.setValidationQuery(validationQuery);
}
if (defaultCatalog != null && !"".equals(defaultCatalog)) {
datasourceInformation.setDefaultCatalog(defaultCatalog);
}
datasourceInformation.addProperty(prefix + DataSourceConstants.PROP_IC_FACTORY, MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_IC_FACTORY, null));
// Provider URL
datasourceInformation.addProperty(prefix + DataSourceConstants.PROP_PROVIDER_URL, MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_PROVIDER_URL, null));
datasourceInformation.addProperty(prefix + DataSourceConstants.PROP_PROVIDER_PORT, MiscellaneousUtil.getProperty(properties, prefix + DataSourceConstants.PROP_PROVIDER_PORT, null));
String passwordPrompt = MiscellaneousUtil.getProperty(properties, prefix + SecurityConstants.PROP_PASSWORD_PROMPT, "Password for datasource " + dsName, String.class);
SecretInformation secretInformation = SecretInformationFactory.createSecretInformation(properties, prefix, passwordPrompt);
secretInformation.setToken(dsName + "." + SecurityConstants.PROP_PASSWORD);
datasourceInformation.setSecretInformation(secretInformation);
return datasourceInformation;
}
use of org.wso2.carbon.bpel.core.ode.integration.jmx.Instance in project wso2-synapse by wso2.
the class DataSourceInformationRepository method addDataSourceInformation.
/**
* Adding a DataSourceInformation instance
*
* @param dataSourceInformation <code>DataSourceInformation</code> instance
*/
public void addDataSourceInformation(DataSourceInformation dataSourceInformation) {
if (dataSourceInformation == null) {
throw new SynapseCommonsException("DataSource information is null", log);
}
// Sets the global secret resolver
SecretInformation secretInformation = dataSourceInformation.getSecretInformation();
if (secretInformation != null) {
secretInformation.setGlobalSecretResolver(secretResolver);
}
dataSourceInformationMap.put(dataSourceInformation.getAlias(), dataSourceInformation);
if (assertListerNotNull()) {
listener.addDataSourceInformation(dataSourceInformation);
}
}
use of org.wso2.carbon.bpel.core.ode.integration.jmx.Instance in project wso2-synapse by wso2.
the class VFSTransportListener method scanFileOrDirectory.
/**
* Search for files that match the given regex pattern and create a list
* Then process each of these files and update the status of the scan on
* the poll table
* @param entry the poll table entry for the scan
* @param fileURI the file or directory to be scanned
*/
private void scanFileOrDirectory(final PollTableEntry entry, String fileURI) {
if (log.isDebugEnabled()) {
log.debug("Polling: " + VFSUtils.maskURLPassword(fileURI));
}
if (entry.isClusterAware()) {
boolean leader = true;
ClusteringAgent agent = getConfigurationContext().getAxisConfiguration().getClusteringAgent();
if (agent != null && agent.getParameter("domain") != null) {
// hazelcast clustering instance name
String hazelcastInstanceName = agent.getParameter("domain").getValue() + ".instance";
HazelcastInstance instance = Hazelcast.getHazelcastInstanceByName(hazelcastInstanceName);
if (instance != null) {
// dirty leader election
leader = instance.getCluster().getMembers().iterator().next().localMember();
} else {
log.warn("Clustering error, running the polling task in this node");
}
} else {
log.warn("Although proxy is cluster aware, clustering config are not present, hence running the" + " the polling task in this node");
}
if (!leader) {
if (log.isDebugEnabled()) {
log.debug("This Member is not the leader");
}
entry.setLastPollState(PollTableEntry.NONE);
long now = System.currentTimeMillis();
entry.setLastPollTime(now);
entry.setNextPollTime(now + entry.getPollInterval());
onPollCompletion(entry);
return;
}
if (log.isDebugEnabled()) {
log.debug("This Member is the leader");
}
}
FileSystemOptions fso = null;
setFileSystemClosed(false);
try {
fso = VFSUtils.attachFileSystemOptions(entry.getVfsSchemeProperties(), fsManager);
} catch (Exception e) {
log.error("Error while attaching VFS file system properties. " + e.getMessage());
}
FileObject fileObject = null;
// TODO : Trying to make the correct URL out of the malformed one.
if (fileURI.contains("vfs:")) {
fileURI = fileURI.substring(fileURI.indexOf("vfs:") + 4);
}
if (log.isDebugEnabled()) {
log.debug("Scanning directory or file : " + VFSUtils.maskURLPassword(fileURI));
}
boolean wasError = true;
int retryCount = 0;
int maxRetryCount = entry.getMaxRetryCount();
long reconnectionTimeout = entry.getReconnectTimeout();
while (wasError) {
try {
retryCount++;
fileObject = fsManager.resolveFile(fileURI, fso);
if (fileObject == null) {
log.error("fileObject is null");
throw new FileSystemException("fileObject is null");
}
wasError = false;
} catch (FileSystemException e) {
if (retryCount >= maxRetryCount) {
processFailure("Repeatedly failed to resolve the file URI: " + VFSUtils.maskURLPassword(fileURI), e, entry);
closeFileSystem(fileObject);
return;
} else {
log.warn("Failed to resolve the file URI: " + VFSUtils.maskURLPassword(fileURI) + ", in attempt " + retryCount + ", " + e.getMessage() + " Retrying in " + reconnectionTimeout + " milliseconds.");
}
}
if (wasError) {
try {
Thread.sleep(reconnectionTimeout);
} catch (InterruptedException e2) {
log.error("Thread was interrupted while waiting to reconnect.", e2);
}
}
}
try {
if (fileObject.exists() && fileObject.isReadable()) {
entry.setLastPollState(PollTableEntry.NONE);
FileObject[] children = null;
try {
children = fileObject.getChildren();
} catch (FileNotFolderException ignored) {
} catch (FileSystemException ex) {
log.error(ex.getMessage(), ex);
}
// if this is a file that would translate to a single message
if (children == null || children.length == 0) {
boolean isFailedRecord = false;
if (entry.getMoveAfterMoveFailure() != null) {
isFailedRecord = isFailedRecord(fileObject, entry);
}
if (fileObject.getType() == FileType.FILE && !isFailedRecord) {
boolean runPostProcess = true;
if (!entry.isFileLockingEnabled() || (entry.isFileLockingEnabled() && acquireLock(fsManager, fileObject, entry, fso, true))) {
try {
if (fileObject.getType() == FileType.FILE) {
processFile(entry, fileObject);
entry.setLastPollState(PollTableEntry.SUCCSESSFUL);
metrics.incrementMessagesReceived();
} else {
runPostProcess = false;
}
} catch (AxisFault e) {
if (e.getCause() instanceof FileNotFoundException) {
log.warn("Error processing File URI : " + VFSUtils.maskURLPassword(fileObject.getName().toString()) + ". This can be due to file moved from another process.");
runPostProcess = false;
} else {
logException("Error processing File URI : " + VFSUtils.maskURLPassword(fileObject.getName().getURI()), e);
entry.setLastPollState(PollTableEntry.FAILED);
metrics.incrementFaultsReceiving();
}
}
if (runPostProcess) {
try {
moveOrDeleteAfterProcessing(entry, fileObject, fso);
} catch (AxisFault axisFault) {
logException("File object '" + VFSUtils.maskURLPassword(fileObject.getURL().toString()) + "' " + "cloud not be moved", axisFault);
entry.setLastPollState(PollTableEntry.FAILED);
String timeStamp = VFSUtils.getSystemTime(entry.getFailedRecordTimestampFormat());
addFailedRecord(entry, fileObject, timeStamp);
}
}
if (entry.isFileLockingEnabled()) {
VFSUtils.releaseLock(fsManager, fileObject, fso);
if (log.isDebugEnabled()) {
log.debug("Removed the lock file '" + VFSUtils.maskURLPassword(fileObject.toString()) + ".lock' of the file '" + VFSUtils.maskURLPassword(fileObject.toString()));
}
}
} else if (log.isDebugEnabled()) {
log.debug("Couldn't get the lock for processing the file : " + VFSUtils.maskURLPassword(fileObject.getName().getURI()));
} else if (isFailedRecord) {
if (entry.isFileLockingEnabled()) {
VFSUtils.releaseLock(fsManager, fileObject, fso);
}
// schedule a cleanup task if the file is there
if (fsManager.resolveFile(fileObject.getURL().toString(), fso) != null && removeTaskState == STATE_STOPPED && entry.getMoveAfterMoveFailure() != null) {
workerPool.execute(new FileRemoveTask(entry, fileObject, fso));
}
if (log.isDebugEnabled()) {
log.debug("File '" + VFSUtils.maskURLPassword(fileObject.getURL().toString()) + "' has been marked as a failed" + " record, it will not process");
}
}
}
} else {
int failCount = 0;
int successCount = 0;
int processCount = 0;
Integer iFileProcessingInterval = entry.getFileProcessingInterval();
Integer iFileProcessingCount = entry.getFileProcessingCount();
if (log.isDebugEnabled()) {
log.debug("File name pattern : " + entry.getFileNamePattern());
}
// Sort the files
String strSortParam = entry.getFileSortParam();
if (strSortParam != null) {
log.debug("Start Sorting the files.");
boolean bSortOrderAsscending = entry.isFileSortAscending();
if (log.isDebugEnabled()) {
log.debug("Sorting the files by : " + strSortParam + ". (" + bSortOrderAsscending + ")");
}
if (strSortParam.equals(VFSConstants.FILE_SORT_VALUE_NAME) && bSortOrderAsscending) {
Arrays.sort(children, new FileNameAscComparator());
} else if (strSortParam.equals(VFSConstants.FILE_SORT_VALUE_NAME) && !bSortOrderAsscending) {
Arrays.sort(children, new FileNameDesComparator());
} else if (strSortParam.equals(VFSConstants.FILE_SORT_VALUE_SIZE) && bSortOrderAsscending) {
Arrays.sort(children, new FileSizeAscComparator());
} else if (strSortParam.equals(VFSConstants.FILE_SORT_VALUE_SIZE) && !bSortOrderAsscending) {
Arrays.sort(children, new FileSizeDesComparator());
} else if (strSortParam.equals(VFSConstants.FILE_SORT_VALUE_LASTMODIFIEDTIMESTAMP) && bSortOrderAsscending) {
Arrays.sort(children, new FileLastmodifiedtimestampAscComparator());
} else if (strSortParam.equals(VFSConstants.FILE_SORT_VALUE_LASTMODIFIEDTIMESTAMP) && !bSortOrderAsscending) {
Arrays.sort(children, new FileLastmodifiedtimestampDesComparator());
}
log.debug("End Sorting the files.");
}
for (FileObject child : children) {
// Stop processing when service get undeployed
if (state != BaseConstants.STARTED || !entry.getService().isActive()) {
return;
}
/**
* Before starting to process another file, see whether the proxy is stopped or not.
*/
if (entry.isCanceled()) {
break;
}
// skipping *.lock file
if (child.getName().getBaseName().endsWith(".lock")) {
continue;
}
// skipping subfolders
if (child.getType() != FileType.FILE) {
continue;
}
// skipping files depending on size limitation
if (entry.getFileSizeLimit() >= 0 && child.getContent().getSize() > entry.getFileSizeLimit()) {
if (log.isDebugEnabled()) {
log.debug("Ignoring file - " + child.getName().getBaseName() + " size - " + child.getContent().getSize() + " since it exceeds file size limit - " + entry.getFileSizeLimit());
}
continue;
}
boolean isFailedRecord = false;
if (entry.getMoveAfterMoveFailure() != null) {
isFailedRecord = isFailedRecord(child, entry);
}
if (entry.getFileNamePattern() != null && child.getName().getBaseName().matches(entry.getFileNamePattern())) {
// now we try to get the lock and process
if (log.isDebugEnabled()) {
log.debug("Matching file : " + child.getName().getBaseName());
}
boolean runPostProcess = true;
if ((!entry.isFileLockingEnabled() || (entry.isFileLockingEnabled() && VFSUtils.acquireLock(fsManager, child, fso, true))) && !isFailedRecord) {
// process the file
try {
if (log.isDebugEnabled()) {
log.debug("Processing file :" + VFSUtils.maskURLPassword(child.toString()));
}
processCount++;
if (child.getType() == FileType.FILE) {
processFile(entry, child);
successCount++;
// tell moveOrDeleteAfterProcessing() file was success
entry.setLastPollState(PollTableEntry.SUCCSESSFUL);
metrics.incrementMessagesReceived();
} else {
runPostProcess = false;
}
} catch (Exception e) {
if (e.getCause() instanceof FileNotFoundException) {
log.warn("Error processing File URI : " + VFSUtils.maskURLPassword(child.getName().toString()) + ". This can be due to file moved from another process.");
runPostProcess = false;
} else {
logException("Error processing File URI : " + VFSUtils.maskURLPassword(child.getName().getURI()), e);
failCount++;
// tell moveOrDeleteAfterProcessing() file failed
entry.setLastPollState(PollTableEntry.FAILED);
metrics.incrementFaultsReceiving();
}
}
// skipping un-locking file if failed to do delete/move after process
boolean skipUnlock = false;
if (runPostProcess) {
try {
moveOrDeleteAfterProcessing(entry, child, fso);
} catch (AxisFault axisFault) {
logException("File object '" + VFSUtils.maskURLPassword(child.getURL().toString()) + "'cloud not be moved, will remain in \"locked\" state", axisFault);
skipUnlock = true;
failCount++;
entry.setLastPollState(PollTableEntry.FAILED);
String timeStamp = VFSUtils.getSystemTime(entry.getFailedRecordTimestampFormat());
addFailedRecord(entry, child, timeStamp);
}
}
// if there is a failure or not we'll try to release the lock
if (entry.isFileLockingEnabled() && !skipUnlock) {
VFSUtils.releaseLock(fsManager, child, fso);
}
}
} else if (entry.getFileNamePattern() != null && !child.getName().getBaseName().matches(entry.getFileNamePattern())) {
// child's file name does not match the file name pattern
if (log.isDebugEnabled()) {
log.debug("Non-Matching file : " + child.getName().getBaseName());
}
} else if (isFailedRecord) {
// it is a failed record
if (entry.isFileLockingEnabled()) {
VFSUtils.releaseLock(fsManager, child, fso);
VFSUtils.releaseLock(fsManager, fileObject, fso);
}
if (fsManager.resolveFile(child.getURL().toString(), fso) != null && removeTaskState == STATE_STOPPED && entry.getMoveAfterMoveFailure() != null) {
workerPool.execute(new FileRemoveTask(entry, child, fso));
}
if (log.isDebugEnabled()) {
log.debug("File '" + VFSUtils.maskURLPassword(fileObject.getURL().toString()) + "' has been marked as a failed record, it will not " + "process");
}
}
if (iFileProcessingInterval != null && iFileProcessingInterval > 0) {
try {
if (log.isDebugEnabled()) {
log.debug("Put the VFS processor to sleep for : " + iFileProcessingInterval);
}
Thread.sleep(iFileProcessingInterval);
} catch (InterruptedException ie) {
log.error("Unable to set the interval between file processors." + ie);
}
} else if (iFileProcessingCount != null && iFileProcessingCount <= processCount) {
break;
}
}
if (failCount == 0 && successCount > 0) {
entry.setLastPollState(PollTableEntry.SUCCSESSFUL);
} else if (successCount == 0 && failCount > 0) {
entry.setLastPollState(PollTableEntry.FAILED);
} else {
entry.setLastPollState(PollTableEntry.WITH_ERRORS);
}
}
// processing of this poll table entry is complete
long now = System.currentTimeMillis();
entry.setLastPollTime(now);
entry.setNextPollTime(now + entry.getPollInterval());
} else if (log.isDebugEnabled()) {
log.debug("Unable to access or read file or directory : " + VFSUtils.maskURLPassword(fileURI) + "." + " Reason: " + (fileObject.exists() ? (fileObject.isReadable() ? "Unknown reason" : "The file can not be read!") : "The file does not exists!"));
}
onPollCompletion(entry);
} catch (FileSystemException e) {
processFailure("Error checking for existence and readability : " + VFSUtils.maskURLPassword(fileURI), e, entry);
} catch (Exception ex) {
processFailure("Un-handled exception thrown when processing the file : ", ex, entry);
} finally {
closeFileSystem(fileObject);
}
}
use of org.wso2.carbon.bpel.core.ode.integration.jmx.Instance in project wso2-synapse by wso2.
the class Axis2SynapseController method initSharedSecretCallbackHandlerCache.
/**
* Initiating SharedSecretCallbackHandlerCache reusing an existing SecretCallbackHandler instance -
* a SecretCallbackHandler passed when start synapse.
*
* @param information ServerContextInformation instance
*/
private void initSharedSecretCallbackHandlerCache(ServerContextInformation information) {
SharedSecretCallbackHandlerCache cache = SharedSecretCallbackHandlerCache.getInstance();
Object handler = information.getProperty(SecurityConstants.PROP_SECRET_CALLBACK_HANDLER);
if (handler instanceof SecretCallbackHandler) {
cache.setSecretCallbackHandler((SecretCallbackHandler) handler);
}
}
Aggregations