[jira] Commented: (CONFIGURATION-284) ability to read OS environment variables

2007-07-21 Thread Vasily Ivanov (JIRA)

[ 
https://issues.apache.org/jira/browse/CONFIGURATION-284?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12514450
 ] 

Vasily Ivanov commented on CONFIGURATION-284:
-

Thanks Oliver, feel free to add that code anywhere you want.

> ability to read OS environment variables
> 
>
> Key: CONFIGURATION-284
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-284
> Project: Commons Configuration
>  Issue Type: New Feature
>  Components: Interpolation
>Reporter: Aksel Schmidt
>Priority: Minor
> Attachments: EnvironmentConfiguration.java
>
>
> suggestion:
> interpolation with system environment, i.e.
> ${sys:user.name} reads from systemproperties (as of today)
> ${sysenv:TEMP} reads from OS environment
> these can be parsed from a supported set of OS's - windows read from a set in 
> a "cmd /c", unix/linux from an "env" etc. (just once on demand)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Updated: (VFS-170) FileSelector that delegates all work to java.io.FilenameFilter

2007-07-12 Thread Vasily Ivanov (JIRA)

 [ 
https://issues.apache.org/jira/browse/VFS-170?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vasily Ivanov updated VFS-170:
--

Attachment: FilenameFilterFileSelector.java

FilenameFilterFileSelector implementation.

> FileSelector that delegates all work to java.io.FilenameFilter
> --
>
> Key: VFS-170
> URL: https://issues.apache.org/jira/browse/VFS-170
> Project: Commons VFS
>  Issue Type: New Feature
>Affects Versions: 1.0
>Reporter: Vasily Ivanov
>Priority: Minor
> Attachments: FilenameFilterFileSelector.java
>
>
> See file attached.
> This will allow to use one-liners like this:
> import org.apache.commons.io.IOCase;
> import org.apache.commons.io.filefilter.WildcardFileFilter;
> ...
> FileObject[] configFileObjects = dirObject.findFiles(new 
> FilenameFilterFileSelector(new WildcardFileFilter("*config*.xml", 
> IOCase.SYSTEM)))
> To name a few FilenameFilters from Commons IO that can be used here:
> AndFileFilter
> DelegateFileFilter
> NameFileFilter
> NotFileFilter
> OrFileFilter
> PrefixFileFilter
> SuffixFileFilter
> WildcardFileFilter
> FalseFileFilter
> TrueFileFilter
> Very useful. :-)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Created: (VFS-170) FileSelector that delegates all work to java.io.FilenameFilter

2007-07-12 Thread Vasily Ivanov (JIRA)
FileSelector that delegates all work to java.io.FilenameFilter
--

 Key: VFS-170
 URL: https://issues.apache.org/jira/browse/VFS-170
 Project: Commons VFS
  Issue Type: New Feature
Affects Versions: 1.0
Reporter: Vasily Ivanov
Priority: Minor


See file attached.

This will allow to use one-liners like this:

import org.apache.commons.io.IOCase;
import org.apache.commons.io.filefilter.WildcardFileFilter;

...

FileObject[] configFileObjects = dirObject.findFiles(new 
FilenameFilterFileSelector(new WildcardFileFilter("*config*.xml", 
IOCase.SYSTEM)))

To name a few FilenameFilters from Commons IO that can be used here:
AndFileFilter
DelegateFileFilter
NameFileFilter
NotFileFilter
OrFileFilter
PrefixFileFilter
SuffixFileFilter
WildcardFileFilter
FalseFileFilter
TrueFileFilter

Very useful. :-)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Updated: (CONFIGURATION-284) ability to read OS environment variables

2007-07-11 Thread Vasily Ivanov (JIRA)

 [ 
https://issues.apache.org/jira/browse/CONFIGURATION-284?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vasily Ivanov updated CONFIGURATION-284:


Attachment: EnvironmentConfiguration.java

I have create simple Configuration to read environment variables. Please see 
file attached.

Also, I have tried to use 
PropertiesConfiguration.PropertiesReader#parseProperty(String line) magic, but 
it returns corrupted Windows paths by unescapeing variables values when it is 
not necessary. I didn't find a way to prevent it doing that. However, here is 
the code for you convenience if you want to play around:

private static Properties readEnvVariables(final InputStream in) throws 
IOException
{
  Properties props = new Properties();
  PropertiesConfiguration.PropertiesReader reader =
  new PropertiesConfiguration.PropertiesReader(new InputStreamReader(in));
  while (reader.nextProperty()) {
props.setProperty(reader.getPropertyName(), reader.getPropertyValue());
  }

  return props;
}

Note: I haven't tested it in UNIX, but it should work just fine.

> ability to read OS environment variables
> 
>
> Key: CONFIGURATION-284
> URL: https://issues.apache.org/jira/browse/CONFIGURATION-284
> Project: Commons Configuration
>  Issue Type: New Feature
>  Components: Interpolation
>Reporter: Aksel Schmidt
>Priority: Minor
> Attachments: EnvironmentConfiguration.java
>
>
> suggestion:
> interpolation with system environment, i.e.
> ${sys:user.name} reads from systemproperties (as of today)
> ${sysenv:TEMP} reads from OS environment
> these can be parsed from a supported set of OS's - windows read from a set in 
> a "cmd /c", unix/linux from an "env" etc. (just once on demand)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Updated: (VFS-168) FileSystemOptionsFactoryBean implementation to configure FileSystemOptions object in the Spring context

2007-07-10 Thread Vasily Ivanov (JIRA)

 [ 
https://issues.apache.org/jira/browse/VFS-168?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vasily Ivanov updated VFS-168:
--

Priority: Major  (was: Minor)

> FileSystemOptionsFactoryBean implementation to configure FileSystemOptions 
> object in the Spring context
> ---
>
> Key: VFS-168
> URL: https://issues.apache.org/jira/browse/VFS-168
> Project: Commons VFS
>  Issue Type: New Feature
>Reporter: Vasily Ivanov
> Attachments: FileSystemOptionsFactoryBean.java
>
>
> It would be nice to have Spring FactoryBean that configures FileSystemOptions 
> object and provides it as a bean reference.
> I have created simple FactoryBean to do this kind of stuff 
> (FileSystemOptionsFactoryBean.java attached).
> For example, configuration would be like this:
> 
> 
>   
>  key="org.apache.commons.vfs.impl.DefaultFileSystemConfigBuilder">
>   
> 
>class="org.apache.commons.vfs.auth.StaticUserAuthenticator">
> 
> 
> 
>   
> 
>   
> 
>  key="org.apache.commons.vfs.provider.sftp.SftpFileSystemConfigBuilder">
>   
> 
>static-field="org.apache.commons.vfs.provider.sftp.SftpFileSystemConfigBuilder.PROXY_HTTP"/>
> 
> 
> 
> 
>class="org.apache.commons.vfs.provider.sftp.TrustEveryoneUserInfo"/>
> 
> 
> 
> 
>   
> 
>   
> 
>   
> All properties are optional with "smart" defaults.
> I'm planing to make it smart enough to accept just map of properties 
> (FileSystem options) without reference to FileSystemConfigBuilder objects. 
> It'll introspect all available FileSystemConfigBuilder implementations and 
> apply those options using proper FileSystemConfigBuilder implementation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Updated: (VFS-168) FileSystemOptionsFactoryBean implementation to configure FileSystemOptions object in the Spring context

2007-07-10 Thread Vasily Ivanov (JIRA)

 [ 
https://issues.apache.org/jira/browse/VFS-168?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vasily Ivanov updated VFS-168:
--

Attachment: FileSystemOptionsFactoryBean.java

FileSystemOptionsFactoryBean implementation

> FileSystemOptionsFactoryBean implementation to configure FileSystemOptions 
> object in the Spring context
> ---
>
> Key: VFS-168
> URL: https://issues.apache.org/jira/browse/VFS-168
> Project: Commons VFS
>  Issue Type: New Feature
>Reporter: Vasily Ivanov
>Priority: Minor
> Attachments: FileSystemOptionsFactoryBean.java
>
>
> It would be nice to have Spring FactoryBean that configures FileSystemOptions 
> object and provides it as a bean reference.
> I have created simple FactoryBean to do this kind of stuff 
> (FileSystemOptionsFactoryBean.java attached).
> For example, configuration would be like this:
> 
> 
>   
>  key="org.apache.commons.vfs.impl.DefaultFileSystemConfigBuilder">
>   
> 
>class="org.apache.commons.vfs.auth.StaticUserAuthenticator">
> 
> 
> 
>   
> 
>   
> 
>  key="org.apache.commons.vfs.provider.sftp.SftpFileSystemConfigBuilder">
>   
> 
>static-field="org.apache.commons.vfs.provider.sftp.SftpFileSystemConfigBuilder.PROXY_HTTP"/>
> 
> 
> 
> 
>class="org.apache.commons.vfs.provider.sftp.TrustEveryoneUserInfo"/>
> 
> 
> 
> 
>   
> 
>   
> 
>   
> All properties are optional with "smart" defaults.
> I'm planing to make it smart enough to accept just map of properties 
> (FileSystem options) without reference to FileSystemConfigBuilder objects. 
> It'll introspect all available FileSystemConfigBuilder implementations and 
> apply those options using proper FileSystemConfigBuilder implementation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Created: (VFS-168) FileSystemOptionsFactoryBean implementation to configure FileSystemOptions object in the Spring context

2007-07-10 Thread Vasily Ivanov (JIRA)
FileSystemOptionsFactoryBean implementation to configure FileSystemOptions 
object in the Spring context
---

 Key: VFS-168
 URL: https://issues.apache.org/jira/browse/VFS-168
 Project: Commons VFS
  Issue Type: New Feature
Reporter: Vasily Ivanov
Priority: Minor


It would be nice to have Spring FactoryBean that configures FileSystemOptions 
object and provides it as a bean reference.

I have created simple FactoryBean to do this kind of stuff 
(FileSystemOptionsFactoryBean.java attached).

For example, configuration would be like this:


  

  

  



  

  


  

  




  




  

  

  

All properties are optional with "smart" defaults.

I'm planing to make it smart enough to accept just map of properties 
(FileSystem options) without reference to FileSystemConfigBuilder objects. 
It'll introspect all available FileSystemConfigBuilder implementations and 
apply those options using proper FileSystemConfigBuilder implementation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Created: (LANG-347) DateUtils' new addWeekdays feature

2007-07-08 Thread Vasily Ivanov (JIRA)
DateUtils' new addWeekdays feature
--

 Key: LANG-347
 URL: https://issues.apache.org/jira/browse/LANG-347
 Project: Commons Lang
  Issue Type: New Feature
Affects Versions: 2.3
Reporter: Vasily Ivanov
 Fix For: 2.3.1, 3.0


New method to add signed number of weekdays (skipping weekends):

/**
   * Adds a number of weekdays (skipping weekends) to a date returning a new 
Date object.
   * The original date object is unchanged.
   * 
   * If the original Date itself is on a weekend, calculation will be started 
from the
   * next Monday morning (0:00:00.000) if an amount is positive or from the 
last Friday night
   * (23:59:59.999) otherwise.
   * 
   * @param date the date, not null
   * @param amount the amount to add, may be negative
   * @return the new Date object with the amount added
   */
  public static Date addWeekdays(Date date,
 int amount)
  {
if (date == null) {
  throw new IllegalArgumentException("The date must not be null");
}

Calendar c = Calendar.getInstance();
c.setTime(date);

if (amount != 0) {

  if (isWeekend(c)) {
// see comments above
final boolean isSat = getDayOfWeek(c) == Calendar.SATURDAY;

int numToJump = 0;
if (amount > 0) {
  // this will jump date to the closest Monday
  numToJump = isSat ? 2 : 1;
} else {
  // this will jump date to the closest Saturday
  numToJump = isSat ? 0 : -1;
}
c.add(Calendar.DAY_OF_MONTH, numToJump);

// this will jump to the start of the day (Monday or Saturday)
modify(c, Calendar.DAY_OF_MONTH, false);

if (amount < 0) {
  // this will go back to the end of prev Friday
  c.add(Calendar.MILLISECOND, -1);
}
  }

  int count = 0;
  final int absAmount = Math.abs(amount);
  final int offset = amount > 0 ? 1 : -1;

  while (count < absAmount) {
c.add(Calendar.DAY_OF_MONTH, offset);
if (!isWeekend(c)) {
  count++;
}
  }
}

return c.getTime();
  }

  public static int getDayOfWeek(Calendar c)
  {
return c.get(Calendar.DAY_OF_WEEK);
  }

  public static boolean isWeekend(Calendar c)
  {
final int dayOfWeek = getDayOfWeek(c);
return dayOfWeek == Calendar.SATURDAY || dayOfWeek == Calendar.SUNDAY;
  }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Updated: (VFS-129) SFTP: proxy support with Username / Password

2007-06-24 Thread Vasily Ivanov (JIRA)

 [ 
https://issues.apache.org/jira/browse/VFS-129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vasily Ivanov updated VFS-129:
--

Attachment: SftpClientFactory.java

amended to allow HTTP and SOCKS5 proxy authentication

> SFTP: proxy support with Username / Password
> 
>
> Key: VFS-129
> URL: https://issues.apache.org/jira/browse/VFS-129
> Project: Commons VFS
>  Issue Type: Improvement
> Environment: All
>Reporter: Graham Cruickshanks
>Priority: Minor
> Attachments: SftpClientFactory.java, SftpFileSystemConfigBuilder.java
>
>
> SFTP proxy implementation does not have authenticator support, so can't 
> tunnel through HTTP proxy via HTTPS port (443).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Updated: (VFS-129) SFTP: proxy support with Username / Password

2007-06-24 Thread Vasily Ivanov (JIRA)

 [ 
https://issues.apache.org/jira/browse/VFS-129?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Vasily Ivanov updated VFS-129:
--

Attachment: SftpFileSystemConfigBuilder.java

amended to accept proxy UserAuthenticator

> SFTP: proxy support with Username / Password
> 
>
> Key: VFS-129
> URL: https://issues.apache.org/jira/browse/VFS-129
> Project: Commons VFS
>  Issue Type: Improvement
> Environment: All
>Reporter: Graham Cruickshanks
>Priority: Minor
> Attachments: SftpClientFactory.java, SftpFileSystemConfigBuilder.java
>
>
> SFTP proxy implementation does not have authenticator support, so can't 
> tunnel through HTTP proxy via HTTPS port (443).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Commented: (VFS-129) SFTP: proxy support with Username / Password

2007-06-24 Thread Vasily Ivanov (JIRA)

[ 
https://issues.apache.org/jira/browse/VFS-129?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12507733
 ] 

Vasily Ivanov commented on VFS-129:
---

I created a patch for this one. Attachments follow.

Here is an example:

FileSystemOptions opts = new FileSystemOptions();
SftpFileSystemConfigBuilder.getInstance().setProxyType(opts, 
SftpFileSystemConfigBuilder.PROXY_HTTP);
SftpFileSystemConfigBuilder.getInstance().setProxyHost(opts, "someproxyhost");
SftpFileSystemConfigBuilder.getInstance().setProxyPort(opts, someport);
SftpFileSystemConfigBuilder.getInstance().setPorxyUserAuthenticator(opts, new 
StaticUserAuthenticator(null, "proxyusername", "proxypassword"));
FileObject fo = VFS.getManager().resolveFile(someURI, opts);
...

> SFTP: proxy support with Username / Password
> 
>
> Key: VFS-129
> URL: https://issues.apache.org/jira/browse/VFS-129
> Project: Commons VFS
>  Issue Type: Improvement
> Environment: All
>Reporter: Graham Cruickshanks
>Priority: Minor
>
> SFTP proxy implementation does not have authenticator support, so can't 
> tunnel through HTTP proxy via HTTPS port (443).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Created: (COLLECTIONS-223) CollectionUtils.addAll() methods should return the input collection

2006-08-22 Thread Vasily Ivanov (JIRA)
CollectionUtils.addAll() methods should return the input collection
---

 Key: COLLECTIONS-223
 URL: http://issues.apache.org/jira/browse/COLLECTIONS-223
 Project: Commons Collections
  Issue Type: Improvement
  Components: Collection
Affects Versions: 3.2
Reporter: Vasily Ivanov
Priority: Minor


Like MapUtils.putAll() method returns input map, CollectionUtils.addAll() 
methods should return the input collection.

This will allow to init and populate collection at the same line:
ArrayList inputs = (ArrayList) CollectionUtils.addAll(new ArrayList(), new 
String[] { "value1", "value2" });

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]