Skip to main content



      Home
Home » Modeling » EMF » [CDO](Opening CDOSessions in a servlet)
[CDO] [message #913412] Sat, 15 September 2012 11:11 Go to next message
Eclipse UserFriend
Hi,

I would like to change some model instances over the web.

Has anyone tried opening a CDOSession in a servlet environment?

KL
Re: [CDO] In a servlet container [message #913434 is a reply to message #913412] Sat, 15 September 2012 12:45 Go to previous messageGo to next message
Eclipse UserFriend
Am 15.09.2012 17:11, schrieb Kenny Lee:
> Hi,
>
> I would like to change some model instances over the web.
>
> Has anyone tried opening a CDOSession in a servlet environment?
I've done that a couple of months ago. Here's some code that might help:

/**
* @author Eike Stepper
*/
public interface CDOService
{
public CDOView getView();

public CDOTransaction openTransaction();

public <T extends CDOObject> Object modify(T object, ITransactionalOperation<T> operation) throws CommitException;

public <T extends CDOObject> T modify(ITransactionalOperation<T> operation) throws CommitException;

/**
* @author Eike Stepper
*/
public interface ITransactionalOperation<T extends CDOObject>
{
public Object execute(T object, CDOTransaction transaction);
}
}

/**
* @author Eike Stepper
*/
public abstract class AbstractCDOService extends AbstractContextService implements CDOService
{
public static final String EXTERNAL_REPOSITORY_NAME = "external";

public static final String EXTERNAL_REPOSITORY_DIR = "externalRepositoryDir";

public static final String EXTERNAL_PORT = "externalPort";

public static final String SERVER_BROWSER_PORT = "serverBrowserPort";

public static final String ACCEPTOR_NAME = "default";

private CDOSession session;

private CDOView view;

public AbstractCDOService()
{
}

public CDOSession getSession()
{
return session;
}

@Override
public CDOView getView()
{
return view;
}

@Override
public CDOTransaction openTransaction()
{
return session.openTransaction();
}

@Override
public <T extends CDOObject> Object modify(T object, ITransactionalOperation<T> operation) throws CommitException
{
CDOTransaction transaction = session.openTransaction();

try
{
T transactionalObject = object == null ? null : transaction.getObject(object);
Object result = operation.execute(transactionalObject, transaction);

CDOCommitInfo commitInfo = transaction.commit();
view.waitForUpdate(commitInfo.getTimeStamp());

if (result instanceof CDOObject)
{
return view.getObject((CDOObject)result);
}

return result;
}
finally
{
transaction.close();
}
}

@Override
public <T extends CDOObject> T modify(ITransactionalOperation<T> operation) throws CommitException
{
@SuppressWarnings("unchecked")
T result = (T)modify((T)null, operation);
return result;
}

@Override
protected void init(ServletContext context)
{
IManagedContainer container = createContainer();

// Repository
JdbcDataSource dataSource = createDataSource(context);
IDBStore store = createStore(dataSource);
IRepository repository = createRepository(store);
CDOServerUtil.addRepository(container, repository);

// Server Browser
String serverBrowserPort = context.getInitParameter(SERVER_BROWSER_PORT);
if (serverBrowserPort != null)
{
register(container.getElement("org.eclipse.emf.cdo.server.browsers", "default", serverBrowserPort));
}

// External Connection
String externalPort = context.getInitParameter(EXTERNAL_PORT);
if (externalPort != null)
{
register(TCPUtil.getAcceptor(container, "0.0.0.0:" + externalPort));
}

// Internal Connection
register(JVMUtil.getAcceptor(container, ACCEPTOR_NAME));
IConnector connector = register(JVMUtil.getConnector(container, ACCEPTOR_NAME));

// Session
session = createSession(connector);

// View
view = createView();
}

protected IManagedContainer createContainer()
{
IManagedContainer container = register(ContainerUtil.createContainer());

Net4jUtil.prepareContainer(container);
JVMUtil.prepareContainer(container);
TCPUtil.prepareContainer(container);
CDONet4jServerUtil.prepareContainer(container);
CDODBUtil.prepareContainer(container);
container.registerFactory(new CDOServerBrowser.ContainerBased.Factory(container));

container.activate();
return container;
}

protected JdbcDataSource createDataSource(ServletContext context)
{
String databaseFolder = context.getInitParameter(EXTERNAL_REPOSITORY_DIR);
JdbcDataSource dataSource = register(new JdbcDataSource());
dataSource.setURL("jdbc:h2:" + databaseFolder);
return dataSource;
}

protected IDBStore createStore(DataSource dataSource)
{
IMappingStrategy mappingStrategy = CDODBUtil.createHorizontalMappingStrategy(false, false);
IDBAdapter dbAdapter = new H2Adapter();
IDBConnectionProvider dbConnectionProvider = DBUtil.createConnectionProvider(dataSource);
return CDODBUtil.createStore(mappingStrategy, dbAdapter, dbConnectionProvider);
}

protected IRepository createRepository(IStore store)
{
Map<String, String> props = new HashMap<String, String>();
props.put(IRepository.Props.OVERRIDE_UUID, "");
props.put(IRepository.Props.SUPPORTING_AUDITS, "false");
props.put(IRepository.Props.SUPPORTING_BRANCHES, "false");
return register(CDOServerUtil.createRepository(EXTERNAL_REPOSITORY_NAME, store, props));
}

protected CDOSession createSession(IConnector connector)
{
CDONet4jSessionConfiguration configuration = CDONet4jUtil.createNet4jSessionConfiguration();
configuration.setConnector(connector);
configuration.setRepositoryName(EXTERNAL_REPOSITORY_NAME);
configuration.setRevisionManager(CDORevisionUtil.createRevisionManager(CDORevisionCache.NOOP));

CDOSession session = register(configuration.openNet4jSession());
session.options().setPassiveUpdateMode(PassiveUpdateMode.CHANGES);

return session;
}

protected CDOView createView()
{
return session.openView();
}
}

/**
* @author Eike Stepper
*/
public abstract class AbstractContextService implements ServletContextListener
{
private final List<Object> dependencies = new ArrayList<Object>();

public AbstractContextService()
{
}

@Override
public final void contextInitialized(ServletContextEvent event)
{
try
{
init(event.getServletContext());
setInstance(this);
}
catch (Error ex)
{
ex.printStackTrace();
throw ex;
}
catch (RuntimeException ex)
{
ex.printStackTrace();
throw ex;
}
}

@Override
public final void contextDestroyed(ServletContextEvent event)
{
try
{
setInstance(null);
destroy();
}
catch (Error ex)
{
ex.printStackTrace();
throw ex;
}
catch (RuntimeException ex)
{
ex.printStackTrace();
throw ex;
}
}

protected abstract void setInstance(AbstractContextService instance);

protected abstract void init(ServletContext context);

protected void destroy()
{
for (int i = dependencies.size() - 1; i >= 0; --i)
{
Object dependency = dependencies.get(i);
LifecycleUtil.deactivate(dependency);
}

dependencies.clear();
}

protected final <T> T register(T dependency)
{
if (dependency instanceof DataSource && !(dependency instanceof LifecycleDataSource))
{
register(new LifecycleDataSource((DataSource)dependency));
}
else
{
dependencies.add(dependency);
}

return dependency;
}
}

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] In a servlet container [message #913437 is a reply to message #913434] Sat, 15 September 2012 12:48 Go to previous messageGo to next message
Eclipse UserFriend
Instead of connecting to an external CDO repository you can of course also embed the repository into the servlet
container and use a JVM acceptor/connector pair. That would be slightly faster but the repository was only accessible
through the container.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] In a servlet container [message #914511 is a reply to message #913437] Sun, 16 September 2012 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks eike,

Any examples of embedded repository into the web container?

Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
Something like Hibernate's open session in view concept.

I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.

KL
Re: [CDO] In a servlet container [message #914543 is a reply to message #913437] Sun, 16 September 2012 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks eike,

Any examples of embedded repository into the web container?

Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
Something like Hibernate's open session in view concept.

I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.

KL
Re: [CDO] In a servlet container [message #914569 is a reply to message #913437] Sun, 16 September 2012 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks eike,

Any examples of embedded repository into the web container?

Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
Something like Hibernate's open session in view concept.

I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.

KL
Re: [CDO] In a servlet container [message #914595 is a reply to message #913437] Sun, 16 September 2012 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks eike,

Any examples of embedded repository into the web container?

Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
Something like Hibernate's open session in view concept.

I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.

KL
Re: [CDO] In a servlet container [message #914621 is a reply to message #913437] Sun, 16 September 2012 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks eike,

Any examples of embedded repository into the web container?

Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
Something like Hibernate's open session in view concept.

I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.

KL
Re: [CDO] In a servlet container [message #914647 is a reply to message #913437] Sun, 16 September 2012 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks eike,

Any examples of embedded repository into the web container?

Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
Something like Hibernate's open session in view concept.

I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.

KL
Re: [CDO] In a servlet container [message #914673 is a reply to message #913437] Sun, 16 September 2012 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks eike,

Any examples of embedded repository into the web container?

Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
Something like Hibernate's open session in view concept.

I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.

KL
Re: [CDO] In a servlet container [message #914699 is a reply to message #913437] Sun, 16 September 2012 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks eike,

Any examples of embedded repository into the web container?

Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
Something like Hibernate's open session in view concept.

I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.

KL
Re: [CDO] In a servlet container [message #914725 is a reply to message #913437] Sun, 16 September 2012 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks eike,

Any examples of embedded repository into the web container?

Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
Something like Hibernate's open session in view concept.

I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.

KL
Re: [CDO] In a servlet container [message #914751 is a reply to message #913437] Sun, 16 September 2012 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks eike,

Any examples of embedded repository into the web container?

Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
Something like Hibernate's open session in view concept.

I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.

KL
Re: [CDO] In a servlet container [message #914752 is a reply to message #914751] Sun, 16 September 2012 01:13 Go to previous messageGo to next message
Eclipse UserFriend
Am 16.09.2012 06:31, schrieb Kenny Lee:
> Thanks eike,
>
> Any examples of embedded repository into the web container?
You can assemble it from the shipped "CDO Electronic Restaurant Example":

http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server/src/org/gastro/internal/server/OM.java
http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server.web/src/org/gastro/server/internal/web/GastroServlet.java

> Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
> Something like Hibernate's open session in view concept.
From a CDO perspective I see nothing that speaks against it. I'm not a total web expert, though. Does it require to
"Serialize" statful application components (CDOSession or CDOTransaction)? That would be problematic. Not sure how
Hibernate does this.

> I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.
I've used CDO with Vaadin and Liferay and there it was easy, IIRC.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] In a servlet container [message #914778 is a reply to message #913437] Sun, 16 September 2012 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks eike,

Any examples of embedded repository into the web container?

Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
Something like Hibernate's open session in view concept.

I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.

KL
Re: [CDO] In a servlet container [message #914779 is a reply to message #914778] Sun, 16 September 2012 01:13 Go to previous messageGo to next message
Eclipse UserFriend
Am 16.09.2012 06:31, schrieb Kenny Lee:
> Thanks eike,
>
> Any examples of embedded repository into the web container?
You can assemble it from the shipped "CDO Electronic Restaurant Example":

http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server/src/org/gastro/internal/server/OM.java
http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server.web/src/org/gastro/server/internal/web/GastroServlet.java

> Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
> Something like Hibernate's open session in view concept.
From a CDO perspective I see nothing that speaks against it. I'm not a total web expert, though. Does it require to
"Serialize" statful application components (CDOSession or CDOTransaction)? That would be problematic. Not sure how
Hibernate does this.

> I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.
I've used CDO with Vaadin and Liferay and there it was easy, IIRC.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] In a servlet container [message #914805 is a reply to message #913437] Sun, 16 September 2012 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks eike,

Any examples of embedded repository into the web container?

Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
Something like Hibernate's open session in view concept.

I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.

KL
Re: [CDO] In a servlet container [message #914806 is a reply to message #914805] Sun, 16 September 2012 01:13 Go to previous messageGo to next message
Eclipse UserFriend
Am 16.09.2012 06:31, schrieb Kenny Lee:
> Thanks eike,
>
> Any examples of embedded repository into the web container?
You can assemble it from the shipped "CDO Electronic Restaurant Example":

http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server/src/org/gastro/internal/server/OM.java
http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server.web/src/org/gastro/server/internal/web/GastroServlet.java

> Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
> Something like Hibernate's open session in view concept.
From a CDO perspective I see nothing that speaks against it. I'm not a total web expert, though. Does it require to
"Serialize" statful application components (CDOSession or CDOTransaction)? That would be problematic. Not sure how
Hibernate does this.

> I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.
I've used CDO with Vaadin and Liferay and there it was easy, IIRC.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] In a servlet container [message #914832 is a reply to message #913437] Sun, 16 September 2012 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks eike,

Any examples of embedded repository into the web container?

Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
Something like Hibernate's open session in view concept.

I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.

KL
Re: [CDO] In a servlet container [message #914833 is a reply to message #914832] Sun, 16 September 2012 01:13 Go to previous messageGo to next message
Eclipse UserFriend
Am 16.09.2012 06:31, schrieb Kenny Lee:
> Thanks eike,
>
> Any examples of embedded repository into the web container?
You can assemble it from the shipped "CDO Electronic Restaurant Example":

http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server/src/org/gastro/internal/server/OM.java
http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server.web/src/org/gastro/server/internal/web/GastroServlet.java

> Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
> Something like Hibernate's open session in view concept.
From a CDO perspective I see nothing that speaks against it. I'm not a total web expert, though. Does it require to
"Serialize" statful application components (CDOSession or CDOTransaction)? That would be problematic. Not sure how
Hibernate does this.

> I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.
I've used CDO with Vaadin and Liferay and there it was easy, IIRC.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] In a servlet container [message #914859 is a reply to message #913437] Sun, 16 September 2012 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks eike,

Any examples of embedded repository into the web container?

Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
Something like Hibernate's open session in view concept.

I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.

KL
Re: [CDO] In a servlet container [message #914860 is a reply to message #914859] Sun, 16 September 2012 01:13 Go to previous messageGo to next message
Eclipse UserFriend
Am 16.09.2012 06:31, schrieb Kenny Lee:
> Thanks eike,
>
> Any examples of embedded repository into the web container?
You can assemble it from the shipped "CDO Electronic Restaurant Example":

http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server/src/org/gastro/internal/server/OM.java
http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server.web/src/org/gastro/server/internal/web/GastroServlet.java

> Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
> Something like Hibernate's open session in view concept.
From a CDO perspective I see nothing that speaks against it. I'm not a total web expert, though. Does it require to
"Serialize" statful application components (CDOSession or CDOTransaction)? That would be problematic. Not sure how
Hibernate does this.

> I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.
I've used CDO with Vaadin and Liferay and there it was easy, IIRC.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] In a servlet container [message #914883 is a reply to message #913437] Sun, 16 September 2012 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks eike,

Any examples of embedded repository into the web container?

Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
Something like Hibernate's open session in view concept.

I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.

KL
Re: [CDO] In a servlet container [message #914884 is a reply to message #914883] Sun, 16 September 2012 01:13 Go to previous messageGo to next message
Eclipse UserFriend
Am 16.09.2012 06:31, schrieb Kenny Lee:
> Thanks eike,
>
> Any examples of embedded repository into the web container?
You can assemble it from the shipped "CDO Electronic Restaurant Example":

http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server/src/org/gastro/internal/server/OM.java
http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server.web/src/org/gastro/server/internal/web/GastroServlet.java

> Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
> Something like Hibernate's open session in view concept.
From a CDO perspective I see nothing that speaks against it. I'm not a total web expert, though. Does it require to
"Serialize" statful application components (CDOSession or CDOTransaction)? That would be problematic. Not sure how
Hibernate does this.

> I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.
I've used CDO with Vaadin and Liferay and there it was easy, IIRC.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] In a servlet container [message #914907 is a reply to message #913437] Sun, 16 September 2012 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks eike,

Any examples of embedded repository into the web container?

Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
Something like Hibernate's open session in view concept.

I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.

KL
Re: [CDO] In a servlet container [message #914908 is a reply to message #914907] Sun, 16 September 2012 01:13 Go to previous messageGo to next message
Eclipse UserFriend
Am 16.09.2012 06:31, schrieb Kenny Lee:
> Thanks eike,
>
> Any examples of embedded repository into the web container?
You can assemble it from the shipped "CDO Electronic Restaurant Example":

http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server/src/org/gastro/internal/server/OM.java
http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server.web/src/org/gastro/server/internal/web/GastroServlet.java

> Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
> Something like Hibernate's open session in view concept.
From a CDO perspective I see nothing that speaks against it. I'm not a total web expert, though. Does it require to
"Serialize" statful application components (CDOSession or CDOTransaction)? That would be problematic. Not sure how
Hibernate does this.

> I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.
I've used CDO with Vaadin and Liferay and there it was easy, IIRC.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] In a servlet container [message #914928 is a reply to message #913437] Sun, 16 September 2012 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks eike,

Any examples of embedded repository into the web container?

Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
Something like Hibernate's open session in view concept.

I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.

KL
Re: [CDO] In a servlet container [message #914929 is a reply to message #914928] Sun, 16 September 2012 01:13 Go to previous messageGo to next message
Eclipse UserFriend
Am 16.09.2012 06:31, schrieb Kenny Lee:
> Thanks eike,
>
> Any examples of embedded repository into the web container?
You can assemble it from the shipped "CDO Electronic Restaurant Example":

http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server/src/org/gastro/internal/server/OM.java
http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server.web/src/org/gastro/server/internal/web/GastroServlet.java

> Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
> Something like Hibernate's open session in view concept.
From a CDO perspective I see nothing that speaks against it. I'm not a total web expert, though. Does it require to
"Serialize" statful application components (CDOSession or CDOTransaction)? That would be problematic. Not sure how
Hibernate does this.

> I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.
I've used CDO with Vaadin and Liferay and there it was easy, IIRC.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] In a servlet container [message #914945 is a reply to message #913437] Sun, 16 September 2012 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks eike,

Any examples of embedded repository into the web container?

Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
Something like Hibernate's open session in view concept.

I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.

KL
Re: [CDO] In a servlet container [message #914946 is a reply to message #914945] Sun, 16 September 2012 01:13 Go to previous messageGo to next message
Eclipse UserFriend
Am 16.09.2012 06:31, schrieb Kenny Lee:
> Thanks eike,
>
> Any examples of embedded repository into the web container?
You can assemble it from the shipped "CDO Electronic Restaurant Example":

http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server/src/org/gastro/internal/server/OM.java
http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server.web/src/org/gastro/server/internal/web/GastroServlet.java

> Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
> Something like Hibernate's open session in view concept.
From a CDO perspective I see nothing that speaks against it. I'm not a total web expert, though. Does it require to
"Serialize" statful application components (CDOSession or CDOTransaction)? That would be problematic. Not sure how
Hibernate does this.

> I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.
I've used CDO with Vaadin and Liferay and there it was easy, IIRC.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] In a servlet container [message #914960 is a reply to message #913437] Sun, 16 September 2012 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks eike,

Any examples of embedded repository into the web container?

Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
Something like Hibernate's open session in view concept.

I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.

KL
Re: [CDO] In a servlet container [message #914961 is a reply to message #914960] Sun, 16 September 2012 01:13 Go to previous messageGo to next message
Eclipse UserFriend
Am 16.09.2012 06:31, schrieb Kenny Lee:
> Thanks eike,
>
> Any examples of embedded repository into the web container?
You can assemble it from the shipped "CDO Electronic Restaurant Example":

http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server/src/org/gastro/internal/server/OM.java
http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server.web/src/org/gastro/server/internal/web/GastroServlet.java

> Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
> Something like Hibernate's open session in view concept.
From a CDO perspective I see nothing that speaks against it. I'm not a total web expert, though. Does it require to
"Serialize" statful application components (CDOSession or CDOTransaction)? That would be problematic. Not sure how
Hibernate does this.

> I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.
I've used CDO with Vaadin and Liferay and there it was easy, IIRC.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] In a servlet container [message #914963 is a reply to message #913437] Sun, 16 September 2012 02:04 Go to previous messageGo to next message
Eclipse UserFriend
Hi Eike,

Any examples on that embedment?

Was thinking of opening a CDOSession/Transaction and putting it in a HttpSession. Wonder if that is a good idea.
Basically a user can make multiple modifications to a model, but only commit when he logout.

KL
Re: [CDO] In a servlet container [message #914975 is a reply to message #913437] Sun, 16 September 2012 02:06 Go to previous messageGo to next message
Eclipse UserFriend
Hi Eike,

Any examples on that embedment?

Was thinking of opening a CDOSession/Transaction and putting it in a HttpSession. Wonder if that is a good idea.
Basically a user can make multiple modifications to a model, but only commit when he logout.

KL
Re: [CDO] In a servlet container [message #914976 is a reply to message #913437] Sun, 16 September 2012 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks eike,

Any examples of embedded repository into the web container?

Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
Something like Hibernate's open session in view concept.

I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.

KL
Re: [CDO] In a servlet container [message #914977 is a reply to message #914976] Sun, 16 September 2012 01:13 Go to previous messageGo to next message
Eclipse UserFriend
Am 16.09.2012 06:31, schrieb Kenny Lee:
> Thanks eike,
>
> Any examples of embedded repository into the web container?
You can assemble it from the shipped "CDO Electronic Restaurant Example":

http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server/src/org/gastro/internal/server/OM.java
http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server.web/src/org/gastro/server/internal/web/GastroServlet.java

> Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
> Something like Hibernate's open session in view concept.
From a CDO perspective I see nothing that speaks against it. I'm not a total web expert, though. Does it require to
"Serialize" statful application components (CDOSession or CDOTransaction)? That would be problematic. Not sure how
Hibernate does this.

> I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.
I've used CDO with Vaadin and Liferay and there it was easy, IIRC.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] In a servlet container [message #914981 is a reply to message #913437] Sun, 16 September 2012 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks eike,

Any examples of embedded repository into the web container?

Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
Something like Hibernate's open session in view concept.

I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.

KL
Re: [CDO] In a servlet container [message #914982 is a reply to message #914981] Sun, 16 September 2012 01:13 Go to previous messageGo to next message
Eclipse UserFriend
Am 16.09.2012 06:31, schrieb Kenny Lee:
> Thanks eike,
>
> Any examples of embedded repository into the web container?
You can assemble it from the shipped "CDO Electronic Restaurant Example":

http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server/src/org/gastro/internal/server/OM.java
http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server.web/src/org/gastro/server/internal/web/GastroServlet.java

> Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
> Something like Hibernate's open session in view concept.
From a CDO perspective I see nothing that speaks against it. I'm not a total web expert, though. Does it require to
"Serialize" statful application components (CDOSession or CDOTransaction)? That would be problematic. Not sure how
Hibernate does this.

> I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.
I've used CDO with Vaadin and Liferay and there it was easy, IIRC.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] In a servlet container [message #914984 is a reply to message #913437] Sun, 16 September 2012 02:04 Go to previous messageGo to next message
Eclipse UserFriend
Hi Eike,

Any examples on that embedment?

Was thinking of opening a CDOSession/Transaction and putting it in a HttpSession. Wonder if that is a good idea.
Basically a user can make multiple modifications to a model, but only commit when he logout.

KL
Re: [CDO] In a servlet container [message #914985 is a reply to message #913437] Sun, 16 September 2012 02:06 Go to previous messageGo to next message
Eclipse UserFriend
Hi Eike,

Any examples on that embedment?

Was thinking of opening a CDOSession/Transaction and putting it in a HttpSession. Wonder if that is a good idea.
Basically a user can make multiple modifications to a model, but only commit when he logout.

KL
Re: [CDO] In a servlet container [message #914989 is a reply to message #913437] Sun, 16 September 2012 00:31 Go to previous messageGo to next message
Eclipse UserFriend
Thanks eike,

Any examples of embedded repository into the web container?

Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
Something like Hibernate's open session in view concept.

I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.

KL
Re: [CDO] In a servlet container [message #914990 is a reply to message #914989] Sun, 16 September 2012 01:13 Go to previous messageGo to next message
Eclipse UserFriend
Am 16.09.2012 06:31, schrieb Kenny Lee:
> Thanks eike,
>
> Any examples of embedded repository into the web container?
You can assemble it from the shipped "CDO Electronic Restaurant Example":

http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server/src/org/gastro/internal/server/OM.java
http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server.web/src/org/gastro/server/internal/web/GastroServlet.java

> Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
> Something like Hibernate's open session in view concept.
From a CDO perspective I see nothing that speaks against it. I'm not a total web expert, though. Does it require to
"Serialize" statful application components (CDOSession or CDOTransaction)? That would be problematic. Not sure how
Hibernate does this.

> I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.
I've used CDO with Vaadin and Liferay and there it was easy, IIRC.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] In a servlet container [message #914992 is a reply to message #913437] Sun, 16 September 2012 02:04 Go to previous messageGo to next message
Eclipse UserFriend
Hi Eike,

Any examples on that embedment?

Was thinking of opening a CDOSession/Transaction and putting it in a HttpSession. Wonder if that is a good idea.
Basically a user can make multiple modifications to a model, but only commit when he logout.

KL
Re: [CDO] In a servlet container [message #914993 is a reply to message #913437] Sun, 16 September 2012 02:06 Go to previous messageGo to next message
Eclipse UserFriend
Hi Eike,

Any examples on that embedment?

Was thinking of opening a CDOSession/Transaction and putting it in a HttpSession. Wonder if that is a good idea.
Basically a user can make multiple modifications to a model, but only commit when he logout.

KL
Re: [CDO] In a servlet container [message #914997 is a reply to message #914989] Sun, 16 September 2012 01:13 Go to previous messageGo to next message
Eclipse UserFriend
Am 16.09.2012 06:31, schrieb Kenny Lee:
> Thanks eike,
>
> Any examples of embedded repository into the web container?
You can assemble it from the shipped "CDO Electronic Restaurant Example":

http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server/src/org/gastro/internal/server/OM.java
http://git.eclipse.org/c/cdo/cdo.git/tree/plugins/org.gastro.server.web/src/org/gastro/server/internal/web/GastroServlet.java

> Another thing. Is it fine to open a CDOSession or transaction and keep it in a HttpSession.
> Something like Hibernate's open session in view concept.
From a CDO perspective I see nothing that speaks against it. I'm not a total web expert, though. Does it require to
"Serialize" statful application components (CDOSession or CDOTransaction)? That would be problematic. Not sure how
Hibernate does this.

> I want to edit a modal throughout a HttpSession, only.commit the changes when user logs out of the web.
I've used CDO with Vaadin and Liferay and there it was easy, IIRC.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] In a servlet container [message #914999 is a reply to message #913437] Sun, 16 September 2012 02:04 Go to previous messageGo to next message
Eclipse UserFriend
Hi Eike,

Any examples on that embedment?

Was thinking of opening a CDOSession/Transaction and putting it in a HttpSession. Wonder if that is a good idea.
Basically a user can make multiple modifications to a model, but only commit when he logout.

KL
Re: [CDO] In a servlet container [message #915000 is a reply to message #913437] Sun, 16 September 2012 02:06 Go to previous messageGo to next message
Eclipse UserFriend
Hi Eike,

Any examples on that embedment?

Was thinking of opening a CDOSession/Transaction and putting it in a HttpSession. Wonder if that is a good idea.
Basically a user can make multiple modifications to a model, but only commit when he logout.

KL
Re: [CDO] In a servlet container [message #915005 is a reply to message #913437] Sun, 16 September 2012 02:04 Go to previous messageGo to next message
Eclipse UserFriend
Hi Eike,

Any examples on that embedment?

Was thinking of opening a CDOSession/Transaction and putting it in a HttpSession. Wonder if that is a good idea.
Basically a user can make multiple modifications to a model, but only commit when he logout.

KL
Re: [CDO] In a servlet container [message #915006 is a reply to message #913437] Sun, 16 September 2012 02:06 Go to previous messageGo to next message
Eclipse UserFriend
Hi Eike,

Any examples on that embedment?

Was thinking of opening a CDOSession/Transaction and putting it in a HttpSession. Wonder if that is a good idea.
Basically a user can make multiple modifications to a model, but only commit when he logout.

KL
Re: [CDO] In a servlet container [message #915010 is a reply to message #914975] Sun, 16 September 2012 02:29 Go to previous messageGo to next message
Eclipse UserFriend
Am 16.09.2012 08:06, schrieb Kenny Lee:
> Hi Eike,
>
> Any examples on that embedment?
Yes, in the links I gave to you.

> Was thinking of opening a CDOSession/Transaction and putting it in a HttpSession. Wonder if that is a good idea.
> Basically a user can make multiple modifications to a model, but only commit when he logout.
Why don't you just try it with a small prototype?

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] In a servlet container [message #915060 is a reply to message #915010] Sun, 16 September 2012 06:17 Go to previous messageGo to next message
Eclipse UserFriend
AFAIK, everything you put into the http session must be serializable: that is where you will get problems if the web container decides to un/serialize the CDOTransaction...
Re: [CDO] In a servlet container [message #915070 is a reply to message #915060] Sun, 16 September 2012 06:55 Go to previous messageGo to next message
Eclipse UserFriend
Am 16.09.2012 12:17, schrieb Erdal Karaca:
> AFAIK, everything you put into the http session must be serializable: that is where you will get problems if the web
> container decides to un/serialize the CDOTransaction...
Yeah, probably easier to put something into the context that is easy to serialize and can open or provide a
CDOSession/CDOTransaction. Not sure about context lifecycle though and how that impacts resource cleanup.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] In a servlet container [message #915297 is a reply to message #915070] Sun, 16 September 2012 22:33 Go to previous message
Eclipse UserFriend
Eike Stepper wrote on Sun, 16 September 2012 06:55
Am 16.09.2012 12:17, schrieb Erdal Karaca:
> AFAIK, everything you put into the http session must be serializable: that is where you will get problems if the web
> container decides to un/serialize the CDOTransaction...
Yeah, probably easier to put something into the context that is easy to serialize and can open or provide a
CDOSession/CDOTransaction. Not sure about context lifecycle though and how that impacts resource cleanup.

I guess we can put the CDOSession's id into the HttpSession, but we have to keep the CDOSession object somewhere.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper

Previous Topic:XML serialization and ns prefixes
Next Topic:Teneo | CDO| Could not find PAnnotatedEPackage "http://www.eclipse.org/emf/2002/Ecore"
Goto Forum:
  


Current Time: Fri Nov 07 14:46:30 EST 2025

Powered by FUDForum. Page generated in 0.13720 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top