Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.core.api
Class CoreInstance

java.lang.Object
  extended by org.nuxeo.ecm.core.api.CoreInstance
All Implemented Interfaces:
java.io.Serializable

public class CoreInstance
extends java.lang.Object
implements java.io.Serializable

The CoreInstance is the main access point to a repository server.

A server instance is a singleton object that exists on each client JVM but also on the server JVM. The instance on the server JVM is used to access the server locally while those on client JVMs are used to access the server remotely.

A server instance uses a CoreSessionFactory to create CoreSession instances. CoreSessionFactory objects are implementation-dependent and may be registered using extension points. See CoreSessionFactory for more details.

Thus you can use a different implementation for the local ServerConnector than the one for the remote ServerConnector.

When clients need to perform a connection to a repository, they simply open a new session using the open(String, Map) method.

When the client has done its work it must close its session by calling close(CoreSession).

This ensures correctly freeing all the resources held by the client session.

So a client session looks something like this:

 <code>
 CoreInstance server = CoreInstance.getInstance();
 CoreSession client = server.open("demo", null);
 DocumentModel root = client.getRootDocument();
 // ... do something in that session ...
 // close the client -> this is closing the core session
 server.close(client);
 </code>
 

Author:
Bogdan Stefanescu
See Also:
Serialized Form

Method Summary
 void cacheDocumentType(DocumentType docType)
           
 void close(CoreSession client)
           
 DocumentType getCachedDocumentType(java.lang.String type)
           
 CoreSessionFactory getFactory()
           
static CoreInstance getInstance()
          Gets the CoreInstance singleton.
 CoreSession getSession(java.lang.String sid)
          Gets the client bound to the given session.
 CoreSession[] getSessions()
          Deprecated. unused
 void initialize(CoreSessionFactory factory)
           
 boolean isSessionStarted(java.lang.String sid)
           
 CoreSession open(java.lang.String repositoryName, java.util.Map<java.lang.String,java.io.Serializable> context)
           
 void registerSession(java.lang.String sid, CoreSession session)
           
 CoreSession unregisterSession(java.lang.String sid)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static CoreInstance getInstance()
Gets the CoreInstance singleton.

Returns:
the server instance

getCachedDocumentType

public DocumentType getCachedDocumentType(java.lang.String type)

cacheDocumentType

public void cacheDocumentType(DocumentType docType)

open

public CoreSession open(java.lang.String repositoryName,
                        java.util.Map<java.lang.String,java.io.Serializable> context)
                 throws ClientException
Throws:
ClientException

registerSession

public void registerSession(java.lang.String sid,
                            CoreSession session)

unregisterSession

public CoreSession unregisterSession(java.lang.String sid)

close

public void close(CoreSession client)

isSessionStarted

public boolean isSessionStarted(java.lang.String sid)

getSessions

@Deprecated
public CoreSession[] getSessions()
Deprecated. unused


getSession

public CoreSession getSession(java.lang.String sid)
Gets the client bound to the given session.

Parameters:
sid - the session id
Returns:
the client

initialize

public void initialize(CoreSessionFactory factory)

getFactory

public CoreSessionFactory getFactory()

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.