Java Code Examples for org.alfresco.util.PropertyCheck#isValidPropertyString()

The following examples show how to use org.alfresco.util.PropertyCheck#isValidPropertyString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RepositoryFolderConfigBean.java    From alfresco-repository with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Set the folder name path <b>relative to the {@link #getFolderPath() path}</b>.
 * 
 * @param folderPath            a folder-name path using the '<b>/</b>' path separator e.g. '<b>IMAP HOME/MAIL-1</b>'
 */
public void setFolderPath(String folderPath)
{
    if (!PropertyCheck.isValidPropertyString(folderPath))
    {
        throw new IllegalArgumentException("Invalid folder name path for property 'folderPath': " + folderPath);
    }
    StringTokenizer tokenizer = new StringTokenizer(folderPath, "/");
    StringBuilder pathBuff = new StringBuilder(folderPath.length());
    while (tokenizer.hasMoreTokens())
    {
        String folderName = tokenizer.nextToken();
        if (folderName.length() == 0)
        {
            throw new IllegalArgumentException("Invalid folder name path for property 'folderPath': " + folderPath);
        }
        pathBuff.append(folderName);
        if (tokenizer.hasMoreTokens())
        {
            pathBuff.append('/');
        }
    }
    this.folderPath = pathBuff.toString();
}
 
Example 2
Source File: KeyStoreParameters.java    From alfresco-core with GNU Lesser General Public License v3.0 6 votes vote down vote up
public void init()
{
    if (!PropertyCheck.isValidPropertyString(getId()))
    {
        setId(null);
    }
    if (!PropertyCheck.isValidPropertyString(getLocation()))
    {
        setLocation(null);
    }
    if (!PropertyCheck.isValidPropertyString(getProvider()))
    {
        setProvider(null);
    }
    if (!PropertyCheck.isValidPropertyString(getType()))
    {
        setType(null);
    }
    if (!PropertyCheck.isValidPropertyString(getKeyMetaDataFileLocation()))
    {
        setKeyMetaDataFileLocation(null);
    }        
}
 
Example 3
Source File: LDAPInitialDirContextFactoryImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void setTrustStorePath(String trustStorePath)
{
    if (PropertyCheck.isValidPropertyString(trustStorePath))
    {
        this.trustStorePath = trustStorePath;
    }
}
 
Example 4
Source File: LDAPInitialDirContextFactoryImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void setTrustStoreType(String trustStoreType)
{
    if (PropertyCheck.isValidPropertyString(trustStoreType))
    {
        this.trustStoreType = trustStoreType;
    }
}
 
Example 5
Source File: LDAPInitialDirContextFactoryImpl.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void setTrustStorePassPhrase(String trustStorePassPhrase)
{
    if (PropertyCheck.isValidPropertyString(trustStorePassPhrase))
    {
        this.trustStorePassPhrase = trustStorePassPhrase;
    }
}
 
Example 6
Source File: AlfrescoJavaMailSender.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void setUsername(String userName)
{
    if (PropertyCheck.isValidPropertyString(userName))
    {
        super.setUsername(userName);
    }
    else
    {
        super.setUsername(null);
    }
}
 
Example 7
Source File: AlfrescoJavaMailSender.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void setPassword(String password)
{
    if (PropertyCheck.isValidPropertyString(password))
    {
        super.setPassword(password);
    }
    else
    {
        super.setPassword(null);
    }
}
 
Example 8
Source File: UserAuditFilter.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void parseProperties()
{
    String userPropertyValue = userFilterPattern;
    if (!PropertyCheck.isValidPropertyString(userPropertyValue))
    {
        return;
    }
    
    String[] arrValues = userPropertyValue.split(REG_EXP_SEPARATOR);
    for (String prop : arrValues)
    {
        boolean includeExp = prop.charAt(0) != NOT;

        if (!includeExp || prop.startsWith(ESCAPED_NOT))
        {
            prop = prop.substring(1);
        }
        try
        {
            listOfPairValue.add(new Pair<Boolean, Pattern>(includeExp, Pattern.compile(prop)));
        }
        catch (PatternSyntaxException ex)
        {
            throw new AlfrescoRuntimeException("The 'audit.filter.alfresco-access.transaction.user' property parse exception; see property 'audit.filter.alfresco-access.transaction.user'.", ex);
        }
    }
}
 
Example 9
Source File: SchemaBootstrap.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Set db.schema.name to be used
 */
public void setDbSchemaName(String dbSchemaName)
{
    if (PropertyCheck.isValidPropertyString(dbSchemaName))
    {
        this.dbSchemaName = dbSchemaName;
    }
}
 
Example 10
Source File: ConnectionPoolOverloadTest.java    From alfresco-repository with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Before
public void setUp() throws Exception
{
    failCount = new MutableInt(0);
    transactionService = ctx.getBean("transactionComponent", TransactionService.class);
    properties = ctx.getBean("global-properties", Properties.class);

    String dbPoolMaxProp = properties.getProperty("db.pool.max");
    if (PropertyCheck.isValidPropertyString(dbPoolMaxProp))
    {
        dbPoolMax = Integer.parseInt(dbPoolMaxProp);
    }
    else
    {
        throw new IllegalArgumentException("The db.pool.max property is not valid.");
    }
    
    String dbPoolWaitMaxProp = properties.getProperty("db.pool.wait.max");
    if (PropertyCheck.isValidPropertyString(dbPoolWaitMaxProp))
    {
        dbPoolWaitMax = Integer.parseInt(dbPoolWaitMaxProp);
    }
    else
    {
        throw new IllegalArgumentException("The db.pool.wait.max property is not valid.");
    }
    
    dbPoolWaitMax = dbPoolWaitMax == -1 ? 100 : dbPoolWaitMax;
}
 
Example 11
Source File: WebDAVServlet.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * @return              Returns the name of the store
 * @throws ServletException if the store name was not set
 */
public String getStoreName() throws ServletException
{
    if (!PropertyCheck.isValidPropertyString(storeName))
    {
        throw new ServletException("WebDAV missing 'storeName' value.");
    }
    return storeName;
}
 
Example 12
Source File: WebDAVServlet.java    From alfresco-remote-api with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * @return              Returns the WebDAV root path within the store
 * @throws ServletException if the root path was not set
 */
public String getRootPath() throws ServletException
{
    if (!PropertyCheck.isValidPropertyString(rootPath))
    {
        throw new ServletException("WebDAV missing 'rootPath' value.");
    }
    return rootPath;
}