com.funambol.syncclient.spap
Class AssetDAO

java.lang.Object
  extended by com.funambol.syncclient.spap.AssetDAO

public class AssetDAO
extends java.lang.Object

This class supplies the methods for use the DM like repository of the information on the present assets on the client. The DM is used with the following node structure:

 conduit
        applications
                <manufacturer>
                        <asset's name>
                                asset           (contains the information
                                                 of the asset)
                                currentVersion  (contains the information
                                                 of the version installed)
                                newVersion      (contains the information
                                                 of the new version to install)

Version:
$Id: AssetDAO.java,v 1.3 2007-12-22 18:09:17 nichele Exp $

Constructor Summary
AssetDAO()
          Constructs a new AssetDAO
 
Method Summary
 java.util.Vector getAllAsset()
          Returns the list of all asset
 Asset getAsset(java.lang.String idAsset)
          Returns the asset with the given identifier
 java.lang.String getAssetState(java.lang.String idAsset)
          Returns the state of the asset identified from the given id
 java.util.Vector listAsset(java.lang.String state)
          Returns the list of the asset with the given state.
 void removeAsset(Asset asset)
          Remove the asset from DM
 void setAsset(Asset asset, java.sql.Timestamp time)
          Save the asset.
 Asset setAssetAsNotValid(Asset asset, java.lang.Throwable cause)
          Sets the asset as NOT VALID
 Asset setAssetState(Asset asset, java.lang.String state)
          Sets the state of the asset.
 Asset setAssetState(java.lang.String idAsset, java.lang.String state)
          Sets the state of the asset identified from the given idAsset
protected  void setAssetVersion(java.lang.String manufacturer, java.lang.String name, AssetVersion assetVersion, boolean isNewVersion)
          Saving the given AssetVersion for the asset identified from the specified manufacturer and name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssetDAO

public AssetDAO()
Constructs a new AssetDAO

Method Detail

setAsset

public void setAsset(Asset asset,
                     java.sql.Timestamp time)
              throws AssetManagementException
Save the asset. The asset is saved in DM.

Parameters:
asset - asset to save
time - time of the saving
Throws:
AssetManagementException - if an error occurs during the saving

getAsset

public Asset getAsset(java.lang.String idAsset)
               throws AssetManagementException
Returns the asset with the given identifier

Parameters:
idAsset - the identifier of the asset
Returns:
the Asset with the given identifier
Throws:
AssetManagementException - if Asset not exist

setAssetState

public Asset setAssetState(java.lang.String idAsset,
                           java.lang.String state)
                    throws AssetManagementException
Sets the state of the asset identified from the given idAsset

Parameters:
idAsset - identifier of the asset of which wants to set the state
state - state of the asset
Returns:
asset with the changed state
Throws:
AssetManagementException - if an error occurs or if asset not exists

setAssetState

public Asset setAssetState(Asset asset,
                           java.lang.String state)
                    throws AssetManagementException
Sets the state of the asset.

Parameters:
asset - asset of which wants to set the state
state - state of the asset
Returns:
asset with the changed state
Throws:
AssetManagementException - if a error occurs during setting

getAllAsset

public java.util.Vector getAllAsset()
Returns the list of all asset

Returns:
the list of all asset

getAssetState

public java.lang.String getAssetState(java.lang.String idAsset)
                               throws AssetManagementException
Returns the state of the asset identified from the given id

Parameters:
idAsset - identifier of the asset
Returns:
the state of the asset
Throws:
AssetManagementException - if asset not exists

listAsset

public java.util.Vector listAsset(java.lang.String state)
Returns the list of the asset with the given state. If the given state is null, returns the list of the all asset.

Parameters:
state - the state of the wanted assets.
Returns:
the list of the asset

removeAsset

public void removeAsset(Asset asset)
                 throws AssetManagementException
Remove the asset from DM

Parameters:
asset - asset to remove
Throws:
AssetManagementException - if an error occurs

setAssetAsNotValid

public Asset setAssetAsNotValid(Asset asset,
                                java.lang.Throwable cause)
                         throws AssetManagementException
Sets the asset as NOT VALID

Parameters:
asset - asset to set as NOT VALID
cause - the cause for which the asset is not valid
Returns:
asset asset with the state changed
Throws:
AssetManagementException - if a error occurs

setAssetVersion

protected void setAssetVersion(java.lang.String manufacturer,
                               java.lang.String name,
                               AssetVersion assetVersion,
                               boolean isNewVersion)
                        throws DMException
Saving the given AssetVersion for the asset identified from the specified manufacturer and name.

If isNewVersion is true, the given version is saved as newVersion otherwise is saved as currentVersion

Parameters:
manufacturer - manufacturer of the asset to modify
name - name of the asset to modify
assetVersion - version to saving
isNewVersion - if true, save the version as newVersion, otherwise save the version as currentVersion
Throws:
DMException - if an error occurs


Copyright © 2010 Funambol. All Rights Reserved.