org.wso2.registry.jdbc.dao
Class VersionedArtifactDAO

java.lang.Object
  extended by org.wso2.registry.jdbc.dao.VersionedArtifactDAO

public class VersionedArtifactDAO
extends java.lang.Object


Constructor Summary
VersionedArtifactDAO()
           
 
Method Summary
 void add(java.lang.String path, Artifact artifact, java.sql.Connection conn)
          Adds the given artifact to the database.
 void addProperties(long artifactID, java.util.Properties props, java.sql.Connection conn)
           
 void addResourceVersion(Artifact artifact, java.sql.Connection connection)
           
 boolean artifactExist(java.lang.String path, java.sql.Connection conn)
           
 void deleteResource(Artifact artifact, java.sql.Connection connection)
          To delete a artifact , what actualy happen here is that update the version table with the new data and artifact will not actualy removed from the table
 Artifact get(java.lang.String path, long versionNumber, java.sql.Connection conn)
          Returns the given version of the artifact.
 Artifact getArtifactByID(long artifactID, long versionNumber, java.sql.Connection conn)
           
 long getArtifactID(java.lang.String path, java.sql.Connection conn)
           
 java.lang.String[] getChildPaths(long artifcatID, long versionNumber, java.sql.Connection connection)
           
 java.util.List getChildren(long artifcatID, long versionNumber, java.sql.Connection connection)
           
 java.lang.String[] getLatestChildPaths(long artifcatID, long versionNumber, java.sql.Connection connection)
           
 long getLatestVerisonNumber(long artifactId, java.sql.Connection connection)
           
 Artifact getLatestVersion(java.lang.String path, java.sql.Connection conn)
          Returns the latest (current) version of an artifact.
 java.lang.String getParentPath(long artifcatID, long versionNumber, java.sql.Connection connection)
           
 java.lang.String[] getVersionNumbers(long artifactId, java.sql.Connection connection)
           
 void markDeleted(java.lang.String path, java.sql.Connection conn)
           
 void removeProperties(long artifactID, java.sql.Connection conn)
           
 void restore(long artifactId, long toVersion, java.sql.Connection connection)
           
 void restore2(long artifactId, long toVersion, java.sql.Connection connection)
          To restoreVersion or rollback artifcat to a given version number
 void update(java.lang.String path, Artifact artifact, java.sql.Connection conn)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VersionedArtifactDAO

public VersionedArtifactDAO()
Method Detail

get

public Artifact get(java.lang.String path,
                    long versionNumber,
                    java.sql.Connection conn)
             throws java.sql.SQLException
Returns the given version of the artifact. If artifact is a collection all child paths will be added as versioned paths in the form /a/b?v=12

Parameters:
path -
versionNumber -
conn -
Returns:
Throws:
java.sql.SQLException

getArtifactByID

public Artifact getArtifactByID(long artifactID,
                                long versionNumber,
                                java.sql.Connection conn)
                         throws java.sql.SQLException
Throws:
java.sql.SQLException

getLatestVersion

public Artifact getLatestVersion(java.lang.String path,
                                 java.sql.Connection conn)
                          throws java.sql.SQLException
Returns the latest (current) version of an artifact. If artifact is a collection, all child paths will be added as latest paths in the form /a/b

Parameters:
path -
conn -
Returns:
Throws:
java.sql.SQLException

getChildPaths

public java.lang.String[] getChildPaths(long artifcatID,
                                        long versionNumber,
                                        java.sql.Connection connection)
                                 throws java.sql.SQLException
Throws:
java.sql.SQLException

getParentPath

public java.lang.String getParentPath(long artifcatID,
                                      long versionNumber,
                                      java.sql.Connection connection)
                               throws java.sql.SQLException
Throws:
java.sql.SQLException

getLatestChildPaths

public java.lang.String[] getLatestChildPaths(long artifcatID,
                                              long versionNumber,
                                              java.sql.Connection connection)
                                       throws java.sql.SQLException
Throws:
java.sql.SQLException

getChildren

public java.util.List getChildren(long artifcatID,
                                  long versionNumber,
                                  java.sql.Connection connection)
                           throws java.sql.SQLException
Throws:
java.sql.SQLException

add

public void add(java.lang.String path,
                Artifact artifact,
                java.sql.Connection conn)
         throws java.sql.SQLException
Adds the given artifact to the database.

Parameters:
path - Path of the new artifact
artifact - New artifact
Throws:
java.sql.SQLException

update

public void update(java.lang.String path,
                   Artifact artifact,
                   java.sql.Connection conn)
            throws java.sql.SQLException
Throws:
java.sql.SQLException

markDeleted

public void markDeleted(java.lang.String path,
                        java.sql.Connection conn)
                 throws java.sql.SQLException
Throws:
java.sql.SQLException

addProperties

public void addProperties(long artifactID,
                          java.util.Properties props,
                          java.sql.Connection conn)
                   throws java.sql.SQLException
Throws:
java.sql.SQLException

removeProperties

public void removeProperties(long artifactID,
                             java.sql.Connection conn)
                      throws java.sql.SQLException
Throws:
java.sql.SQLException

artifactExist

public boolean artifactExist(java.lang.String path,
                             java.sql.Connection conn)
                      throws java.sql.SQLException
Throws:
java.sql.SQLException

getArtifactID

public long getArtifactID(java.lang.String path,
                          java.sql.Connection conn)
                   throws java.sql.SQLException
Throws:
java.sql.SQLException

addResourceVersion

public void addResourceVersion(Artifact artifact,
                               java.sql.Connection connection)
                        throws java.sql.SQLException
Throws:
java.sql.SQLException

getLatestVerisonNumber

public long getLatestVerisonNumber(long artifactId,
                                   java.sql.Connection connection)
                            throws java.sql.SQLException
Throws:
java.sql.SQLException

getVersionNumbers

public java.lang.String[] getVersionNumbers(long artifactId,
                                            java.sql.Connection connection)
                                     throws java.sql.SQLException
Throws:
java.sql.SQLException

restore

public void restore(long artifactId,
                    long toVersion,
                    java.sql.Connection connection)
             throws java.sql.SQLException
Throws:
java.sql.SQLException

restore2

public void restore2(long artifactId,
                     long toVersion,
                     java.sql.Connection connection)
              throws java.sql.SQLException
To restoreVersion or rollback artifcat to a given version number

Parameters:
artifactId - : Artifact ID
connection - : Connection to DB
toVersion - : to which version we need to restoreVersion
Throws:
java.sql.SQLException - : If something went wrong

deleteResource

public void deleteResource(Artifact artifact,
                           java.sql.Connection connection)
                    throws java.sql.SQLException
To delete a artifact , what actualy happen here is that update the version table with the new data and artifact will not actualy removed from the table

Parameters:
artifact - : Artifact to be deleted
connection - : Connection to the DB
Throws:
java.sql.SQLException - : if something went wrong


Copyright © 2007 Apache Web Services Project. All Rights Reserved.