org.apache.archiva.rest.services
Class DefaultCommonServices

java.lang.Object
  extended by org.apache.archiva.rest.services.DefaultCommonServices
All Implemented Interfaces:
CommonServices

@Service(value="commonServices#rest")
public class DefaultCommonServices
extends Object
implements CommonServices

Author:
Olivier Lamy

Field Summary
private  Map<String,String> cachei18n
           
protected  org.apache.archiva.redback.components.scheduler.CronExpressionValidator cronExpressionValidator
           
private  org.slf4j.Logger log
           
private static String RESOURCE_NAME
           
private  org.apache.archiva.redback.rest.api.services.UtilServices utilServices
           
 
Constructor Summary
DefaultCommonServices()
           
 
Method Summary
private  String fromProperties(Properties properties)
           
 String getAllI18nResources(String locale)
          will return properties available in org/apache/archiva/i18n/default.properties load default (en) then override with locale used so at least en are returned if no translation in the locale asked.
 String getI18nResources(String locale)
          will return properties available in org/apache/archiva/i18n/default.properties load default (en) then override with locale used so at least en are returned if no translation in the locale asked.
 void init()
           
private  void loadFromString(String propsStr, Properties properties)
           
private  void loadResource(Properties properties, StringBuilder resourceName, String locale)
           
private  void loadResource(Properties finalProperties, String resourceName, String locale)
           
 Boolean validateCronExpression(String cronExpression)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE_NAME

private static final String RESOURCE_NAME
See Also:
Constant Field Values

log

private org.slf4j.Logger log

utilServices

@Inject
private org.apache.archiva.redback.rest.api.services.UtilServices utilServices

cachei18n

private Map<String,String> cachei18n

cronExpressionValidator

@Inject
protected org.apache.archiva.redback.components.scheduler.CronExpressionValidator cronExpressionValidator
Constructor Detail

DefaultCommonServices

public DefaultCommonServices()
Method Detail

init

@PostConstruct
public void init()
          throws ArchivaRestServiceException
Throws:
ArchivaRestServiceException

getI18nResources

public String getI18nResources(String locale)
                        throws ArchivaRestServiceException
Description copied from interface: CommonServices
will return properties available in org/apache/archiva/i18n/default.properties load default (en) then override with locale used so at least en are returned if no translation in the locale asked.

Specified by:
getI18nResources in interface CommonServices
Throws:
ArchivaRestServiceException

loadResource

private void loadResource(Properties properties,
                          StringBuilder resourceName,
                          String locale)
                   throws IOException
Throws:
IOException

fromProperties

private String fromProperties(Properties properties)

loadResource

private void loadResource(Properties finalProperties,
                          String resourceName,
                          String locale)
                   throws IOException
Throws:
IOException

getAllI18nResources

public String getAllI18nResources(String locale)
                           throws ArchivaRestServiceException
Description copied from interface: CommonServices
will return properties available in org/apache/archiva/i18n/default.properties load default (en) then override with locale used so at least en are returned if no translation in the locale asked. This method will add redback resources too. note Archva wins

Specified by:
getAllI18nResources in interface CommonServices
Throws:
ArchivaRestServiceException

loadFromString

private void loadFromString(String propsStr,
                            Properties properties)
                     throws ArchivaRestServiceException
Throws:
ArchivaRestServiceException

validateCronExpression

public Boolean validateCronExpression(String cronExpression)
                               throws ArchivaRestServiceException
Specified by:
validateCronExpression in interface CommonServices
Throws:
ArchivaRestServiceException


Copyright © 2006-2013 The Apache Software Foundation. All Rights Reserved.