|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.nava.informa.impl.hibernate.ChannelBuilder
public class ChannelBuilder
Factory for the creation of the channel object model with the hibernate persistent store.
NOT THREAD SAFE Hibernate Multi-threading notes: ChannelBuilder has some subtleties as it relates to threading. The specifics of the way it is supported still need to be proven. Certainly the error handling here and in UpdateChannelTask and in ChannelRegistry is incomplete. It seems to work, but I would consider it incomplete still. The key facts are (1) Sessions are not thread safe and (2) Sessions should have relatively short lifespans. To support this, there is a mode of using ChannelBuilder where it holds on to a SessionHandler and manages the creation and destruction of Sessions on behalf of the caller. When you supply a SessionHandler to ChannelBuilder, you may use the beginTransaction() and endTransaction() calls to take all the steps needed before and after a transaction. At the end of endTransaction() the transaction will be closed and the session will be flushed and closed. To use this mode, you should (1) Create a SessionHandler , (2) Create a JDBC Connection to the database, (3) sessionHandler.setConnection(connection), and (4) use new ChannelBuilder(sessionHandler).
Constructor Summary | |
---|---|
ChannelBuilder(Session session)
ChannelBuilder constructor. |
|
ChannelBuilder(SessionHandler handler)
ChannelBuilder constructor. |
Method Summary | |
---|---|
void |
beginTransaction()
Processing needed at the start of a transaction. |
void |
close()
Closes the builder. |
CategoryIF |
createCategory(CategoryIF parent,
String title)
|
CategoryIF |
createCategory(CategoryIF parent,
String title,
String domain)
|
ChannelIF |
createChannel(org.jdom.Element channelElement,
String title)
|
ChannelIF |
createChannel(org.jdom.Element channelElement,
String title,
String location)
May throw runtime HibernateException |
ChannelIF |
createChannel(String title)
|
ChannelIF |
createChannel(String title,
String location)
|
ChannelGroupIF |
createChannelGroup(String title)
|
CloudIF |
createCloud(String domain,
int port,
String path,
String registerProcedure,
String protocol)
|
ImageIF |
createImage(String title,
URL location,
URL link)
|
ItemIF |
createItem(ChannelIF channel,
ItemIF item)
|
ItemIF |
createItem(ChannelIF channel,
String title,
String description,
URL link)
Creates a news item and assign it to the given channel. |
ItemIF |
createItem(org.jdom.Element itemElement,
ChannelIF channel,
String title,
String description,
URL link)
|
ItemEnclosureIF |
createItemEnclosure(ItemIF item,
URL location,
String type,
int length)
|
ItemGuidIF |
createItemGuid(ItemIF item,
String location,
boolean permaLink)
|
ItemSourceIF |
createItemSource(ItemIF item,
String name,
String location,
Date timestamp)
|
ItemSourceIF |
createItemSource(String name,
String location,
Date timestamp)
|
TextInputIF |
createTextInput(String title,
String description,
String name,
URL link)
|
void |
delete(Object o)
Hibernate Delete some object |
void |
endTransaction()
Processing needed at the end of a transaction. |
Session |
getSession()
Certain Hibernate calls require the session. |
void |
init(Properties props)
Sets the runtime properties defined for this channel builder. |
boolean |
inTransaction()
Check if we are already in the middle of a transaction. |
Channel |
reload(Channel channel)
Reloads channel for use in new session. |
ChannelGroup |
reload(ChannelGroup group)
Reloads group for use in new session. |
Item |
reload(Item item)
Reloads item for use in new session. |
void |
resetTransaction()
resetTransaction - Used during error handling. |
protected void |
save(Object dataObject)
|
void |
update(Object o)
update - Hibernate Update some object |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ChannelBuilder(Session session)
public ChannelBuilder(SessionHandler handler)
Method Detail |
---|
public void beginTransaction() throws ChannelBuilderException
beginTransaction
in interface ChannelBuilderIF
ChannelBuilderException
public void endTransaction() throws ChannelBuilderException
endTransaction
in interface ChannelBuilderIF
ChannelBuilderException
public boolean inTransaction()
public void resetTransaction()
public Session getSession()
public void update(Object o) throws ChannelBuilderException
update
in interface ChannelBuilderIF
o
-
ChannelBuilderException
- -public void delete(Object o) throws ChannelBuilderException
o
- -
Object to Delete
ChannelBuilderException
- -
Translation of Hibernate exceptionpublic void init(Properties props) throws ChannelBuilderException
ChannelBuilderIF
init
in interface ChannelBuilderIF
props
- The parsed set of properties which may be applied to
this object.
ChannelBuilderException
- If the initialisation fails for
some reason.public ChannelGroupIF createChannelGroup(String title)
createChannelGroup
in interface ChannelBuilderIF
public ChannelIF createChannel(String title)
createChannel
in interface ChannelBuilderIF
public ChannelIF createChannel(org.jdom.Element channelElement, String title)
createChannel
in interface ChannelBuilderIF
public ChannelIF createChannel(String title, String location)
createChannel
in interface ChannelBuilderIF
public ChannelIF createChannel(org.jdom.Element channelElement, String title, String location)
createChannel
in interface ChannelBuilderIF
public ItemIF createItem(ChannelIF channel, String title, String description, URL link)
ChannelBuilderIF
createItem
in interface ChannelBuilderIF
public ItemIF createItem(org.jdom.Element itemElement, ChannelIF channel, String title, String description, URL link)
createItem
in interface ChannelBuilderIF
public ItemIF createItem(ChannelIF channel, ItemIF item)
createItem
in interface ChannelBuilderIF
public ImageIF createImage(String title, URL location, URL link)
createImage
in interface ChannelBuilderIF
public CloudIF createCloud(String domain, int port, String path, String registerProcedure, String protocol)
createCloud
in interface ChannelBuilderIF
public TextInputIF createTextInput(String title, String description, String name, URL link)
createTextInput
in interface ChannelBuilderIF
public ItemSourceIF createItemSource(ItemIF item, String name, String location, Date timestamp)
createItemSource
in interface ChannelBuilderIF
public ItemSourceIF createItemSource(String name, String location, Date timestamp)
public ItemEnclosureIF createItemEnclosure(ItemIF item, URL location, String type, int length)
createItemEnclosure
in interface ChannelBuilderIF
public ItemGuidIF createItemGuid(ItemIF item, String location, boolean permaLink)
createItemGuid
in interface ChannelBuilderIF
public CategoryIF createCategory(CategoryIF parent, String title)
createCategory
in interface ChannelBuilderIF
public CategoryIF createCategory(CategoryIF parent, String title, String domain)
public void close() throws ChannelBuilderException
ChannelBuilderIF
close
in interface ChannelBuilderIF
ChannelBuilderException
public ChannelGroup reload(ChannelGroup group) throws ChannelBuilderException
group
- to reload.
ChannelBuilderException
- when unable to reload data.public Channel reload(Channel channel) throws ChannelBuilderException
channel
- channel to reload.
ChannelBuilderException
- when unable to reload data.public Item reload(Item item) throws ChannelBuilderException
item
- item to reload.
ChannelBuilderException
- when unable to reload data.protected void save(Object dataObject)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |