org.nuiton.jredmine
Class DefaultRedmineServiceImplementor

java.lang.Object
  extended by org.nuiton.jredmine.DefaultRedmineServiceImplementor
All Implemented Interfaces:
RedmineServiceImplementor

public class DefaultRedmineServiceImplementor
extends Object
implements RedmineServiceImplementor

Created: 2 janv. 2010

Since:
1.0.3
Version:
$Revision: 122 $

Mise a jour: $Date: 2010-01-24 19:51:06 +0100 (dim., 24 janv. 2010) $ par : $Author: tchemit $

Author:
Tony Chemit Copyright Code Lutin
Plexus component:
role:
"org.nuiton.jredmine.RedmineServiceImplementor"
role-hint:
"default"

Field Summary
protected  boolean init
          internal state to known if service was init
protected  org.nuiton.io.rest.RestClient session
           
protected  RedmineXpp3Helper xpp3Helper
          xpp3 xpp3Helper to transform xml stream to pojo
 
Constructor Summary
DefaultRedmineServiceImplementor()
           
 
Method Summary
protected  InputStream askDataStream(String requestName, Object... args)
           
protected  void checkInit()
           
 void checkLoggued()
          Checks if the current session is not a anonymous one.
 void checkNotLoggued(org.nuiton.io.rest.RestClient session)
          Checks if the current session is anonymous.
protected  void checkSessionConfigurationNotNull(org.nuiton.io.rest.RestClient session)
           
protected  void checkSessionNotNull(org.nuiton.io.rest.RestClient session)
           
 void destroy()
          Close the service and destroy any connexion to the redmine service.
<T> T
getData(String requestName, Class<T> type, Object... args)
          Generic method to obtain a single data from a redmine server.
protected
<T> T
getDataFromStream(Class<T> type, InputStream stream)
           
<T> T[]
getDatas(String requestName, Class<T> type, Object... args)
          Generic method to obtain a array of data from a redmine server.
protected
<T> T[]
getDatasFromStream(Class<T> type, InputStream stream)
           
protected  org.nuiton.io.rest.RestRequest getRequest(String requestName, Object... args)
           
 RedmineServiceImplementor init(org.nuiton.io.rest.RestClient session)
          Initialize the service given a redmine client already initialized.
 RedmineServiceImplementor init(org.nuiton.io.rest.RestClientConfiguration configuration)
          Initialize the service given a client configuration.
 boolean isInit()
          Tests if the service is loogued to the redmine service.
<T> T
sendData(String requestName, Class<T> klazz, Object... args)
          Generic method to send a data to a redmine server and return the single data updated from the redmine server.
<T> T[]
sendDatas(String requestName, Class<T> klazz, Object... args)
          Generic method to send a data (or more ) to a redmine server and return the array of data from the redmine server.
protected  InputStream sendDataStream(String requestName, Object... args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

session

protected org.nuiton.io.rest.RestClient session

xpp3Helper

protected final RedmineXpp3Helper xpp3Helper
xpp3 xpp3Helper to transform xml stream to pojo


init

protected boolean init
internal state to known if service was init

Constructor Detail

DefaultRedmineServiceImplementor

public DefaultRedmineServiceImplementor()
Method Detail

isInit

public boolean isInit()
Description copied from interface: RedmineServiceImplementor
Tests if the service is loogued to the redmine service.

Specified by:
isInit in interface RedmineServiceImplementor
Returns:
true is service is init and loggued to Redmine service, false otherwise.

init

public RedmineServiceImplementor init(org.nuiton.io.rest.RestClientConfiguration configuration)
                               throws RedmineServiceException
Description copied from interface: RedmineServiceImplementor
Initialize the service given a client configuration.

Specified by:
init in interface RedmineServiceImplementor
Parameters:
configuration - the configuration to be used to init the internal redmine client
Returns:
the initialized service
Throws:
RedmineServiceException - if any pb

init

public RedmineServiceImplementor init(org.nuiton.io.rest.RestClient session)
                               throws RedmineServiceException
Description copied from interface: RedmineServiceImplementor
Initialize the service given a redmine client already initialized.

Specified by:
init in interface RedmineServiceImplementor
Parameters:
session - the redmine client to be used by the service
Returns:
the initialized service
Throws:
RedmineServiceException - if any pb
See Also:
RedmineRestClient

destroy

public void destroy()
             throws RedmineServiceException
Description copied from interface: RedmineServiceImplementor
Close the service and destroy any connexion to the redmine service.

Specified by:
destroy in interface RedmineServiceImplementor
Throws:
RedmineServiceException - if any pb

getData

public <T> T getData(String requestName,
                     Class<T> type,
                     Object... args)
          throws RedmineServiceException
Description copied from interface: RedmineServiceImplementor
Generic method to obtain a single data from a redmine server.

Specified by:
getData in interface RedmineServiceImplementor
Type Parameters:
T - the type of data to obtain
Parameters:
requestName - the name of the request to use
type - the type of data to obtain
args - the parameters to obtain the data
Returns:
the obtained data
Throws:
RedmineServiceException - if any pb

getDatas

public <T> T[] getDatas(String requestName,
                        Class<T> type,
                        Object... args)
             throws RedmineServiceException
Description copied from interface: RedmineServiceImplementor
Generic method to obtain a array of data from a redmine server.

Specified by:
getDatas in interface RedmineServiceImplementor
Type Parameters:
T - the type of data to obtain
Parameters:
requestName - the name of the request to use
type - the type of data to obtain
args - the parameters to obtain the datas
Returns:
the obtained datas
Throws:
RedmineServiceException - if any pb

sendData

public <T> T sendData(String requestName,
                      Class<T> klazz,
                      Object... args)
           throws RedmineServiceException
Description copied from interface: RedmineServiceImplementor
Generic method to send a data to a redmine server and return the single data updated from the redmine server.

Specified by:
sendData in interface RedmineServiceImplementor
Type Parameters:
T - the type of data to treate
Parameters:
requestName - the name of the request used
klazz - the type of data to treate
args - the parameters of the request
Returns:
the updated data
Throws:
RedmineServiceException - if any pb

sendDatas

public <T> T[] sendDatas(String requestName,
                         Class<T> klazz,
                         Object... args)
              throws RedmineServiceException
Description copied from interface: RedmineServiceImplementor
Generic method to send a data (or more ) to a redmine server and return the array of data from the redmine server.

Specified by:
sendDatas in interface RedmineServiceImplementor
Type Parameters:
T - the type of data to treate
Parameters:
requestName - the name of the request used
klazz - the type of data to treate
args - the parameters of the request
Returns:
the updated data
Throws:
RedmineServiceException - if any pb

checkLoggued

public void checkLoggued()
                  throws IllegalStateException,
                         RedmineServiceLoginException,
                         NullPointerException
Description copied from interface: RedmineServiceImplementor
Checks if the current session is not a anonymous one.

Specified by:
checkLoggued in interface RedmineServiceImplementor
Throws:
IllegalStateException - if service not init
RedmineServiceLoginException - if not loggued
NullPointerException - if something is null

checkNotLoggued

public void checkNotLoggued(org.nuiton.io.rest.RestClient session)
                     throws RedmineServiceLoginException,
                            NullPointerException
Description copied from interface: RedmineServiceImplementor
Checks if the current session is anonymous.

Specified by:
checkNotLoggued in interface RedmineServiceImplementor
Parameters:
session - the session to test
Throws:
RedmineServiceLoginException - if not anonymous
NullPointerException - if something is null

askDataStream

protected InputStream askDataStream(String requestName,
                                    Object... args)
                             throws RedmineServiceException
Throws:
RedmineServiceException

sendDataStream

protected InputStream sendDataStream(String requestName,
                                     Object... args)
                              throws RedmineServiceException
Throws:
RedmineServiceException

getRequest

protected org.nuiton.io.rest.RestRequest getRequest(String requestName,
                                                    Object... args)
                                             throws RedmineServiceException
Throws:
RedmineServiceException

getDataFromStream

protected <T> T getDataFromStream(Class<T> type,
                                  InputStream stream)
                       throws RedmineServiceException
Throws:
RedmineServiceException

getDatasFromStream

protected <T> T[] getDatasFromStream(Class<T> type,
                                     InputStream stream)
                          throws RedmineServiceException
Throws:
RedmineServiceException

checkInit

protected void checkInit()
                  throws IllegalStateException
Throws:
IllegalStateException

checkSessionNotNull

protected void checkSessionNotNull(org.nuiton.io.rest.RestClient session)

checkSessionConfigurationNotNull

protected void checkSessionConfigurationNotNull(org.nuiton.io.rest.RestClient session)


Copyright © 2009-2010 CodeLutin. All Rights Reserved.