本文整理汇总了Java中org.alfresco.error.AlfrescoRuntimeException类的典型用法代码示例。如果您正苦于以下问题:Java AlfrescoRuntimeException类的具体用法?Java AlfrescoRuntimeException怎么用?Java AlfrescoRuntimeException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AlfrescoRuntimeException类属于org.alfresco.error包,在下文中一共展示了AlfrescoRuntimeException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDisabledPaths
import org.alfresco.error.AlfrescoRuntimeException; //导入依赖的package包/类
/**
* @param application the audit application object
* @return Returns a copy of the set of disabled paths associated with the application
*/
@SuppressWarnings("unchecked")
private Set<String> getDisabledPaths(AuditApplication application)
{
try
{
Long disabledPathsId = application.getDisabledPathsId();
Set<String> disabledPaths = (Set<String>) propertyValueDAO.getPropertyById(disabledPathsId);
return new HashSet<String>(disabledPaths);
}
catch (Throwable e)
{
// Might be an invalid ID, somehow
auditModelRegistry.loadAuditModels();
throw new AlfrescoRuntimeException("Unabled to get AuditApplication disabled paths: " + application, e);
}
}
示例2: startup
import org.alfresco.error.AlfrescoRuntimeException; //导入依赖的package包/类
/**
* This method is run as System within a single transaction on startup.
*/
public void startup()
{
bindBehaviour();
// Get NodeRefs for folders to ignore
this.ignoreExtractionFolders = new HashSet<NodeRef>(ignoreExtractionFoldersBeans.length * 2);
for (RepositoryFolderConfigBean ignoreExtractionFoldersBean : ignoreExtractionFoldersBeans)
{
NodeRef nodeRef = ignoreExtractionFoldersBean.getFolderPath(namespaceService, nodeService, searchService,
fileFolderService);
if (!ignoreExtractionFolders.add(nodeRef))
{
// It was already in the set
throw new AlfrescoRuntimeException("The folder extraction path has been referenced already: \n"
+ " Folder: " + ignoreExtractionFoldersBean);
}
}
// Locate or create IMAP home
imapHomeNodeRef = imapHomeConfigBean.getOrCreateFolderPath(namespaceService, nodeService, searchService, fileFolderService);
}
示例3: validateMAC
import org.alfresco.error.AlfrescoRuntimeException; //导入依赖的package包/类
/**
* Compares the expectedMAC against the MAC generated from
* Assumes message has been decrypted
* @param keyAlias String
* @param expectedMAC byte[]
* @param macInput MACInput
* @return boolean
*/
public boolean validateMAC(String keyAlias, byte[] expectedMAC, MACInput macInput)
{
try
{
byte[] mac = generateMAC(keyAlias, macInput);
if(logger.isDebugEnabled())
{
logger.debug("Validating expected MAC " + Arrays.toString(expectedMAC) + " against mac " + Arrays.toString(mac) + " for MAC input " + macInput + "...");
}
boolean areEqual = Arrays.equals(expectedMAC, mac);
if(logger.isDebugEnabled())
{
logger.debug(areEqual ? "...MAC validation succeeded." : "...MAC validation failed.");
}
return areEqual;
}
catch (Exception e)
{
throw new AlfrescoRuntimeException("Failed to validate MAC", e);
}
}
示例4: initialize
import org.alfresco.error.AlfrescoRuntimeException; //导入依赖的package包/类
/**
* Initialize the authenticator (after properties have been set)
*
* @exception InvalidConfigurationException
*/
@Override
public void initialize() throws InvalidConfigurationException
{
super.initialize();
// Check if the appropriate authentication component type is configured
AuthenticationComponent authenticationComponent = getAuthenticationComponent();
if (authenticationComponent instanceof NLTMAuthenticator
&& ((NLTMAuthenticator) authenticationComponent).getNTLMMode() == NTLMMode.MD4_PROVIDER)
throw new AlfrescoRuntimeException(
"Wrong authentication setup for passthru authenticator (cannot be used with Alfresco users)");
// Create the password encryptor
m_passwordEncryptor = new PasswordEncryptor();
}
示例5: startServer
import org.alfresco.error.AlfrescoRuntimeException; //导入依赖的package包/类
/**
* Start the FTP server components
*
* @exception SocketException If a network error occurs
* @exception IOException If an I/O error occurs
*/
public final void startServer() throws SocketException, IOException
{
try
{
// Create the FTP server, if enabled
m_ftpConfig = (FTPConfigSection) filesysConfig.getConfigSection( FTPConfigSection.SectionName);
if (m_ftpConfig != null)
{
// Create the FTP server
ftpServer = new FTPServer(filesysConfig);
filesysConfig.addServer(ftpServer);
}
// Start the server
if(ftpServer != null)
{
// Start the FTP server
if (logger.isInfoEnabled())
logger.info("Starting server " + ftpServer.getProtocolName() + " ...");
ftpServer.startServer();
}
}
catch (Throwable e)
{
ftpServer = null;
throw new AlfrescoRuntimeException("Failed to start FTP Server", e);
}
// success
}
示例6: testAliasWithIncorrectPassword_One
import org.alfresco.error.AlfrescoRuntimeException; //导入依赖的package包/类
public void testAliasWithIncorrectPassword_One() throws Exception
{
try
{
getTestKeyStoreProvider(FILE_ONE, Collections.singletonMap(ALIAS_ONE, "password_fail"));
// new KeystoreKeyProvider(
// FILE_ONE,
// getKeyStoreLoader(),
// "SunJCE",
// "JCEKS",
// Collections.singletonMap(ALIAS_ONE, "password_fail"));
fail("Expect to fail because password is incorrect");
}
catch (AlfrescoRuntimeException e)
{
// Expected
assertTrue(e.getCause() instanceof UnrecoverableKeyException);
}
}
示例7: processMessage
import org.alfresco.error.AlfrescoRuntimeException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public void processMessage(NodeRef nodeRef, EmailMessage message)
{
QName nodeTypeQName = getNodeService().getType(nodeRef);
NodeRef topicNode = null;
if (getDictionaryService().isSubClass(nodeTypeQName, ForumModel.TYPE_TOPIC))
{
topicNode = nodeRef;
}
else if (getDictionaryService().isSubClass(nodeTypeQName, ForumModel.TYPE_POST))
{
topicNode = getNodeService().getPrimaryParent(nodeRef).getParentRef();
if (topicNode == null)
{
throw new AlfrescoRuntimeException("A POST node has no primary parent: " + nodeRef);
}
}
else
{
throw new AlfrescoRuntimeException("\n" +
"Message handler " + this.getClass().getName() + " cannot handle type " + nodeTypeQName + ".\n" +
"Check the message handler mappings.");
}
addPostNode(topicNode, message);
}
示例8: decodeAlgorithmParameters
import org.alfresco.error.AlfrescoRuntimeException; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public AlgorithmParameters decodeAlgorithmParameters(byte[] encoded)
{
try
{
AlgorithmParameters p = null;
String algorithm = "DESede";
if(getCipherProvider() != null)
{
p = AlgorithmParameters.getInstance(algorithm, getCipherProvider());
}
else
{
p = AlgorithmParameters.getInstance(algorithm);
}
p.init(encoded);
return p;
}
catch(Exception e)
{
throw new AlfrescoRuntimeException("", e);
}
}
示例9: setMac
import org.alfresco.error.AlfrescoRuntimeException; //导入依赖的package包/类
/**
* Set the MAC on the HTTP response
*
* @param response HttpServletResponse
* @param mac byte[]
*/
protected void setMac(HttpServletResponse response, byte[] mac)
{
if(mac == null)
{
throw new AlfrescoRuntimeException("Mac cannot be null");
}
response.setHeader(HEADER_MAC, Base64.encodeBytes(mac));
}
示例10: sendNotification
import org.alfresco.error.AlfrescoRuntimeException; //导入依赖的package包/类
/**
* @see org.alfresco.service.cmr.notification.NotificationService#sendNotification(java.lang.String, org.alfresco.service.cmr.notification.NotificationContext)
*/
@Override
public void sendNotification(String notificationProvider, NotificationContext notificationContext)
{
// Check the mandatory params
ParameterCheck.mandatory("notificationProvider", notificationProvider);
ParameterCheck.mandatory("notificationContext", notificationContext);
// Check that the notificaiton provider exists
if (exists(notificationProvider) == false)
{
throw new AlfrescoRuntimeException(I18NUtil.getMessage(MSG_NP_DOES_NOT_EXIST, notificationProvider));
}
// Get the notification provider and send notification
NotificationProvider provider = providers.get(notificationProvider);
provider.sendNotification(notificationContext);
}
示例11: checkTxnState
import org.alfresco.error.AlfrescoRuntimeException; //导入依赖的package包/类
/**
* Checks that the 'System' user is active in a read-write txn.
*/
private final void checkTxnState(TxnReadState txnStateNeeded)
{
switch (txnStateNeeded)
{
case TXN_READ_WRITE:
if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_READ_WRITE)
{
throw AlfrescoRuntimeException.create("system.usage.err.no_txn_readwrite");
}
break;
case TXN_READ_ONLY:
if (AlfrescoTransactionSupport.getTransactionReadState() == TxnReadState.TXN_NONE)
{
throw AlfrescoRuntimeException.create("system.usage.err.no_txn");
}
break;
}
}
示例12: getMLContainerRoot
import org.alfresco.error.AlfrescoRuntimeException; //导入依赖的package包/类
/**
* @return Returns a reference to the node that will hold all the <b>cm:mlContainer</b> nodes.
*/
private NodeRef getMLContainerRoot()
{
NodeRef rootNodeRef = nodeService.getRootNode(StoreRef.STORE_REF_WORKSPACE_SPACESSTORE);
List<ChildAssociationRef> assocRefs = nodeService.getChildAssocs(
rootNodeRef,
ContentModel.ASSOC_CHILDREN,
QNAME_ASSOC_ML_ROOT);
if (assocRefs.size() != 1)
{
throw new AlfrescoRuntimeException(
"Unable to find bootstrap location for ML Root using query: " + QNAME_ASSOC_ML_ROOT);
}
NodeRef mlRootNodeRef = assocRefs.get(0).getChildRef();
// Done
return mlRootNodeRef;
}
示例13: setNamePattern
import org.alfresco.error.AlfrescoRuntimeException; //导入依赖的package包/类
/**
* Optionally set a pattern to which all object names must conform
* @param namePattern a regular expression
*/
public void setNamePattern(String namePattern)
{
writeLock.lock();
try
{
this.namePattern = Pattern.compile(namePattern);
}
catch (PatternSyntaxException e)
{
throw new AlfrescoRuntimeException(
"Regular expression compilation failed for property 'namePrefix': " + e.getMessage(),
e);
}
finally
{
writeLock.unlock();
}
}
示例14: getDomainUser
import org.alfresco.error.AlfrescoRuntimeException; //导入依赖的package包/类
public String getDomainUser(String baseUsername, String tenantDomain)
{
ParameterCheck.mandatory("baseUsername", baseUsername);
if ((tenantDomain == null) || (tenantDomain.equals(DEFAULT_DOMAIN)))
{
return baseUsername;
}
else
{
if (baseUsername.contains(SEPARATOR))
{
throw new AlfrescoRuntimeException("Invalid base username: " + baseUsername);
}
if (tenantDomain.contains(SEPARATOR))
{
throw new AlfrescoRuntimeException("Invalid tenant domain: " + tenantDomain);
}
tenantDomain = getTenantDomain(tenantDomain);
return baseUsername + SEPARATOR + tenantDomain;
}
}
示例15: setVersionComparatorClass
import org.alfresco.error.AlfrescoRuntimeException; //导入依赖的package包/类
/**
* Sets an optional comparator to sort a versions in descending order (eg. 2.1, 2.0, 1.1, 1.0).
* Really only needed in a 4.1.3 system (or above) that has been upgraded from an earlier system
* that used NON ordered sequence numbers in a cluster. Not something we really support but was
* the subject of MNT-226.
* @param versionComparatorClass the name of a comparator. For example
* "org.alfresco.repo.version.common.VersionLabelComparator".
*/
@SuppressWarnings("unchecked")
public void setVersionComparatorClass(String versionComparatorClass)
{
if (versionComparatorClass != null && versionComparatorClass.trim().length() != 0)
{
try
{
versionComparatorDesc = (Comparator<Version>) getClass().getClassLoader().
loadClass(versionComparatorClass.trim()).newInstance();
}
catch (Exception e)
{
throw new AlfrescoRuntimeException(
"Failed to create a Comparator<Version> using the class name "+
versionComparatorClass, e);
}
}
}