|
|
|
@@ -22,6 +22,7 @@ import org.apache.log4j.Logger;
|
|
|
|
import org.w3c.dom.*;
|
|
|
|
import org.w3c.dom.*;
|
|
|
|
import com.silverwrist.util.*;
|
|
|
|
import com.silverwrist.util.*;
|
|
|
|
import com.silverwrist.util.xml.*;
|
|
|
|
import com.silverwrist.util.xml.*;
|
|
|
|
|
|
|
|
import com.silverwrist.dynamo.Namespaces;
|
|
|
|
import com.silverwrist.dynamo.db.NamespaceCache;
|
|
|
|
import com.silverwrist.dynamo.db.NamespaceCache;
|
|
|
|
import com.silverwrist.dynamo.db.UserManagement;
|
|
|
|
import com.silverwrist.dynamo.db.UserManagement;
|
|
|
|
import com.silverwrist.dynamo.event.*;
|
|
|
|
import com.silverwrist.dynamo.event.*;
|
|
|
|
@@ -32,6 +33,118 @@ import com.silverwrist.dynamo.util.*;
|
|
|
|
|
|
|
|
|
|
|
|
public class UniStoreManager implements NamedObject, ComponentInitialize, ComponentShutdown, UniStore
|
|
|
|
public class UniStoreManager implements NamedObject, ComponentInitialize, ComponentShutdown, UniStore
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
* Internal class for resolving message references
|
|
|
|
|
|
|
|
*--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private class UniStoreResolver implements IndexedObjectResolver
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/*====================================================================
|
|
|
|
|
|
|
|
* Constructor
|
|
|
|
|
|
|
|
*====================================================================
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UniStoreResolver()
|
|
|
|
|
|
|
|
{ // do nothing
|
|
|
|
|
|
|
|
} // end constructor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*====================================================================
|
|
|
|
|
|
|
|
* Implementations from interface IndexedObjectResolver
|
|
|
|
|
|
|
|
*====================================================================
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getResolverTag(Object obj) throws IndexException
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (obj instanceof UniStoreMessage)
|
|
|
|
|
|
|
|
return String.valueOf(((UniStoreMessage)obj).getMessageID());
|
|
|
|
|
|
|
|
else if (obj instanceof UniStorePart)
|
|
|
|
|
|
|
|
return String.valueOf(((UniStorePart)obj).getMessageID());
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
throw new IndexException(UniStoreManager.class,"UniStoreMessages","resolver.must.be.message");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // end getResolverTag
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Object resolveObject(String tag) throws IndexException
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{ // parse tag into longint, get the message
|
|
|
|
|
|
|
|
return UniStoreManager.this.getMessage(Long.parseLong(tag));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // end try
|
|
|
|
|
|
|
|
catch (NumberFormatException nfe)
|
|
|
|
|
|
|
|
{ // not a valid number
|
|
|
|
|
|
|
|
throw new IndexException(UniStoreManager.class,"UniStoreMessages","invalid.tag");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // end catch
|
|
|
|
|
|
|
|
catch (DatabaseException de)
|
|
|
|
|
|
|
|
{ // just translate it straight across
|
|
|
|
|
|
|
|
throw new IndexException(de);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // end catch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // end resolveObject
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // end class UniStoreResolver
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
* Internal class for resolving message part references
|
|
|
|
|
|
|
|
*--------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private class UniStorePartResolver implements IndexedObjectResolver
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
/*====================================================================
|
|
|
|
|
|
|
|
* Constructor
|
|
|
|
|
|
|
|
*====================================================================
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UniStorePartResolver()
|
|
|
|
|
|
|
|
{ // do nothing
|
|
|
|
|
|
|
|
} // end constructor
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*====================================================================
|
|
|
|
|
|
|
|
* Implementations from interface IndexedObjectResolver
|
|
|
|
|
|
|
|
*====================================================================
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getResolverTag(Object obj) throws IndexException
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (obj instanceof UniStoreTextPart)
|
|
|
|
|
|
|
|
{ // return the message ID and the part namespace and name
|
|
|
|
|
|
|
|
QualifiedNameKey qname = ((UniStorePart)obj).getPartIdentity();
|
|
|
|
|
|
|
|
return String.valueOf(((UniStorePart)obj).getMessageID()) + "|" + qname.getNamespace() + "|" + qname.getName();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // end if
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
throw new IndexException(UniStoreManager.class,"UniStoreMessages","resolver.must.be.textpart");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // end getResolverTag
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Object resolveObject(String tag) throws IndexException
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{ // break up the tag and resolve it into a UniStoreTextPart
|
|
|
|
|
|
|
|
String[] bits = StringUtils.split1(tag,'|',3);
|
|
|
|
|
|
|
|
UniStoreMessage msg = UniStoreManager.this.getMessage(Long.parseLong(bits[0]));
|
|
|
|
|
|
|
|
return msg.getTextPart(bits[1],bits[2]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // end try
|
|
|
|
|
|
|
|
catch (NumberFormatException nfe)
|
|
|
|
|
|
|
|
{ // not a valid number
|
|
|
|
|
|
|
|
throw new IndexException(UniStoreManager.class,"UniStoreMessages","invalid.tag");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // end catch
|
|
|
|
|
|
|
|
catch (DatabaseException de)
|
|
|
|
|
|
|
|
{ // just translate it straight across
|
|
|
|
|
|
|
|
throw new IndexException(de);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // end catch
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // end resolveObject
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // end class UniStorePartResolver
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------------
|
|
|
|
/*--------------------------------------------------------------------------------
|
|
|
|
* Static data members
|
|
|
|
* Static data members
|
|
|
|
*--------------------------------------------------------------------------------
|
|
|
|
*--------------------------------------------------------------------------------
|
|
|
|
@@ -57,6 +170,8 @@ public class UniStoreManager implements NamedObject, ComponentInitialize, Compon
|
|
|
|
private UserManagement m_users; // user management object
|
|
|
|
private UserManagement m_users; // user management object
|
|
|
|
private PostDynamicUpdate m_post; // dynamic update posting
|
|
|
|
private PostDynamicUpdate m_post; // dynamic update posting
|
|
|
|
private HardSoftCache m_msgcache; // message cache
|
|
|
|
private HardSoftCache m_msgcache; // message cache
|
|
|
|
|
|
|
|
private ComponentShutdown m_res1;
|
|
|
|
|
|
|
|
private ComponentShutdown m_res2;
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------------
|
|
|
|
/*--------------------------------------------------------------------------------
|
|
|
|
* Constructor
|
|
|
|
* Constructor
|
|
|
|
@@ -158,6 +273,13 @@ public class UniStoreManager implements NamedObject, ComponentInitialize, Compon
|
|
|
|
m_users = (UserManagement)(GetObjectUtils.getDynamoComponent(services,UserManagement.class,users_name));
|
|
|
|
m_users = (UserManagement)(GetObjectUtils.getDynamoComponent(services,UserManagement.class,users_name));
|
|
|
|
m_post = (PostDynamicUpdate)(services.queryService(PostDynamicUpdate.class));
|
|
|
|
m_post = (PostDynamicUpdate)(services.queryService(PostDynamicUpdate.class));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Register our index resolvers.
|
|
|
|
|
|
|
|
IndexManagerConfig imcfg = (IndexManagerConfig)(services.queryService(IndexManagerConfig.class));
|
|
|
|
|
|
|
|
m_res1 = imcfg.registerResolver(Namespaces.DEFAULT_INDEX_RESOLVERS_NAMESPACE,"unistore.message",
|
|
|
|
|
|
|
|
new UniStoreResolver());
|
|
|
|
|
|
|
|
m_res2 = imcfg.registerResolver(Namespaces.DEFAULT_INDEX_RESOLVERS_NAMESPACE,"unistore.message.part",
|
|
|
|
|
|
|
|
new UniStorePartResolver());
|
|
|
|
|
|
|
|
|
|
|
|
} // end initialize
|
|
|
|
} // end initialize
|
|
|
|
|
|
|
|
|
|
|
|
/*--------------------------------------------------------------------------------
|
|
|
|
/*--------------------------------------------------------------------------------
|
|
|
|
@@ -167,6 +289,10 @@ public class UniStoreManager implements NamedObject, ComponentInitialize, Compon
|
|
|
|
|
|
|
|
|
|
|
|
public void shutdown()
|
|
|
|
public void shutdown()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
m_res1.shutdown();
|
|
|
|
|
|
|
|
m_res1 = null;
|
|
|
|
|
|
|
|
m_res2.shutdown();
|
|
|
|
|
|
|
|
m_res2 = null;
|
|
|
|
m_msgcache.clear();
|
|
|
|
m_msgcache.clear();
|
|
|
|
m_post = null;
|
|
|
|
m_post = null;
|
|
|
|
m_srm = null;
|
|
|
|
m_srm = null;
|
|
|
|
|