it.tidalwave.openrdf.elmo.ElmoManagerProxy Maven / Gradle / Ivy
The newest version!
/***********************************************************************************************************************
*
* blueMarine Semantic - open source media workflow
* Copyright (C) 2008-2011 by Tidalwave s.a.s. (http://www.tidalwave.it)
*
***********************************************************************************************************************
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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.
*
***********************************************************************************************************************
*
* WWW: http://bluemarine.tidalwave.it
* SCM: https://kenai.com/hg/bluemarine~semantic-src
*
**********************************************************************************************************************/
package it.tidalwave.openrdf.elmo;
import it.tidalwave.util.logging.Logger;
import java.util.Iterator;
import java.util.Locale;
import javax.annotation.Nonnull;
import javax.persistence.EntityTransaction;
import javax.xml.namespace.QName;
import org.openrdf.elmo.ElmoManager;
import org.openrdf.elmo.ElmoQuery;
import org.openrdf.elmo.Entity;
import org.openrdf.elmo.Memento;
/*******************************************************************************
*
* @author Fabrizio Giudici
* @version $Id: ElmoManagerProxy.java,v 4fbb06e9364c 2011/03/06 21:25:16 fabrizio $
*
******************************************************************************/
public class ElmoManagerProxy implements ElmoManager
{
private final String CLASS = ElmoManagerProxy.class.getName();
private final Logger logger = Logger.getLogger(CLASS);
@Nonnull
private ElmoManager getDelegate()
{
final ElmoManager em = ElmoManagerThreadLocal.get();
if (em == null)
{
throw new IllegalStateException("No ElmoManager bound to the current thread.");
}
return em;
}
@Nonnull
private ElmoManager getCheckedDelegate()
{
final ElmoManager em = getDelegate();
if (!em.isOpen())
{
throw new RuntimeException("ElmoManager is closed! " + em);
}
// logger.finest(">>>> ElmoManager instance: %s", em);
return em;
}
public void undoMemento (Memento arg0)
{
getCheckedDelegate().undoMemento(arg0);
}
public T rename (T arg0, QName arg1)
{
return getCheckedDelegate().rename(arg0, arg1);
}
public Entity removeDesignation (Class> arg0, Object arg1)
{
return getCheckedDelegate().removeDesignation(arg0, arg1);
}
public Entity removeDesignation (Object arg0, Class>... arg1)
{
return getCheckedDelegate().removeDesignation(arg0, arg1);
}
public void remove (Object arg0)
{
getCheckedDelegate().remove(arg0);
}
public void refresh (Object arg0)
{
getCheckedDelegate().refresh(arg0);
}
public void redoMemento (Memento arg0)
{
getCheckedDelegate().redoMemento(arg0);
}
public void persist (Object arg0)
{
getCheckedDelegate().persist(arg0);
}
public T merge (T arg0)
{
return getCheckedDelegate().merge(arg0);
}
public boolean isOpen()
{
return getDelegate().isOpen();
}
public EntityTransaction getTransaction()
{
return getCheckedDelegate().getTransaction();
}
public Locale getLocale()
{
return getCheckedDelegate().getLocale();
}
public Iterable findAll (Class arg0)
{
return getCheckedDelegate().findAll(arg0);
}
public Entity find (QName arg0)
{
return getCheckedDelegate().find(arg0);
}
public T designateEntity (Class arg0, Object arg1)
{
return getCheckedDelegate().designateEntity(arg0, arg1);
}
public T designateEntity (Object arg0, Class arg1, Class>... arg2)
{
return getCheckedDelegate().designateEntity(arg0, arg1, arg2);
}
public T designate (Class arg0, QName arg1)
{
return getCheckedDelegate().designate(arg0, arg1);
}
public T designate (QName arg0, Class arg1, Class>... arg2)
{
return getCheckedDelegate().designate(arg0, arg1, arg2);
}
public T designate(Class arg0, Class>... arg1) {
return getCheckedDelegate().designate(arg0, arg1);
}
public ElmoQuery createQuery (String arg0) {
return getCheckedDelegate().createQuery(arg0);
}
public Memento createMemento()
{
return getCheckedDelegate().createMemento();
}
public T create (QName arg0, Class arg1, Class>... arg2)
{
return getCheckedDelegate().create(arg0, arg1, arg2);
}
public T create (Class arg0, Class>... arg1)
{
return getCheckedDelegate().create(arg0, arg1);
}
public boolean contains (Object arg0)
{
return getCheckedDelegate().contains(arg0);
}
public void close (Iterator> arg0)
{
getCheckedDelegate().close(arg0);
}
public void close()
{
getCheckedDelegate().close();
}
}