mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Repository and version purging are working. Also deleting a bunch of left over
junk I didn't get after the merge. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3130 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -23,10 +23,11 @@
|
|||||||
<property name="connection.connection_provider">org.sciencething.cpool.ConnectionProvider</property>
|
<property name="connection.connection_provider">org.sciencething.cpool.ConnectionProvider</property>
|
||||||
<property name="cpool.size">20</property>
|
<property name="cpool.size">20</property>
|
||||||
-->
|
-->
|
||||||
<property name="c3p0.min_size">16</property>
|
<property name="c3p0.min_size">4</property>
|
||||||
<property name="c3p0.max_size">16</property>
|
<property name="c3p0.max_size">32</property>
|
||||||
<property name="c3p0.timeout">60</property>
|
<property name="c3p0.timeout">60</property>
|
||||||
<property name="c3p0.max_statements">0</property>
|
<property name="c3p0.max_statements">0</property>
|
||||||
|
<property name="c3p0.idle_test_period">60</property>
|
||||||
<property name="default_batch_fetch_size">16</property>
|
<property name="default_batch_fetch_size">16</property>
|
||||||
<property name="jdbc.batch_versioned_data">false</property>
|
<property name="jdbc.batch_versioned_data">false</property>
|
||||||
<property name="jdbc.batch_size">0</property>
|
<property name="jdbc.batch_size">0</property>
|
||||||
|
@@ -1798,4 +1798,27 @@ public class AVMServiceTest extends AVMServiceTestBase
|
|||||||
fail();
|
fail();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test purging.
|
||||||
|
*/
|
||||||
|
public void testPurge()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
setupBasicTree();
|
||||||
|
fService.purgeRepository("main");
|
||||||
|
OrphanReaper reaper = new OrphanReaper();
|
||||||
|
reaper.doBatch();
|
||||||
|
reaper.doBatch();
|
||||||
|
reaper.doBatch();
|
||||||
|
reaper.doBatch();
|
||||||
|
reaper.doBatch();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace(System.err);
|
||||||
|
fail();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -60,6 +60,11 @@ interface FileContent
|
|||||||
*/
|
*/
|
||||||
public RandomAccessFile getRandomAccess(SuperRepository superRepo, String access);
|
public RandomAccessFile getRandomAccess(SuperRepository superRepo, String access);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete the contents of this from the backing store.
|
||||||
|
*/
|
||||||
|
public void delete();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the length of the file.
|
* Get the length of the file.
|
||||||
* @param superRepo
|
* @param superRepo
|
||||||
|
@@ -200,6 +200,15 @@ class FileContentImpl implements FileContent, Serializable
|
|||||||
throw new AVMException("Could not open for random access: " + getContentPath(superRepo), ie);
|
throw new AVMException("Could not open for random access: " + getContentPath(superRepo), ie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete the contents of this file from the backing store.
|
||||||
|
*/
|
||||||
|
public void delete()
|
||||||
|
{
|
||||||
|
File file = new File(getContentPath(SuperRepository.GetInstance()));
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the length of this content.
|
* Get the length of this content.
|
||||||
|
@@ -17,6 +17,15 @@
|
|||||||
|
|
||||||
package org.alfresco.repo.avm;
|
package org.alfresco.repo.avm;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.alfresco.repo.avm.hibernate.HibernateHelper;
|
||||||
|
import org.alfresco.repo.avm.hibernate.HibernateTxn;
|
||||||
|
import org.alfresco.repo.avm.hibernate.HibernateTxnCallback;
|
||||||
|
import org.hibernate.Query;
|
||||||
|
import org.hibernate.Session;
|
||||||
|
import org.hibernate.proxy.HibernateProxy;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the background thread for reaping no longer referenced nodes
|
* This is the background thread for reaping no longer referenced nodes
|
||||||
* in the AVM repository. These orphans arise from purge operations.
|
* in the AVM repository. These orphans arise from purge operations.
|
||||||
@@ -24,6 +33,11 @@ package org.alfresco.repo.avm;
|
|||||||
*/
|
*/
|
||||||
class OrphanReaper implements Runnable
|
class OrphanReaper implements Runnable
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* The HibernateTxn instance.
|
||||||
|
*/
|
||||||
|
private HibernateTxn fTransaction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inactive base sleep interval.
|
* Inactive base sleep interval.
|
||||||
*/
|
*/
|
||||||
@@ -39,6 +53,12 @@ class OrphanReaper implements Runnable
|
|||||||
*/
|
*/
|
||||||
private int fBatchSize;
|
private int fBatchSize;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether we are currently active, ie have
|
||||||
|
* work queued up.
|
||||||
|
*/
|
||||||
|
private boolean fActive;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Flag for shutting down this.
|
* Flag for shutting down this.
|
||||||
*/
|
*/
|
||||||
@@ -54,9 +74,11 @@ class OrphanReaper implements Runnable
|
|||||||
*/
|
*/
|
||||||
public OrphanReaper()
|
public OrphanReaper()
|
||||||
{
|
{
|
||||||
|
fTransaction = new HibernateTxn(HibernateHelper.GetSessionFactory());
|
||||||
fInactiveBaseSleep = 30000;
|
fInactiveBaseSleep = 30000;
|
||||||
fActiveBaseSleep = 2000;
|
fActiveBaseSleep = 1000;
|
||||||
fBatchSize = 50;
|
fBatchSize = 50;
|
||||||
|
fActive = false;
|
||||||
fDone = false;
|
fDone = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,5 +143,135 @@ class OrphanReaper implements Runnable
|
|||||||
*/
|
*/
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
|
while (!fDone)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Thread.sleep(fActive ? fActiveBaseSleep : fInactiveBaseSleep);
|
||||||
|
}
|
||||||
|
catch (InterruptedException ie)
|
||||||
|
{
|
||||||
|
// Do nothing.
|
||||||
|
}
|
||||||
|
doBatch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is really for debugging and testing. Allows another thread to
|
||||||
|
* mark the orphan reaper busy so that it can monitor for it's being done.
|
||||||
|
*/
|
||||||
|
public void activate()
|
||||||
|
{
|
||||||
|
fActive = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See if the reaper is actively reaping.
|
||||||
|
* @return Whether this is actively reaping.
|
||||||
|
*/
|
||||||
|
public boolean isActive()
|
||||||
|
{
|
||||||
|
return fActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do a batch of cleanup work.
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void doBatch()
|
||||||
|
{
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
class HTxnCallback implements HibernateTxnCallback
|
||||||
|
{
|
||||||
|
public void perform(Session session)
|
||||||
|
{
|
||||||
|
Query query = session.getNamedQuery("FindOrphans");
|
||||||
|
query.setMaxResults(fBatchSize);
|
||||||
|
List<AVMNode> nodes = (List<AVMNode>)query.list();
|
||||||
|
if (nodes.size() == 0)
|
||||||
|
{
|
||||||
|
fActive = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (AVMNode node : nodes)
|
||||||
|
{
|
||||||
|
// Save away the ancestor and merged from fields from this node.
|
||||||
|
AVMNode ancestor = node.getAncestor();
|
||||||
|
AVMNode mergedFrom = node.getMergedFrom();
|
||||||
|
// Get all the nodes that have this node as ancestor.
|
||||||
|
query = session.createQuery("from AVMNodeImpl an where an.ancestor = :node");
|
||||||
|
query.setEntity("node", node);
|
||||||
|
List<AVMNode> descendents = (List<AVMNode>)query.list();
|
||||||
|
for (AVMNode desc : descendents)
|
||||||
|
{
|
||||||
|
desc.setAncestor(ancestor);
|
||||||
|
if (desc.getMergedFrom() == null)
|
||||||
|
{
|
||||||
|
desc.setMergedFrom(mergedFrom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Get all the nodes that have this node as mergedFrom
|
||||||
|
query = session.createQuery("from AVMNodeImpl an where an.mergedFrom = :merged");
|
||||||
|
query.setEntity("merged", node);
|
||||||
|
List<AVMNode> merged = (List<AVMNode>)query.list();
|
||||||
|
for (AVMNode merge : merged)
|
||||||
|
{
|
||||||
|
merge.setMergedFrom(ancestor);
|
||||||
|
}
|
||||||
|
// Work around Bitter Hibernate.
|
||||||
|
if (node instanceof HibernateProxy)
|
||||||
|
{
|
||||||
|
node = (AVMNode)((HibernateProxy)node).getHibernateLazyInitializer().getImplementation();
|
||||||
|
}
|
||||||
|
// Extra work for directories.
|
||||||
|
if (node instanceof DirectoryNode)
|
||||||
|
{
|
||||||
|
// First get rid of all child entries for the node.
|
||||||
|
Query delete = session.createQuery("delete ChildEntryImpl ce where ce.parent = :parent");
|
||||||
|
delete.setEntity("parent", node);
|
||||||
|
delete.executeUpdate();
|
||||||
|
// Now find all the nodes that point to this node as their
|
||||||
|
// canonical parent and null that reference out.
|
||||||
|
query = session.createQuery("from AVMNodeImpl an where an.parent = :parent");
|
||||||
|
query.setEntity("parent", node);
|
||||||
|
List<AVMNode> children = (List<AVMNode>)query.list();
|
||||||
|
for (AVMNode child : children)
|
||||||
|
{
|
||||||
|
child.setParent(null);
|
||||||
|
}
|
||||||
|
if (node instanceof LayeredDirectoryNode)
|
||||||
|
{
|
||||||
|
// More special work for layered directories.
|
||||||
|
delete = session.createQuery("delete DeletedChildImpl dc where dc.parent = :parent");
|
||||||
|
delete.setEntity("parent", node);
|
||||||
|
delete.executeUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (node instanceof PlainFileNode)
|
||||||
|
{
|
||||||
|
// FileContent should be purged if nobody else references it.
|
||||||
|
FileContent content = ((PlainFileNode)node).getContent();
|
||||||
|
if (content.getRefCount() == 1)
|
||||||
|
{
|
||||||
|
content.delete();
|
||||||
|
session.delete(content);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
session.delete(node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
HTxnCallback doit = new HTxnCallback();
|
||||||
|
fTransaction.perform(doit, true);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace(System.err);
|
||||||
|
// TODO Log this properly.
|
||||||
|
}
|
||||||
|
System.err.println("Batch took: " + (System.currentTimeMillis() - start) + "ms");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
97
source/java/org/alfresco/repo/avm/PurgeTest.java
Normal file
97
source/java/org/alfresco/repo/avm/PurgeTest.java
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2006 Alfresco, Inc.
|
||||||
|
*
|
||||||
|
* Licensed under the Mozilla Public License version 1.1
|
||||||
|
* with a permitted attribution clause. You may obtain a
|
||||||
|
* copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.alfresco.org/legal/license.txt
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
||||||
|
* either express or implied. See the License for the specific
|
||||||
|
* language governing permissions and limitations under the
|
||||||
|
* License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.alfresco.repo.avm;
|
||||||
|
|
||||||
|
import org.alfresco.repo.avm.util.BulkLoad;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the purge thread.
|
||||||
|
* @author britt
|
||||||
|
*/
|
||||||
|
public class PurgeTest extends AVMServiceTestBase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Test purging an entire repository.
|
||||||
|
*/
|
||||||
|
public void testPurgeRepository()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
OrphanReaper reaper = new OrphanReaper();
|
||||||
|
reaper.init();
|
||||||
|
setupBasicTree();
|
||||||
|
BulkLoad loader = new BulkLoad(fService);
|
||||||
|
loader.recursiveLoad("source", "main:/");
|
||||||
|
fService.createSnapshot("main");
|
||||||
|
fService.purgeRepository("main");
|
||||||
|
reaper.activate();
|
||||||
|
while (reaper.isActive())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Thread.sleep(2000);
|
||||||
|
}
|
||||||
|
catch (InterruptedException e)
|
||||||
|
{
|
||||||
|
// Do nothing.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reaper.shutDown();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace(System.err);
|
||||||
|
fail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test purging an entire repository.
|
||||||
|
*/
|
||||||
|
public void testPurgeVersion()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
OrphanReaper reaper = new OrphanReaper();
|
||||||
|
reaper.init();
|
||||||
|
setupBasicTree();
|
||||||
|
BulkLoad loader = new BulkLoad(fService);
|
||||||
|
loader.recursiveLoad("source", "main:/");
|
||||||
|
fService.createSnapshot("main");
|
||||||
|
fService.purgeVersion(2, "main");
|
||||||
|
reaper.activate();
|
||||||
|
while (reaper.isActive())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Thread.sleep(2000);
|
||||||
|
}
|
||||||
|
catch (InterruptedException e)
|
||||||
|
{
|
||||||
|
// Do nothing.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
reaper.shutDown();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace(System.err);
|
||||||
|
fail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -721,12 +721,5 @@ class RepositoryImpl implements Repository, Serializable
|
|||||||
vRoot = (VersionRoot)query.uniqueResult();
|
vRoot = (VersionRoot)query.uniqueResult();
|
||||||
fRoot = vRoot.getRoot();
|
fRoot = vRoot.getRoot();
|
||||||
}
|
}
|
||||||
query = fSuper.getSession().getNamedQuery("FindOrphans");
|
|
||||||
Iterator<AVMNode> iter = (Iterator<AVMNode>)query.iterate();
|
|
||||||
while (iter.hasNext())
|
|
||||||
{
|
|
||||||
AVMNode node = iter.next();
|
|
||||||
System.err.println(node.getId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -479,12 +479,6 @@ class SuperRepository
|
|||||||
}
|
}
|
||||||
fSession.get().flush();
|
fSession.get().flush();
|
||||||
fSession.get().delete(rep);
|
fSession.get().delete(rep);
|
||||||
query = fSession.get().getNamedQuery("FindOrphans");
|
|
||||||
List<AVMNode> nodes = (List<AVMNode>)query.list();
|
|
||||||
for (AVMNode node : nodes)
|
|
||||||
{
|
|
||||||
System.err.println(node.getId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,146 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2006 Alfresco, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Mozilla Public License version 1.1
|
|
||||||
* with a permitted attribution clause. You may obtain a
|
|
||||||
* copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.alfresco.org/legal/license.txt
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
||||||
* either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the
|
|
||||||
* License.
|
|
||||||
*/
|
|
||||||
package org.alfresco.repo.avm.hibernate;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The base Node class for the new versioning model, at least for now.
|
|
||||||
* @author britt
|
|
||||||
*/
|
|
||||||
public interface AVMNodeBean
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Set the object id of this node.
|
|
||||||
* @param id The Object ID.
|
|
||||||
*/
|
|
||||||
public void setId(long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the object id of this node.
|
|
||||||
* @return The Object ID of this node.
|
|
||||||
*/
|
|
||||||
public long getId();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the version id.
|
|
||||||
* @param id The version id of the node.
|
|
||||||
*/
|
|
||||||
public void setVersionID(int id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the version id of this node.
|
|
||||||
* @return The version id.
|
|
||||||
*/
|
|
||||||
public int getVersionID();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the parent of this node. This is only a canonical parent,
|
|
||||||
* the one that this node had at the time of its creation.
|
|
||||||
* @param parent The id of the parent node.
|
|
||||||
*/
|
|
||||||
public void setParent(DirectoryNodeBean parent);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the parent of this node.
|
|
||||||
* @return The parent of this node.
|
|
||||||
*/
|
|
||||||
public DirectoryNodeBean getParent();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the node that is this node's direct ancestor.
|
|
||||||
* @param ancestor The id of the ancestor node.
|
|
||||||
*/
|
|
||||||
public void setAncestor(AVMNodeBean ancestor);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the direct ancestor of this node.
|
|
||||||
* @return The id of the direct ancestor of this node.
|
|
||||||
*/
|
|
||||||
public AVMNodeBean getAncestor();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the node that this node was merged from.
|
|
||||||
* @param mergedFrom The id of the node from which this was merged.
|
|
||||||
*/
|
|
||||||
public void setMergedFrom(AVMNodeBean mergedFrom);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the node that this was merged from.
|
|
||||||
* @return The id of the node this was merged from.
|
|
||||||
*/
|
|
||||||
public AVMNodeBean getMergedFrom();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the branch id.
|
|
||||||
* @param branchID The branch id to set.
|
|
||||||
*/
|
|
||||||
public void setBranchID(long branchID);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the branch id of this node.
|
|
||||||
* @return The branch id of this node.
|
|
||||||
*/
|
|
||||||
public long getBranchID();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the Repository that owns this node.
|
|
||||||
* @param repository The repository that owns this node.
|
|
||||||
*/
|
|
||||||
public void setRepository(RepositoryBean repository);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Repository that owns this node.
|
|
||||||
* @return The Repository.
|
|
||||||
*/
|
|
||||||
public RepositoryBean getRepository();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set is new.
|
|
||||||
* @param isNew
|
|
||||||
*/
|
|
||||||
public void setIsNew(boolean isNew);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get is new.
|
|
||||||
* @return Whether this node is new.
|
|
||||||
*/
|
|
||||||
public boolean getIsNew();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the version (for concurrency management.)
|
|
||||||
* @param vers The version.
|
|
||||||
*/
|
|
||||||
public void setVers(long vers);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the version (for concurrency management.)
|
|
||||||
* @return The version.
|
|
||||||
*/
|
|
||||||
public long getVers();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the basic attributes.
|
|
||||||
* @param attrs The attributes to set.
|
|
||||||
*/
|
|
||||||
public void setBasicAttributes(BasicAttributesBean attrs);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the basic attributes.
|
|
||||||
* @return The attributes.
|
|
||||||
*/
|
|
||||||
public BasicAttributesBean getBasicAttributes();
|
|
||||||
}
|
|
@@ -1,298 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2006 Alfresco, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Mozilla Public License version 1.1
|
|
||||||
* with a permitted attribution clause. You may obtain a
|
|
||||||
* copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.alfresco.org/legal/license.txt
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
||||||
* either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the
|
|
||||||
* License.
|
|
||||||
*/
|
|
||||||
package org.alfresco.repo.avm.hibernate;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base interface for versioned and layered node implementation data objects.
|
|
||||||
* @author britt
|
|
||||||
*/
|
|
||||||
public class AVMNodeBeanImpl implements AVMNodeBean
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The Object ID (and Primary Key)
|
|
||||||
*/
|
|
||||||
private long fID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Version ID
|
|
||||||
*/
|
|
||||||
private int fVersionID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Branch ID
|
|
||||||
*/
|
|
||||||
private long fBranchID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The ancestor of this.
|
|
||||||
*/
|
|
||||||
private AVMNodeBean fAncestor;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The node that was merged into this.
|
|
||||||
*/
|
|
||||||
private AVMNodeBean fMergedFrom;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The id of the parent of this.
|
|
||||||
*/
|
|
||||||
private DirectoryNodeBean fParent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Repository that owns this.
|
|
||||||
*/
|
|
||||||
private RepositoryBean fRepository;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The BasicAttributes.
|
|
||||||
*/
|
|
||||||
private BasicAttributesBean fBasicAttributes;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether this node is new (and should therefore not be COWed).
|
|
||||||
*/
|
|
||||||
private boolean fIsNew;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The version number (for concurrency control).
|
|
||||||
*/
|
|
||||||
private long fVers;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Anonymous constructor.
|
|
||||||
*/
|
|
||||||
public AVMNodeBeanImpl()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rich constructor.
|
|
||||||
* @param id The ID to set.
|
|
||||||
* @param versionID The version id.
|
|
||||||
* @param branchID The branch id.
|
|
||||||
* @param ancestor The ancestor.
|
|
||||||
* @param mergedFrom The node that merged into us.
|
|
||||||
* @param parent The parent.
|
|
||||||
* @param repository The repository.
|
|
||||||
*/
|
|
||||||
public AVMNodeBeanImpl(long id,
|
|
||||||
int versionID,
|
|
||||||
long branchID,
|
|
||||||
AVMNodeBean ancestor,
|
|
||||||
AVMNodeBean mergedFrom,
|
|
||||||
DirectoryNodeBean parent,
|
|
||||||
RepositoryBean repository,
|
|
||||||
BasicAttributesBean attrs)
|
|
||||||
{
|
|
||||||
fID = id;
|
|
||||||
fVersionID = versionID;
|
|
||||||
fBranchID = branchID;
|
|
||||||
fAncestor = ancestor;
|
|
||||||
fMergedFrom = mergedFrom;
|
|
||||||
fParent = parent;
|
|
||||||
fRepository = repository;
|
|
||||||
fIsNew = true;
|
|
||||||
fBasicAttributes = attrs;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#equals(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
if (this == obj)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!(obj instanceof AVMNodeBean))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return fID == ((AVMNodeBean)obj).getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#hashCode()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return (int)fID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.AVMNode#setId(int)
|
|
||||||
*/
|
|
||||||
public void setId(long id)
|
|
||||||
{
|
|
||||||
fID = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.AVMNode#getId()
|
|
||||||
*/
|
|
||||||
public long getId()
|
|
||||||
{
|
|
||||||
return fID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.AVMNode#setVersionID(int)
|
|
||||||
*/
|
|
||||||
public void setVersionID(int id)
|
|
||||||
{
|
|
||||||
fVersionID = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.AVMNode#getVersionID()
|
|
||||||
*/
|
|
||||||
public int getVersionID()
|
|
||||||
{
|
|
||||||
return fVersionID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.AVMNode#setParent(int)
|
|
||||||
*/
|
|
||||||
public void setParent(DirectoryNodeBean parent)
|
|
||||||
{
|
|
||||||
fParent = parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.AVMNode#getParent()
|
|
||||||
*/
|
|
||||||
public DirectoryNodeBean getParent()
|
|
||||||
{
|
|
||||||
return fParent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.AVMNode#setAncestor(int)
|
|
||||||
*/
|
|
||||||
public void setAncestor(AVMNodeBean ancestor)
|
|
||||||
{
|
|
||||||
fAncestor = ancestor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.AVMNode#getAncestor()
|
|
||||||
*/
|
|
||||||
public AVMNodeBean getAncestor()
|
|
||||||
{
|
|
||||||
return fAncestor;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.AVMNode#setMergedFrom(int)
|
|
||||||
*/
|
|
||||||
public void setMergedFrom(AVMNodeBean mergedFrom)
|
|
||||||
{
|
|
||||||
fMergedFrom = mergedFrom;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.AVMNode#getMergedFrom()
|
|
||||||
*/
|
|
||||||
public AVMNodeBean getMergedFrom()
|
|
||||||
{
|
|
||||||
return fMergedFrom;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.AVMNode#setBranchID(int)
|
|
||||||
*/
|
|
||||||
public void setBranchID(long branchID)
|
|
||||||
{
|
|
||||||
fBranchID = branchID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.AVMNode#getBranchID()
|
|
||||||
*/
|
|
||||||
public long getBranchID()
|
|
||||||
{
|
|
||||||
return fBranchID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.AVMNodeBean#getRepository()
|
|
||||||
*/
|
|
||||||
public RepositoryBean getRepository()
|
|
||||||
{
|
|
||||||
return fRepository;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.AVMNodeBean#setRepository(org.alfresco.proto.avm.RepositoryBean)
|
|
||||||
*/
|
|
||||||
public void setRepository(RepositoryBean repository)
|
|
||||||
{
|
|
||||||
fRepository = repository;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.AVMNodeBean#getIsNew()
|
|
||||||
*/
|
|
||||||
public boolean getIsNew()
|
|
||||||
{
|
|
||||||
return fIsNew;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.AVMNodeBean#setIsNew(boolean)
|
|
||||||
*/
|
|
||||||
public void setIsNew(boolean isNew)
|
|
||||||
{
|
|
||||||
fIsNew = isNew;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.AVMNodeBean#getVers()
|
|
||||||
*/
|
|
||||||
public long getVers()
|
|
||||||
{
|
|
||||||
return fVers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.AVMNodeBean#setVers(java.lang.int)
|
|
||||||
*/
|
|
||||||
public void setVers(long vers)
|
|
||||||
{
|
|
||||||
fVers = vers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.AVMNodeBean#getBasicAttributes()
|
|
||||||
*/
|
|
||||||
public BasicAttributesBean getBasicAttributes()
|
|
||||||
{
|
|
||||||
return fBasicAttributes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.AVMNodeBean#setBasicAttributes(org.alfresco.repo.avm.hibernate.BasicAttributesBean)
|
|
||||||
*/
|
|
||||||
public void setBasicAttributes(BasicAttributesBean attrs)
|
|
||||||
{
|
|
||||||
fBasicAttributes = attrs;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,83 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.alfresco.repo.avm.hibernate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Ownership, timestamps, later perhaps ACLs
|
|
||||||
* @author britt
|
|
||||||
*/
|
|
||||||
public interface BasicAttributesBean
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Set the creator of the node.
|
|
||||||
* @param creator The creator to set.
|
|
||||||
*/
|
|
||||||
public void setCreator(String creator);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the creator of the node.
|
|
||||||
* @return The creator.
|
|
||||||
*/
|
|
||||||
public String getCreator();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the owner of the node.
|
|
||||||
* @param owner The owner to set.
|
|
||||||
*/
|
|
||||||
public void setOwner(String owner);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the owner of the node.
|
|
||||||
* @return The owner.
|
|
||||||
*/
|
|
||||||
public String getOwner();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the last modifier of the node.
|
|
||||||
* @param lastModifier
|
|
||||||
*/
|
|
||||||
public void setLastModifier(String lastModifier);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the last modifier of the node.
|
|
||||||
* @return The last modifier.
|
|
||||||
*/
|
|
||||||
public String getLastModifier();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the create date.
|
|
||||||
* @param createDate The date to set.
|
|
||||||
*/
|
|
||||||
public void setCreateDate(long createDate);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the create date.
|
|
||||||
* @return The create date.
|
|
||||||
*/
|
|
||||||
public long getCreateDate();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the modification date.
|
|
||||||
* @param modDate The date to set.
|
|
||||||
*/
|
|
||||||
public void setModDate(long modDate);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the modification date.
|
|
||||||
* @return The modification date.
|
|
||||||
*/
|
|
||||||
public long getModDate();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the access date of the node.
|
|
||||||
* @param accessDate The access date.
|
|
||||||
*/
|
|
||||||
public void setAccessDate(long accessDate);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the access date of the node.
|
|
||||||
* @return The access date.
|
|
||||||
*/
|
|
||||||
public long getAccessDate();
|
|
||||||
}
|
|
@@ -1,183 +0,0 @@
|
|||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
package org.alfresco.repo.avm.hibernate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implementation of the BasicAttributesBean.
|
|
||||||
* @author britt
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class BasicAttributesBeanImpl implements BasicAttributesBean
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The creator.
|
|
||||||
*/
|
|
||||||
private String fCreator;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The owner.
|
|
||||||
*/
|
|
||||||
private String fOwner;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The last modifier.
|
|
||||||
*/
|
|
||||||
private String fLastModifier;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The creation date.
|
|
||||||
*/
|
|
||||||
private long fCreateDate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The modification date.
|
|
||||||
*/
|
|
||||||
private long fModDate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The access date.
|
|
||||||
*/
|
|
||||||
private long fAccessDate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor.
|
|
||||||
*/
|
|
||||||
public BasicAttributesBeanImpl()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A Copy constructor.
|
|
||||||
* @param other
|
|
||||||
*/
|
|
||||||
public BasicAttributesBeanImpl(BasicAttributesBean other)
|
|
||||||
{
|
|
||||||
fCreator = other.getCreator();
|
|
||||||
fOwner = other.getOwner();
|
|
||||||
fLastModifier = other.getLastModifier();
|
|
||||||
fCreateDate = other.getCreateDate();
|
|
||||||
fModDate = other.getModDate();
|
|
||||||
fAccessDate = other.getAccessDate();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fill in the blanks constructor.
|
|
||||||
* @param creator
|
|
||||||
* @param owner
|
|
||||||
* @param modifier
|
|
||||||
* @param createDate
|
|
||||||
* @param modDate
|
|
||||||
* @param accessDate
|
|
||||||
*/
|
|
||||||
public BasicAttributesBeanImpl(String creator,
|
|
||||||
String owner,
|
|
||||||
String modifier,
|
|
||||||
long createDate,
|
|
||||||
long modDate,
|
|
||||||
long accessDate)
|
|
||||||
{
|
|
||||||
fCreator = creator;
|
|
||||||
fOwner = owner;
|
|
||||||
fLastModifier = modifier;
|
|
||||||
fCreateDate = createDate;
|
|
||||||
fModDate = modDate;
|
|
||||||
fAccessDate = accessDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.BasicAttributesBean#setCreator(java.lang.String)
|
|
||||||
*/
|
|
||||||
public void setCreator(String creator)
|
|
||||||
{
|
|
||||||
fCreator = creator;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.BasicAttributesBean#getCreator()
|
|
||||||
*/
|
|
||||||
public String getCreator()
|
|
||||||
{
|
|
||||||
return fCreator;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.BasicAttributesBean#setOwner(java.lang.String)
|
|
||||||
*/
|
|
||||||
public void setOwner(String owner)
|
|
||||||
{
|
|
||||||
fOwner = owner;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.BasicAttributesBean#getOwner()
|
|
||||||
*/
|
|
||||||
public String getOwner()
|
|
||||||
{
|
|
||||||
return fOwner;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.BasicAttributesBean#setLastModifier(java.lang.String)
|
|
||||||
*/
|
|
||||||
public void setLastModifier(String lastModifier)
|
|
||||||
{
|
|
||||||
fLastModifier = lastModifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.BasicAttributesBean#getLastModifier()
|
|
||||||
*/
|
|
||||||
public String getLastModifier()
|
|
||||||
{
|
|
||||||
return fLastModifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.BasicAttributesBean#setCreateDate(long)
|
|
||||||
*/
|
|
||||||
public void setCreateDate(long createDate)
|
|
||||||
{
|
|
||||||
fCreateDate = createDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.BasicAttributesBean#getCreateDate()
|
|
||||||
*/
|
|
||||||
public long getCreateDate()
|
|
||||||
{
|
|
||||||
return fCreateDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.BasicAttributesBean#setModDate(long)
|
|
||||||
*/
|
|
||||||
public void setModDate(long modDate)
|
|
||||||
{
|
|
||||||
fModDate = modDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.BasicAttributesBean#getModDate()
|
|
||||||
*/
|
|
||||||
public long getModDate()
|
|
||||||
{
|
|
||||||
return fModDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.BasicAttributesBean#setAccessDate(long)
|
|
||||||
*/
|
|
||||||
public void setAccessDate(long accessDate)
|
|
||||||
{
|
|
||||||
fAccessDate = accessDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.BasicAttributesBean#getAccessDate()
|
|
||||||
*/
|
|
||||||
public long getAccessDate()
|
|
||||||
{
|
|
||||||
return fAccessDate;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,61 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2006 Alfresco, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Mozilla Public License version 1.1
|
|
||||||
* with a permitted attribution clause. You may obtain a
|
|
||||||
* copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.alfresco.org/legal/license.txt
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
||||||
* either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the
|
|
||||||
* License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.alfresco.repo.avm.hibernate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This exists to share content across different versions.
|
|
||||||
* @author britt
|
|
||||||
*/
|
|
||||||
public interface ContentBean
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Set the object id.
|
|
||||||
* @param id The object id.
|
|
||||||
*/
|
|
||||||
public void setId(long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the object id.
|
|
||||||
* @return The object id.
|
|
||||||
*/
|
|
||||||
public long getId();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the reference count on this.
|
|
||||||
* @param refCount The reference count to set.
|
|
||||||
*/
|
|
||||||
public void setRefCount(int refCount);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the reference count on this.
|
|
||||||
* @return The reference count.
|
|
||||||
*/
|
|
||||||
public int getRefCount();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the version (for concurrency control).
|
|
||||||
* @param vers The version.
|
|
||||||
*/
|
|
||||||
public void setVers(long vers);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the version (for concurrency control).
|
|
||||||
* @return The version.
|
|
||||||
*/
|
|
||||||
public long getVers();
|
|
||||||
}
|
|
@@ -1,131 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2006 Alfresco, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Mozilla Public License version 1.1
|
|
||||||
* with a permitted attribution clause. You may obtain a
|
|
||||||
* copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.alfresco.org/legal/license.txt
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
||||||
* either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the
|
|
||||||
* License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.alfresco.repo.avm.hibernate;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shared Content between files.
|
|
||||||
* @author britt
|
|
||||||
*/
|
|
||||||
public class ContentBeanImpl implements ContentBean
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The object id.
|
|
||||||
*/
|
|
||||||
private long fID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The reference count of this id.
|
|
||||||
*/
|
|
||||||
private int fRefCount;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The version (for concurrency control).
|
|
||||||
*/
|
|
||||||
private long fVers;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor.
|
|
||||||
*/
|
|
||||||
public ContentBeanImpl()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Basic constructor with an id.
|
|
||||||
*/
|
|
||||||
public ContentBeanImpl(long id)
|
|
||||||
{
|
|
||||||
fID = id;
|
|
||||||
fRefCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.Content#setId(int)
|
|
||||||
*/
|
|
||||||
public void setId(long id)
|
|
||||||
{
|
|
||||||
fID = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.Content#getID()
|
|
||||||
*/
|
|
||||||
public long getId()
|
|
||||||
{
|
|
||||||
return fID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.Content#setRefCount(int)
|
|
||||||
*/
|
|
||||||
public void setRefCount(int refCount)
|
|
||||||
{
|
|
||||||
fRefCount = refCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.Content#getRefCount()
|
|
||||||
*/
|
|
||||||
public int getRefCount()
|
|
||||||
{
|
|
||||||
return fRefCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#equals(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
if (this == obj)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!(obj instanceof ContentBean))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return fID == ((ContentBean)obj).getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#hashCode()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return (int)fID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.ContentBean#getVers()
|
|
||||||
*/
|
|
||||||
public long getVers()
|
|
||||||
{
|
|
||||||
return fVers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.ContentBean#setVers(java.lang.int)
|
|
||||||
*/
|
|
||||||
public void setVers(long vers)
|
|
||||||
{
|
|
||||||
fVers = vers;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,123 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2006 Alfresco, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Mozilla Public License version 1.1
|
|
||||||
* with a permitted attribution clause. You may obtain a
|
|
||||||
* copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.alfresco.org/legal/license.txt
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
||||||
* either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the
|
|
||||||
* License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.alfresco.repo.avm.hibernate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This holds Directory Entries in directories.
|
|
||||||
* @author britt
|
|
||||||
*/
|
|
||||||
public class DirectoryEntry
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The type of entry a node is.
|
|
||||||
*/
|
|
||||||
private int fType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the actual child Node.
|
|
||||||
*/
|
|
||||||
private AVMNodeBean fChild;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Anonymous constructor.
|
|
||||||
*/
|
|
||||||
public DirectoryEntry()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make one from scratch.
|
|
||||||
* @param type The type.
|
|
||||||
* @param child The child node.
|
|
||||||
*/
|
|
||||||
public DirectoryEntry(int type, AVMNodeBean child)
|
|
||||||
{
|
|
||||||
fType = type;
|
|
||||||
fChild = child;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the child.
|
|
||||||
* @param child The child to set.
|
|
||||||
*/
|
|
||||||
public void setChild(AVMNodeBean child)
|
|
||||||
{
|
|
||||||
fChild = child;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the child.
|
|
||||||
* @return The child.
|
|
||||||
*/
|
|
||||||
public AVMNodeBean getChild()
|
|
||||||
{
|
|
||||||
return fChild;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the type by name.
|
|
||||||
* @param type The type.
|
|
||||||
*/
|
|
||||||
public void setType(int type)
|
|
||||||
{
|
|
||||||
fType = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the type.
|
|
||||||
*/
|
|
||||||
public int getType()
|
|
||||||
{
|
|
||||||
return fType;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#equals(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
if (this == obj)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!(obj instanceof DirectoryEntry))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return fChild.equals(((DirectoryEntry)obj).fChild);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#hashCode()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return fChild.hashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#toString()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return "[" + fType + "] " + fChild.getId();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,22 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2006 Alfresco, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Mozilla Public License version 1.1
|
|
||||||
* with a permitted attribution clause. You may obtain a
|
|
||||||
* copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.alfresco.org/legal/license.txt
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
||||||
* either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the
|
|
||||||
* License.
|
|
||||||
*/
|
|
||||||
package org.alfresco.repo.avm.hibernate;
|
|
||||||
|
|
||||||
|
|
||||||
public interface DirectoryNodeBean extends AVMNodeBean
|
|
||||||
{
|
|
||||||
}
|
|
@@ -1,54 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2006 Alfresco, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Mozilla Public License version 1.1
|
|
||||||
* with a permitted attribution clause. You may obtain a
|
|
||||||
* copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.alfresco.org/legal/license.txt
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
||||||
* either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the
|
|
||||||
* License.
|
|
||||||
*/
|
|
||||||
package org.alfresco.repo.avm.hibernate;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Base for all for all directory data types.
|
|
||||||
* @author britt
|
|
||||||
*/
|
|
||||||
public class DirectoryNodeBeanImpl extends AVMNodeBeanImpl implements DirectoryNodeBean
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Anonymous constructor.
|
|
||||||
*/
|
|
||||||
public DirectoryNodeBeanImpl()
|
|
||||||
{
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rich constructor.
|
|
||||||
* @param id The id to assign it.
|
|
||||||
* @param versionID The version id.
|
|
||||||
* @param branchID The branch id.
|
|
||||||
* @param ancestor The ancestor.
|
|
||||||
* @param mergedFrom The node that merged into us.
|
|
||||||
* @param parent The parent.
|
|
||||||
*/
|
|
||||||
public DirectoryNodeBeanImpl(long id,
|
|
||||||
int versionID,
|
|
||||||
long branchID,
|
|
||||||
AVMNodeBean ancestor,
|
|
||||||
AVMNodeBean mergedFrom,
|
|
||||||
DirectoryNodeBean parent,
|
|
||||||
RepositoryBean repository,
|
|
||||||
BasicAttributesBean attrs)
|
|
||||||
{
|
|
||||||
super(id, versionID, branchID, ancestor, mergedFrom, parent, repository, attrs);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,27 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2006 Alfresco, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Mozilla Public License version 1.1
|
|
||||||
* with a permitted attribution clause. You may obtain a
|
|
||||||
* copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.alfresco.org/legal/license.txt
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
||||||
* either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the
|
|
||||||
* License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.alfresco.repo.avm.hibernate;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Doesn't do much.
|
|
||||||
* @author britt
|
|
||||||
*/
|
|
||||||
public interface FileNodeBean extends AVMNodeBean
|
|
||||||
{
|
|
||||||
}
|
|
@@ -1,55 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2006 Alfresco, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Mozilla Public License version 1.1
|
|
||||||
* with a permitted attribution clause. You may obtain a
|
|
||||||
* copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.alfresco.org/legal/license.txt
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
||||||
* either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the
|
|
||||||
* License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.alfresco.repo.avm.hibernate;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Doesn't do much.
|
|
||||||
* @author britt
|
|
||||||
*/
|
|
||||||
public class FileNodeBeanImpl extends AVMNodeBeanImpl implements FileNodeBean
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Anonymous constructor.
|
|
||||||
*/
|
|
||||||
public FileNodeBeanImpl()
|
|
||||||
{
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rich constructor.
|
|
||||||
* @param id The ID to set.
|
|
||||||
* @param versionID The version id.
|
|
||||||
* @param branchID The branch id.
|
|
||||||
* @param ancestor The ancestor.
|
|
||||||
* @param mergedFrom The node that merged into us.
|
|
||||||
* @param parent The parent.
|
|
||||||
*/
|
|
||||||
public FileNodeBeanImpl(long id,
|
|
||||||
int versionID,
|
|
||||||
long branchID,
|
|
||||||
AVMNodeBean ancestor,
|
|
||||||
AVMNodeBean mergedFrom,
|
|
||||||
DirectoryNodeBean parent,
|
|
||||||
RepositoryBean repository,
|
|
||||||
BasicAttributesBean attrs)
|
|
||||||
{
|
|
||||||
super(id, versionID, branchID, ancestor, mergedFrom, parent, repository, attrs);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,151 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2006 Alfresco, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Mozilla Public License version 1.1
|
|
||||||
* with a permitted attribution clause. You may obtain a
|
|
||||||
* copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.alfresco.org/legal/license.txt
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
||||||
* either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the
|
|
||||||
* License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.alfresco.repo.avm.hibernate;
|
|
||||||
|
|
||||||
import org.hibernate.Session;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is a helper class that knows how to issue identifiers.
|
|
||||||
* @author britt
|
|
||||||
*/
|
|
||||||
public class Issuer
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The name of this issuer. Used as the primary key in its
|
|
||||||
* mapping.
|
|
||||||
*/
|
|
||||||
private String fName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The next number to issue.
|
|
||||||
*/
|
|
||||||
private long fNext;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The version (for concurrency control).
|
|
||||||
*/
|
|
||||||
private long fVers;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Anonymous constructor.
|
|
||||||
*/
|
|
||||||
public Issuer()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rich constructor.
|
|
||||||
* @param name The name of this issuer.
|
|
||||||
* @param next The next number to issue.
|
|
||||||
*/
|
|
||||||
public Issuer(String name, long next, Session session)
|
|
||||||
{
|
|
||||||
fName = name;
|
|
||||||
fNext = next;
|
|
||||||
session.save(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bean methods.
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the name of this issuer.
|
|
||||||
* @param name The name to set.
|
|
||||||
*/
|
|
||||||
public void setName(String name)
|
|
||||||
{
|
|
||||||
fName = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name of this issuer.
|
|
||||||
* @return The name of this issuer.
|
|
||||||
*/
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return fName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the next number.
|
|
||||||
* @param next The next number.
|
|
||||||
*/
|
|
||||||
public void setNext(long next)
|
|
||||||
{
|
|
||||||
fNext = next;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the next number.
|
|
||||||
* @return The next number.
|
|
||||||
*/
|
|
||||||
public long getNext()
|
|
||||||
{
|
|
||||||
return fNext;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Issue the next number.
|
|
||||||
* @return A serial number.
|
|
||||||
*/
|
|
||||||
public long issue()
|
|
||||||
{
|
|
||||||
return fNext++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the vers
|
|
||||||
*/
|
|
||||||
public long getVers()
|
|
||||||
{
|
|
||||||
return fVers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param vers the vers to set
|
|
||||||
*/
|
|
||||||
public void setVers(long vers)
|
|
||||||
{
|
|
||||||
fVers = vers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#equals(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
if (this == obj)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!(obj instanceof Issuer))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return fName.equals(((Issuer)obj).getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#hashCode()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return fName.hashCode();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,68 +0,0 @@
|
|||||||
package org.alfresco.repo.avm.hibernate;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
|
|
||||||
public interface LayeredDirectoryNodeBean extends DirectoryNodeBean
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Set the layer id.
|
|
||||||
* @param id The id to set.
|
|
||||||
*/
|
|
||||||
public void setLayerID(long id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the layer id.
|
|
||||||
* @return The layer id.
|
|
||||||
*/
|
|
||||||
public long getLayerID();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the indirection.
|
|
||||||
* @param indirection The indirection to set.
|
|
||||||
*/
|
|
||||||
public void setIndirection(String indirection);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the indirection.
|
|
||||||
* @return The indirection.
|
|
||||||
*/
|
|
||||||
public String getIndirection();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the added map.
|
|
||||||
* @param added The added children.
|
|
||||||
*/
|
|
||||||
public void setAdded(Map<String, DirectoryEntry> added);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the added map.
|
|
||||||
* @return The map of added children.
|
|
||||||
*/
|
|
||||||
public Map<String, DirectoryEntry> getAdded();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the Set of deleted names.
|
|
||||||
* @param deleted The deleted names.
|
|
||||||
*/
|
|
||||||
public void setDeleted(Set<String> deleted);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Set of deleted names.
|
|
||||||
* @return The Set of deleted names.
|
|
||||||
*/
|
|
||||||
public Set<String> getDeleted();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the primary indirection-ness of this.
|
|
||||||
* @param primary Whether this is a primary indirection node.
|
|
||||||
*/
|
|
||||||
public void setPrimaryIndirection(boolean primary);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the primary indirection-ness of this.
|
|
||||||
* @return Whether this is a primary indirection node.
|
|
||||||
*/
|
|
||||||
public boolean getPrimaryIndirection();
|
|
||||||
}
|
|
@@ -1,177 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2006 Alfresco, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Mozilla Public License version 1.1
|
|
||||||
* with a permitted attribution clause. You may obtain a
|
|
||||||
* copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.alfresco.org/legal/license.txt
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
||||||
* either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the
|
|
||||||
* License.
|
|
||||||
*/
|
|
||||||
package org.alfresco.repo.avm.hibernate;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Layered directories are semitransparent links to other directories.
|
|
||||||
* They maintain a delta of what has been changed relative to what they
|
|
||||||
* link to.
|
|
||||||
* @author britt
|
|
||||||
*/
|
|
||||||
public class LayeredDirectoryNodeBeanImpl extends DirectoryNodeBeanImpl implements LayeredDirectoryNodeBean
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The Layer ID.
|
|
||||||
*/
|
|
||||||
private long fLayerID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The link to the underlying directory.
|
|
||||||
*/
|
|
||||||
private String fIndirection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Map of nodes added in this layer.
|
|
||||||
*/
|
|
||||||
private Map<String, DirectoryEntry> fAdded;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Set of names that have been deleted.
|
|
||||||
*/
|
|
||||||
private Set<String> fDeleted;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether this is a primary indirection node.
|
|
||||||
*/
|
|
||||||
private boolean fPrimaryIndirection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Anonymous constructor.
|
|
||||||
*/
|
|
||||||
public LayeredDirectoryNodeBeanImpl()
|
|
||||||
{
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rich constructor.
|
|
||||||
* @param id The id to assign.
|
|
||||||
* @param versionID The version id.
|
|
||||||
* @param branchID The branch id.
|
|
||||||
* @param ancestor The ancestor.
|
|
||||||
* @param mergedFrom The node that merged into us.
|
|
||||||
* @param parent The parent node.
|
|
||||||
* @param layerID The layer id of this node.
|
|
||||||
* @param primary Whether this is a primary indirection node.
|
|
||||||
* @param indirection The indirection pointer of this.
|
|
||||||
*/
|
|
||||||
public LayeredDirectoryNodeBeanImpl(long id,
|
|
||||||
int versionID,
|
|
||||||
long branchID,
|
|
||||||
AVMNodeBean ancestor,
|
|
||||||
AVMNodeBean mergedFrom,
|
|
||||||
DirectoryNodeBean parent,
|
|
||||||
RepositoryBean repository,
|
|
||||||
BasicAttributesBean attrs,
|
|
||||||
long layerID,
|
|
||||||
boolean primary,
|
|
||||||
String indirection)
|
|
||||||
{
|
|
||||||
super(id, versionID, branchID, ancestor, mergedFrom, parent, repository, attrs);
|
|
||||||
fLayerID = layerID;
|
|
||||||
fPrimaryIndirection = primary;
|
|
||||||
fIndirection = indirection;
|
|
||||||
fAdded = new HashMap<String, DirectoryEntry>();
|
|
||||||
fDeleted = new HashSet<String>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.LayeredDirectoryNode#setLayerID(int)
|
|
||||||
*/
|
|
||||||
public void setLayerID(long id)
|
|
||||||
{
|
|
||||||
fLayerID = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.LayeredDirectoryNode#getLayerID()
|
|
||||||
*/
|
|
||||||
public long getLayerID()
|
|
||||||
{
|
|
||||||
return fLayerID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.LayeredDirectoryNode#setIndirection(java.lang.String)
|
|
||||||
*/
|
|
||||||
public void setIndirection(String indirection)
|
|
||||||
{
|
|
||||||
fIndirection = indirection;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.LayeredDirectoryNode#getIndirection()
|
|
||||||
*/
|
|
||||||
public String getIndirection()
|
|
||||||
{
|
|
||||||
return fIndirection;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.LayeredDirectoryNode#setAdded(java.util.Map)
|
|
||||||
*/
|
|
||||||
public void setAdded(Map<String, DirectoryEntry> added)
|
|
||||||
{
|
|
||||||
fAdded = added;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.LayeredDirectoryNode#getAdded()
|
|
||||||
*/
|
|
||||||
public Map<String, DirectoryEntry> getAdded()
|
|
||||||
{
|
|
||||||
return fAdded;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.LayeredDirectoryNode#setDeleted(java.util.Set)
|
|
||||||
*/
|
|
||||||
public void setDeleted(Set<String> deleted)
|
|
||||||
{
|
|
||||||
fDeleted = deleted;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.LayeredDirectoryNode#getDeleted()
|
|
||||||
*/
|
|
||||||
public Set<String> getDeleted()
|
|
||||||
{
|
|
||||||
return fDeleted;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.LayeredDirectoryNodeBean#getPrimaryIndirection()
|
|
||||||
*/
|
|
||||||
public boolean getPrimaryIndirection()
|
|
||||||
{
|
|
||||||
return fPrimaryIndirection;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.LayeredDirectoryNodeBean#setPrimaryIndirection(boolean)
|
|
||||||
*/
|
|
||||||
public void setPrimaryIndirection(boolean primary)
|
|
||||||
{
|
|
||||||
fPrimaryIndirection = primary;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2006 Alfresco, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Mozilla Public License version 1.1
|
|
||||||
* with a permitted attribution clause. You may obtain a
|
|
||||||
* copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.alfresco.org/legal/license.txt
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
||||||
* either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the
|
|
||||||
* License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.alfresco.repo.avm.hibernate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Very much like a copy on write symlink.
|
|
||||||
* @author britt
|
|
||||||
*/
|
|
||||||
public interface LayeredFileNodeBean extends FileNodeBean
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Set the indirection for this node.
|
|
||||||
* @param indirection The indirection to set.
|
|
||||||
*/
|
|
||||||
public void setIndirection(String indirection);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the indirection for this node.
|
|
||||||
* @return The indirection.
|
|
||||||
*/
|
|
||||||
public String getIndirection();
|
|
||||||
}
|
|
@@ -1,79 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2006 Alfresco, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Mozilla Public License version 1.1
|
|
||||||
* with a permitted attribution clause. You may obtain a
|
|
||||||
* copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.alfresco.org/legal/license.txt
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
||||||
* either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the
|
|
||||||
* License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.alfresco.repo.avm.hibernate;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author britt
|
|
||||||
*/
|
|
||||||
public class LayeredFileNodeBeanImpl extends FileNodeBeanImpl implements
|
|
||||||
LayeredFileNodeBean
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The indirection.
|
|
||||||
*/
|
|
||||||
private String fIndirection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Anonymous constructor.
|
|
||||||
*/
|
|
||||||
public LayeredFileNodeBeanImpl()
|
|
||||||
{
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rich constructor.
|
|
||||||
* @param id The ID to set.
|
|
||||||
* @param versionID The version id.
|
|
||||||
* @param branchID The branch id.
|
|
||||||
* @param ancestor The ancestor.
|
|
||||||
* @param mergedFrom The node that merged into us.
|
|
||||||
* @param parent The parent.
|
|
||||||
* @param indirection The indirection pointer.
|
|
||||||
*/
|
|
||||||
public LayeredFileNodeBeanImpl(long id,
|
|
||||||
int versionID,
|
|
||||||
long branchID,
|
|
||||||
AVMNodeBean ancestor,
|
|
||||||
AVMNodeBean mergedFrom,
|
|
||||||
DirectoryNodeBean parent,
|
|
||||||
RepositoryBean repository,
|
|
||||||
BasicAttributesBean attrs,
|
|
||||||
String indirection)
|
|
||||||
{
|
|
||||||
super(id, versionID, branchID, ancestor, mergedFrom, parent, repository, attrs);
|
|
||||||
fIndirection = indirection;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.LayeredFileNodeBean#setIndirection(java.lang.String)
|
|
||||||
*/
|
|
||||||
public void setIndirection(String indirection)
|
|
||||||
{
|
|
||||||
fIndirection = indirection;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.LayeredFileNodeBean#getIndirection()
|
|
||||||
*/
|
|
||||||
public String getIndirection()
|
|
||||||
{
|
|
||||||
return fIndirection;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,47 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2006 Alfresco, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Mozilla Public License version 1.1
|
|
||||||
* with a permitted attribution clause. You may obtain a
|
|
||||||
* copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.alfresco.org/legal/license.txt
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
||||||
* either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the
|
|
||||||
* License.
|
|
||||||
*/
|
|
||||||
package org.alfresco.repo.avm.hibernate;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
public interface PlainDirectoryNodeBean extends DirectoryNodeBean
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Set the child map.
|
|
||||||
* @param children The Map to set.
|
|
||||||
*/
|
|
||||||
public void setChildren(Map<String, DirectoryEntry> children);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the child map.
|
|
||||||
* @return The map of child names to IDs.
|
|
||||||
*/
|
|
||||||
public Map<String, DirectoryEntry> getChildren();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set whether this node is a root directory.
|
|
||||||
* @param isRoot
|
|
||||||
*/
|
|
||||||
public void setIsRoot(boolean isRoot);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get whether this node is a root directory.
|
|
||||||
* @return Whether it is.
|
|
||||||
*/
|
|
||||||
public boolean getIsRoot();
|
|
||||||
}
|
|
@@ -1,103 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2006 Alfresco, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Mozilla Public License version 1.1
|
|
||||||
* with a permitted attribution clause. You may obtain a
|
|
||||||
* copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.alfresco.org/legal/license.txt
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
||||||
* either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the
|
|
||||||
* License.
|
|
||||||
*/
|
|
||||||
package org.alfresco.repo.avm.hibernate;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A plain directory node is just a map of names to AVMNodes.
|
|
||||||
* @author britt
|
|
||||||
*/
|
|
||||||
public class PlainDirectoryNodeBeanImpl extends DirectoryNodeBeanImpl implements PlainDirectoryNodeBean
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The child map.
|
|
||||||
*/
|
|
||||||
private Map<String, DirectoryEntry> fChildren;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether this is a root node.
|
|
||||||
*/
|
|
||||||
private boolean fIsRoot;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Anonymous constructor.
|
|
||||||
*/
|
|
||||||
public PlainDirectoryNodeBeanImpl()
|
|
||||||
{
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rich constructor.
|
|
||||||
* @param id The id to assign it.
|
|
||||||
* @param versionID The version id.
|
|
||||||
* @param branchID The branch id.
|
|
||||||
* @param ancestor The ancestor.
|
|
||||||
* @param mergedFrom The node that merged into us.
|
|
||||||
* @param parent The parent.
|
|
||||||
* @param isRoot Whether this is a root node.
|
|
||||||
*/
|
|
||||||
public PlainDirectoryNodeBeanImpl(long id,
|
|
||||||
int versionID,
|
|
||||||
long branchID,
|
|
||||||
AVMNodeBean ancestor,
|
|
||||||
AVMNodeBean mergedFrom,
|
|
||||||
DirectoryNodeBean parent,
|
|
||||||
RepositoryBean repository,
|
|
||||||
BasicAttributesBean attrs,
|
|
||||||
boolean isRoot)
|
|
||||||
{
|
|
||||||
super(id, versionID, branchID, ancestor, mergedFrom, parent, repository, attrs);
|
|
||||||
fChildren = new HashMap<String, DirectoryEntry>();
|
|
||||||
fIsRoot = isRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.PlainDirectoryNode#setChildren(java.util.Map)
|
|
||||||
*/
|
|
||||||
public void setChildren(Map<String, DirectoryEntry> children)
|
|
||||||
{
|
|
||||||
fChildren = children;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.PlainDirectoryNode#getChildren()
|
|
||||||
*/
|
|
||||||
public Map<String, DirectoryEntry> getChildren()
|
|
||||||
{
|
|
||||||
return fChildren;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.PlainDirectoryNodeBean#getIsRoot()
|
|
||||||
*/
|
|
||||||
public boolean getIsRoot()
|
|
||||||
{
|
|
||||||
return fIsRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.PlainDirectoryNodeBean#setIsRoot(boolean)
|
|
||||||
*/
|
|
||||||
public void setIsRoot(boolean isRoot)
|
|
||||||
{
|
|
||||||
fIsRoot = isRoot;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2006 Alfresco, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Mozilla Public License version 1.1
|
|
||||||
* with a permitted attribution clause. You may obtain a
|
|
||||||
* copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.alfresco.org/legal/license.txt
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
||||||
* either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the
|
|
||||||
* License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.alfresco.repo.avm.hibernate;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A Plain File Node. Contains a possibly shared Content object.
|
|
||||||
* @author britt
|
|
||||||
*/
|
|
||||||
public interface PlainFileNodeBean extends FileNodeBean
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Set the Content object for this.
|
|
||||||
*/
|
|
||||||
public void setContent(ContentBean content);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the Content object for this.
|
|
||||||
* @return The Content object.
|
|
||||||
*/
|
|
||||||
public ContentBean getContent();
|
|
||||||
}
|
|
@@ -1,79 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2006 Alfresco, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Mozilla Public License version 1.1
|
|
||||||
* with a permitted attribution clause. You may obtain a
|
|
||||||
* copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.alfresco.org/legal/license.txt
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
||||||
* either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the
|
|
||||||
* License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.alfresco.repo.avm.hibernate;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author britt
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class PlainFileNodeBeanImpl extends FileNodeBeanImpl implements PlainFileNodeBean
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The Content object.
|
|
||||||
*/
|
|
||||||
private ContentBean fContent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Anonymous constructor.
|
|
||||||
*/
|
|
||||||
public PlainFileNodeBeanImpl()
|
|
||||||
{
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rich constructor.
|
|
||||||
* @param id The ID to set.
|
|
||||||
* @param versionID The version id.
|
|
||||||
* @param branchID The branch id.
|
|
||||||
* @param ancestor The ancestor.
|
|
||||||
* @param mergedFrom The node that merged into us.
|
|
||||||
* @param parent The parent.
|
|
||||||
* @param content The content object.
|
|
||||||
*/
|
|
||||||
public PlainFileNodeBeanImpl(long id,
|
|
||||||
int versionID,
|
|
||||||
long branchID,
|
|
||||||
AVMNodeBean ancestor,
|
|
||||||
AVMNodeBean mergedFrom,
|
|
||||||
DirectoryNodeBean parent,
|
|
||||||
RepositoryBean repository,
|
|
||||||
BasicAttributesBean attrs,
|
|
||||||
ContentBean content)
|
|
||||||
{
|
|
||||||
super(id, versionID, branchID, ancestor, mergedFrom, parent, repository, attrs);
|
|
||||||
fContent = content;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.PlainFileNodeBean#setContent(org.alfresco.repo.avm.hibernate.ContentBean)
|
|
||||||
*/
|
|
||||||
public void setContent(ContentBean content)
|
|
||||||
{
|
|
||||||
fContent = content;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.PlainFileNode#getContent()
|
|
||||||
*/
|
|
||||||
public ContentBean getContent()
|
|
||||||
{
|
|
||||||
return fContent;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,101 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2006 Alfresco, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Mozilla Public License version 1.1
|
|
||||||
* with a permitted attribution clause. You may obtain a
|
|
||||||
* copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.alfresco.org/legal/license.txt
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
||||||
* either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the
|
|
||||||
* License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.alfresco.repo.avm.hibernate;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is responsible for keeping track of the root
|
|
||||||
* directories for different versions.
|
|
||||||
* @author britt
|
|
||||||
*/
|
|
||||||
public interface RepositoryBean
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Set the name of this Repository.
|
|
||||||
* @param name The name of the respository.
|
|
||||||
*/
|
|
||||||
public void setName(String name);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the name of this Repository.
|
|
||||||
* @return The name.
|
|
||||||
*/
|
|
||||||
public String getName();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the current root.
|
|
||||||
* @param root The root to set.
|
|
||||||
*/
|
|
||||||
public void setRoot(DirectoryNodeBean root);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the current root.
|
|
||||||
* @return The current root.
|
|
||||||
*/
|
|
||||||
public DirectoryNodeBean getRoot();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the roots map.
|
|
||||||
* @param roots The Map of version ids to roots.
|
|
||||||
*/
|
|
||||||
public void setRoots(Map<Integer, DirectoryNodeBean> roots);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the roots map.
|
|
||||||
* @return The roots map.
|
|
||||||
*/
|
|
||||||
public Map<Integer, DirectoryNodeBean> getRoots();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the next version id.
|
|
||||||
* @param nextVersionID The value to set.
|
|
||||||
*/
|
|
||||||
public void setNextVersionID(int nextVersionID);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the next version id.
|
|
||||||
* @return The next version id.
|
|
||||||
*/
|
|
||||||
public int getNextVersionID();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the new nodes.
|
|
||||||
* @param newNodes The new nodes Set to set.
|
|
||||||
*/
|
|
||||||
public void setNewNodes(Set<AVMNodeBean> newNodes);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the new nodes.
|
|
||||||
* @return The new nodes associated with this Repository.
|
|
||||||
*/
|
|
||||||
public Set<AVMNodeBean> getNewNodes();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the version (for concurrency control).
|
|
||||||
* @param vers The version to set.
|
|
||||||
*/
|
|
||||||
public void setVers(long vers);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the version (for concurrency control).
|
|
||||||
* @return The version.
|
|
||||||
*/
|
|
||||||
public long getVers();
|
|
||||||
}
|
|
@@ -1,204 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2006 Alfresco, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Mozilla Public License version 1.1
|
|
||||||
* with a permitted attribution clause. You may obtain a
|
|
||||||
* copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.alfresco.org/legal/license.txt
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing,
|
|
||||||
* software distributed under the License is distributed on an
|
|
||||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
|
|
||||||
* either express or implied. See the License for the specific
|
|
||||||
* language governing permissions and limitations under the
|
|
||||||
* License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.alfresco.repo.avm.hibernate;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author britt
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class RepositoryBeanImpl implements RepositoryBean
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The name of this repository.
|
|
||||||
*/
|
|
||||||
private String fName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The current root directory.
|
|
||||||
*/
|
|
||||||
private DirectoryNodeBean fRoot;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The root directories for all versions.
|
|
||||||
*/
|
|
||||||
private Map<Integer, DirectoryNodeBean> fRoots;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The next version id.
|
|
||||||
*/
|
|
||||||
private int fNextVersionID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The nodes that are new since the last end operation.
|
|
||||||
*/
|
|
||||||
private Set<AVMNodeBean> fNewNodes;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The version (for concurrency control).
|
|
||||||
*/
|
|
||||||
private long fVers;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Anonymous constructor.
|
|
||||||
*/
|
|
||||||
public RepositoryBeanImpl()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Rich constructor
|
|
||||||
* @param name The name of the Repository.
|
|
||||||
* @param root The current root node.
|
|
||||||
*/
|
|
||||||
public RepositoryBeanImpl(String name,
|
|
||||||
DirectoryNodeBean root)
|
|
||||||
{
|
|
||||||
fName = name;
|
|
||||||
fNextVersionID = 0;
|
|
||||||
fRoot = root;
|
|
||||||
fRoots = new HashMap<Integer, DirectoryNodeBean>();
|
|
||||||
fNewNodes = new HashSet<AVMNodeBean>();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.RepositoryBean#getName()
|
|
||||||
*/
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return fName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.RepositoryBean#setName(java.lang.String)
|
|
||||||
*/
|
|
||||||
public void setName(String name)
|
|
||||||
{
|
|
||||||
fName = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.Repository#setRoot(org.alfresco.proto.avm.DirectoryNode)
|
|
||||||
*/
|
|
||||||
public void setRoot(DirectoryNodeBean root)
|
|
||||||
{
|
|
||||||
fRoot = root;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.Repository#getRoot()
|
|
||||||
*/
|
|
||||||
public DirectoryNodeBean getRoot()
|
|
||||||
{
|
|
||||||
return fRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.Repository#setRoots(java.util.Map)
|
|
||||||
*/
|
|
||||||
public void setRoots(Map<Integer, DirectoryNodeBean> roots)
|
|
||||||
{
|
|
||||||
fRoots = roots;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.Repository#getRoots()
|
|
||||||
*/
|
|
||||||
public Map<Integer, DirectoryNodeBean> getRoots()
|
|
||||||
{
|
|
||||||
return fRoots;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.Repository#setNextVersionID(int)
|
|
||||||
*/
|
|
||||||
public void setNextVersionID(int nextVersionID)
|
|
||||||
{
|
|
||||||
fNextVersionID = nextVersionID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.proto.avm.Repository#getNextVersionID()
|
|
||||||
*/
|
|
||||||
public int getNextVersionID()
|
|
||||||
{
|
|
||||||
return fNextVersionID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#equals(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj)
|
|
||||||
{
|
|
||||||
if (this == obj)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (!(obj instanceof RepositoryBean))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return fName.equals(((RepositoryBean)obj).getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see java.lang.Object#hashCode()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int hashCode()
|
|
||||||
{
|
|
||||||
return fName.hashCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.RepositoryBean#getNewNodes()
|
|
||||||
*/
|
|
||||||
public Set<AVMNodeBean> getNewNodes()
|
|
||||||
{
|
|
||||||
return fNewNodes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.RepositoryBean#setNewNodes(java.util.Set)
|
|
||||||
*/
|
|
||||||
public void setNewNodes(Set<AVMNodeBean> newNodes)
|
|
||||||
{
|
|
||||||
fNewNodes = newNodes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.RepositoryBean#getVers()
|
|
||||||
*/
|
|
||||||
public long getVers()
|
|
||||||
{
|
|
||||||
return fVers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.alfresco.repo.avm.hibernate.RepositoryBean#setVers(java.lang.int)
|
|
||||||
*/
|
|
||||||
public void setVers(long vers)
|
|
||||||
{
|
|
||||||
fVers = vers;
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user