com.endeca.portal.data
Class MDEXState

java.lang.Object
  extended by com.endeca.portal.data.MDEXState
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class MDEXState
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

Portlet developers should avoid this class. See DataSource instead. Note that with the exception of #getQueryState() and setQueryState(QueryState) this class is not thread safe. All other getters and setters provided by this class are not synchronized.

See Also:
Serialized Form

Nested Class Summary
static class MDEXState.APIVersion
           
 
Field Summary
static java.lang.String API_VERSION_PROPERTY
           
static java.lang.String CONTEXT_PATH_PROPERTY
           
static java.lang.String CURRENTFUNCTIONS_PROPERTY
           
protected  java.lang.String dataDomainName
           
static java.lang.String DB_PROPERTY
           
static MDEXState.APIVersion DEFAULT_API_VERSION
           
static java.lang.String DEFAULT_CONTEXT_PATH
           
static com.endeca.portal.data.MDEXState.EngineVersion DEFAULT_ENGINE_VERSION
           
static java.lang.String DESCRIPTION_PROPERTY
           
 com.endeca.portal.data.MDEXState.EngineVersion engineVersion
           
protected  java.lang.String id
           
static java.lang.String ID_PROPERTY
           
static java.lang.String INCOMPLETE_COLLECTIONS_PROPERTY
           
protected  java.util.List<IncompleteCollectionState> incompleteCollections
           
protected  QueryState initialState
           
protected  java.lang.String name
           
static java.lang.String NAME_PROPERTY
           
static java.lang.String PORT_PROPERTY
           
static java.lang.String PS_OUTER_TRANSACTION_ID_PROPERTY
           
static java.lang.String PS_WORKFLOW_ID_PROPERTY
           
static java.lang.String RESTRICTED_TO_ROLES_PROPERTY
           
static java.lang.String RESTRICTED_TO_USERS_PROPERTY
           
protected  java.util.List<java.lang.String> restrictedToRoles
           
protected  java.util.List<java.lang.String> restrictedToUsers
           
static java.lang.String SERVER_PROPERTY
           
static java.lang.String SSL_CONFIG_PROPERTY
           
protected  QueryState state
           
protected  java.lang.String statusMessage
           
 
Constructor Summary
MDEXState(org.json.JSONObject configuration, javax.portlet.PortletRequest request)
          Constructs a new MDEXState from a JSONObject configuration If a request object is passed in, error messages relating to base functions and security filter LQL statements will be returned in the appropriate locale.
 
Method Summary
 MDEXState clone()
           
 java.util.Map<java.lang.String,java.util.List<AutoAppliedFilter<QueryFilter>>> getAutoAppliedFilters()
           
protected  java.util.Map<java.lang.String,CollectionBaseView> getCollectionCache(java.util.Locale locale)
          Intended to be called only by CollectionManager, which synchronizes CRUD operations on the collection cache.
protected  java.util.Map<java.lang.String,java.util.Map<java.lang.String,CollectionBaseView>> getCollectionCaches()
          Intended to be called only by CollectionManager, which synchronizes CRUD operations on the collection cache.
 com.endeca.mdex.config.services.config._2010.ConfigPort getConfigServicePort()
          Convenience method for getting the Config service port
 java.lang.String getConfigServiceURL()
          This method is only useful when the data source supports the discovery service.
 java.lang.String getContextPath()
           
 java.lang.String getDataDomainName()
           
 java.lang.String getDataSourceNotUpdatableMessage()
           
 java.lang.String getDescription()
           
 com.endeca.mdex.conversation.ConversationPort getDiscoveryServicePort()
          Convenience method for getting the Conversation service port
 java.lang.String getDiscoveryServiceURL()
           
 long getEntryVersion()
           
 javax.xml.namespace.QName getEventName()
           
 java.lang.String getId()
           
 java.util.List<IncompleteCollectionState> getIncompleteCollections()
           
 com.endeca.mdex.ingest.IngestPort getIngestPort()
          Convenience method for getting the ingest service port
 java.lang.String getIngestServiceURL()
           
 org.json.JSONObject getInitialConfiguration()
           
 QueryState getInitialQueryState(javax.portlet.PortletRequest request)
          Returns the initial QueryState associated with this MDEXState, including any valid base functions present in the MDEXState's configuration.
 boolean getIsSSLEnabled()
           
 com.endeca.mdex.eql_parser._2010.ParserPort getLQLParserPort()
          Convenience method for getting the LQL Parser service port
 java.lang.String getLQLParserServiceURL()
           
 com.endeca.endeca_server.manage._2.ManagePort getManageServicePort()
          Convenience method for getting the manage service port
 java.lang.String getManageServiceURL()
           
 java.lang.String getName()
           
 java.lang.String getOuterTransactionId()
          Get outer transaction id
 java.lang.String getPort()
           
 long getPsWorkflowId()
           
 QueryState getQueryState(javax.portlet.PortletRequest request)
           
 long getQueryStateVersion()
           
 java.util.List<java.lang.String> getRestrictedToRoles()
           
 java.util.List<java.lang.String> getRestrictedToUsers()
           
 com.endeca.mdex.sconfig._2010.SConfigPort getSConfigPort()
          Convenience method for getting the Semantic Config service port
 java.lang.String getSConfigServiceURL()
           
 java.lang.String getServer()
           
 SSLConfig getSSLConfig()
           
 java.lang.String getStatusMessage()
           
 com.endeca.mdex.transaction.TransactionPort getTransactionPort()
          Convenience method for getting the Transaction service port
 java.lang.String getTransactionServiceURL()
           
 MDEXState.APIVersion getVersion()
           
protected  java.util.Map<java.lang.String,SemanticView> getViewCache(java.util.Locale locale)
          Fetches the view cache.
protected  java.util.Map<java.lang.String,java.util.Map<java.lang.String,SemanticView>> getViewCaches()
          Fetches all of the view caches.
 boolean isAvailable()
          Checks whether the data domain represented by this MDEXState is currently available.
 boolean isAvailableByUserID(long userId)
           
 boolean isIdle()
          Checks whether a data domain is currently idle.
 boolean isOnline()
          Returns the cached availability of this data domain.
 boolean isPSCreated()
           
 boolean isUpdatable()
           
 boolean isValid()
           
 void lockTransaction()
           
 void resetQueryStateWithBaseFilter(javax.portlet.PortletRequest request)
           
 void setAutoAppliedFilters(java.util.Map<java.lang.String,java.util.List<AutoAppliedFilter<QueryFilter>>> autoAppliedFilters)
           
 void setEntryVersion(long entryVersion)
           
 void setIncompleteCollections(java.util.List<IncompleteCollectionState> incompleteCollections)
           
 void setQueryState(QueryState dss)
          Deprecated. 
 boolean supportsConfigService()
           
 boolean supportsDiscoveryService()
           
 boolean supportsFeature(Feature f)
           
 boolean supportsIngestService()
           
 boolean supportsLQLParserService()
           
 boolean supportsSConfigService()
           
 boolean supportsTransactionService()
           
 org.json.JSONObject toJSON()
           
 java.lang.String toSerializedString()
           
 java.lang.String toString()
           
 void unlockTransaction()
           
 void updateIncompleteCollectionStatus()
          Update incomplete collection status
 boolean updateStatus()
          Update the available status of this MDEXState, including a conversation-service check (which will wake an idle data domain).
 boolean updateStatus(boolean checkConversationService)
          Updates the status of this MDEXState.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

id

protected java.lang.String id

name

protected java.lang.String name

dataDomainName

protected java.lang.String dataDomainName

engineVersion

public com.endeca.portal.data.MDEXState.EngineVersion engineVersion

state

protected QueryState state

initialState

protected QueryState initialState

statusMessage

protected java.lang.String statusMessage

incompleteCollections

protected java.util.List<IncompleteCollectionState> incompleteCollections

restrictedToUsers

protected java.util.List<java.lang.String> restrictedToUsers

restrictedToRoles

protected java.util.List<java.lang.String> restrictedToRoles

SERVER_PROPERTY

public static final java.lang.String SERVER_PROPERTY
See Also:
Constant Field Values

PORT_PROPERTY

public static final java.lang.String PORT_PROPERTY
See Also:
Constant Field Values

CONTEXT_PATH_PROPERTY

public static final java.lang.String CONTEXT_PATH_PROPERTY
See Also:
Constant Field Values

SSL_CONFIG_PROPERTY

public static final java.lang.String SSL_CONFIG_PROPERTY
See Also:
Constant Field Values

NAME_PROPERTY

public static final java.lang.String NAME_PROPERTY
See Also:
Constant Field Values

DESCRIPTION_PROPERTY

public static final java.lang.String DESCRIPTION_PROPERTY
See Also:
Constant Field Values

ID_PROPERTY

public static final java.lang.String ID_PROPERTY
See Also:
Constant Field Values

DB_PROPERTY

public static final java.lang.String DB_PROPERTY
See Also:
Constant Field Values

CURRENTFUNCTIONS_PROPERTY

public static final java.lang.String CURRENTFUNCTIONS_PROPERTY
See Also:
Constant Field Values

API_VERSION_PROPERTY

public static final java.lang.String API_VERSION_PROPERTY
See Also:
Constant Field Values

RESTRICTED_TO_USERS_PROPERTY

public static final java.lang.String RESTRICTED_TO_USERS_PROPERTY
See Also:
Constant Field Values

RESTRICTED_TO_ROLES_PROPERTY

public static final java.lang.String RESTRICTED_TO_ROLES_PROPERTY
See Also:
Constant Field Values

PS_WORKFLOW_ID_PROPERTY

public static final java.lang.String PS_WORKFLOW_ID_PROPERTY
See Also:
Constant Field Values

PS_OUTER_TRANSACTION_ID_PROPERTY

public static final java.lang.String PS_OUTER_TRANSACTION_ID_PROPERTY
See Also:
Constant Field Values

INCOMPLETE_COLLECTIONS_PROPERTY

public static final java.lang.String INCOMPLETE_COLLECTIONS_PROPERTY
See Also:
Constant Field Values

DEFAULT_CONTEXT_PATH

public static final java.lang.String DEFAULT_CONTEXT_PATH
See Also:
Constant Field Values

DEFAULT_API_VERSION

public static final MDEXState.APIVersion DEFAULT_API_VERSION

DEFAULT_ENGINE_VERSION

public static final com.endeca.portal.data.MDEXState.EngineVersion DEFAULT_ENGINE_VERSION
Constructor Detail

MDEXState

public MDEXState(org.json.JSONObject configuration,
                 javax.portlet.PortletRequest request)
          throws java.lang.IllegalArgumentException
Constructs a new MDEXState from a JSONObject configuration If a request object is passed in, error messages relating to base functions and security filter LQL statements will be returned in the appropriate locale. Otherwise, they will be returned in English.

Parameters:
configuration -
request -
Throws:
java.lang.IllegalArgumentException
Method Detail

getEntryVersion

public long getEntryVersion()

getId

public java.lang.String getId()

getName

public java.lang.String getName()

getDataDomainName

public java.lang.String getDataDomainName()

getServer

public java.lang.String getServer()

getPort

public java.lang.String getPort()

getContextPath

public java.lang.String getContextPath()

getVersion

public MDEXState.APIVersion getVersion()

supportsDiscoveryService

public boolean supportsDiscoveryService()

supportsConfigService

public boolean supportsConfigService()

supportsSConfigService

public boolean supportsSConfigService()

supportsLQLParserService

public boolean supportsLQLParserService()

supportsTransactionService

public boolean supportsTransactionService()

supportsIngestService

public boolean supportsIngestService()

supportsFeature

public boolean supportsFeature(Feature f)

getSSLConfig

public SSLConfig getSSLConfig()

getIsSSLEnabled

public boolean getIsSSLEnabled()

isAvailable

public boolean isAvailable()
Checks whether the data domain represented by this MDEXState is currently available. Note that this method uses caching for positive/OK status, and if the status was previously unavailable, calls to isAvailable() will force a status check. This status check may result in the data domain becoming available, for example if it is an auto-idle domain and is woken from an idle state. To check that status without a status refresh, use isOnline().

Returns:
true if the server/data-domain is available after this call.
See Also:
isOnline(), updateStatus()

isOnline

public boolean isOnline()
Returns the cached availability of this data domain. This call relied on the previously established availability status, and will not re-test or update the status. It will not result in waking an idle data domain. If status refresh is desired, use the isAvailable() method.

Returns:
true if the data domain was available at last check
See Also:
isAvailable()

isIdle

public boolean isIdle()
Checks whether a data domain is currently idle. Performs a live-check, i.e. it always results in a call to the Manage service.

Returns:
true if the data domain is idle, false if it is active or if an exception occurs on checking.

isUpdatable

public boolean isUpdatable()

isValid

public boolean isValid()

getDescription

public java.lang.String getDescription()

getStatusMessage

public java.lang.String getStatusMessage()

getRestrictedToUsers

public java.util.List<java.lang.String> getRestrictedToUsers()

getRestrictedToRoles

public java.util.List<java.lang.String> getRestrictedToRoles()

getPsWorkflowId

public long getPsWorkflowId()

isPSCreated

public boolean isPSCreated()

setIncompleteCollections

public void setIncompleteCollections(java.util.List<IncompleteCollectionState> incompleteCollections)

getIncompleteCollections

public java.util.List<IncompleteCollectionState> getIncompleteCollections()

isAvailableByUserID

public boolean isAvailableByUserID(long userId)
Returns:
true if this data source supports is available to the user

getEventName

public javax.xml.namespace.QName getEventName()

getInitialConfiguration

public org.json.JSONObject getInitialConfiguration()

setEntryVersion

public void setEntryVersion(long entryVersion)

getQueryState

public QueryState getQueryState(javax.portlet.PortletRequest request)
Parameters:
request -
Returns:
a copy of the QueryState object which have base filter applied automatically

setQueryState

@Deprecated
public void setQueryState(QueryState dss)
Deprecated. 

Set the QueryState. In general, this should *ONLY* be called from the DataSource facade, but may need to be accessible for things like reloading bookmarks from a stored state, etc. This method isn't really deprecated... the flag is used to force compile time warnings. TODO: This needs to be undeprecated and made protected. Because the Bookmarks Portlet legitimately needs this functionality, a wrapper for this method should probably be exposed by the DataSource

Parameters:
dss -

resetQueryStateWithBaseFilter

public void resetQueryStateWithBaseFilter(javax.portlet.PortletRequest request)

getInitialQueryState

public QueryState getInitialQueryState(javax.portlet.PortletRequest request)
Returns the initial QueryState associated with this MDEXState, including any valid base functions present in the MDEXState's configuration.

Returns:
initial QueryState

getViewCache

protected java.util.Map<java.lang.String,SemanticView> getViewCache(java.util.Locale locale)
Fetches the view cache. Intended to be called only by SemanticViewManager, which synchronizes CRUD operations on the view cache.

Returns:
the view cache for the given locale

getViewCaches

protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,SemanticView>> getViewCaches()
Fetches all of the view caches. Intended to be called only by SemanticViewManager, which synchronizes CRUD operations on the view cache.

Returns:
the view cache

getCollectionCache

protected java.util.Map<java.lang.String,CollectionBaseView> getCollectionCache(java.util.Locale locale)
Intended to be called only by CollectionManager, which synchronizes CRUD operations on the collection cache.

Returns:
the collection cache for the given locale

getCollectionCaches

protected java.util.Map<java.lang.String,java.util.Map<java.lang.String,CollectionBaseView>> getCollectionCaches()
Intended to be called only by CollectionManager, which synchronizes CRUD operations on the collection cache.

Returns:
all collection caches

getDiscoveryServiceURL

public java.lang.String getDiscoveryServiceURL()

getManageServiceURL

public java.lang.String getManageServiceURL()

getConfigServiceURL

public java.lang.String getConfigServiceURL()
                                     throws java.lang.UnsupportedOperationException
This method is only useful when the data source supports the discovery service.

Returns:
the URL of the Conversation Service associated with this data source.
Throws:
java.lang.UnsupportedOperationException

getSConfigServiceURL

public java.lang.String getSConfigServiceURL()
Returns:
the URL of the Semantic Config Service associated with this data source.

getLQLParserServiceURL

public java.lang.String getLQLParserServiceURL()
Returns:
the URL of the LQL Parser Service associated with this data source.

getTransactionServiceURL

public java.lang.String getTransactionServiceURL()
Returns:
the URL of the LQL Parser Service associated with this data source.

getIngestServiceURL

public java.lang.String getIngestServiceURL()
Returns:
the URL of the data ingest Service associated with this data source.

getDiscoveryServicePort

public com.endeca.mdex.conversation.ConversationPort getDiscoveryServicePort()
Convenience method for getting the Conversation service port


getManageServicePort

public com.endeca.endeca_server.manage._2.ManagePort getManageServicePort()
Convenience method for getting the manage service port


getConfigServicePort

public com.endeca.mdex.config.services.config._2010.ConfigPort getConfigServicePort()
                                                                             throws java.lang.UnsupportedOperationException
Convenience method for getting the Config service port

Throws:
java.lang.UnsupportedOperationException

getSConfigPort

public com.endeca.mdex.sconfig._2010.SConfigPort getSConfigPort()
                                                         throws DataSourceException
Convenience method for getting the Semantic Config service port

Throws:
DataSourceException

getLQLParserPort

public com.endeca.mdex.eql_parser._2010.ParserPort getLQLParserPort()
                                                             throws DataSourceException
Convenience method for getting the LQL Parser service port

Throws:
DataSourceException

getTransactionPort

public com.endeca.mdex.transaction.TransactionPort getTransactionPort()
                                                               throws DataSourceException
Convenience method for getting the Transaction service port

Throws:
DataSourceException

getIngestPort

public com.endeca.mdex.ingest.IngestPort getIngestPort()
                                                throws DataSourceException
Convenience method for getting the ingest service port

Throws:
DataSourceException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toJSON

public org.json.JSONObject toJSON()
                           throws org.json.JSONException
Throws:
org.json.JSONException

toSerializedString

public java.lang.String toSerializedString()

clone

public MDEXState clone()
Overrides:
clone in class java.lang.Object

updateStatus

public boolean updateStatus()
Update the available status of this MDEXState, including a conversation-service check (which will wake an idle data domain).

Returns:
true if the data source is available
See Also:
updateStatus(boolean)

updateStatus

public boolean updateStatus(boolean checkConversationService)
Updates the status of this MDEXState. Only the DataSourceConfigHelper has the global reference for MDEXStates. All other utilities get a clone. Obviously, updating the clone won't update the global reference.

Parameters:
checkConversationService - whether the conversation service should also first be checked before the ping test.

getDataSourceNotUpdatableMessage

public java.lang.String getDataSourceNotUpdatableMessage()

lockTransaction

public void lockTransaction()

unlockTransaction

public void unlockTransaction()

getOuterTransactionId

public java.lang.String getOuterTransactionId()
Get outer transaction id


updateIncompleteCollectionStatus

public void updateIncompleteCollectionStatus()
Update incomplete collection status


getAutoAppliedFilters

public java.util.Map<java.lang.String,java.util.List<AutoAppliedFilter<QueryFilter>>> getAutoAppliedFilters()

setAutoAppliedFilters

public void setAutoAppliedFilters(java.util.Map<java.lang.String,java.util.List<AutoAppliedFilter<QueryFilter>>> autoAppliedFilters)

getQueryStateVersion

public long getQueryStateVersion()