[jboss-cvs] JBoss Messaging SVN: r4477 - in branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb: dto and 4 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jun 16 06:56:54 EDT 2008
Author: bershath27
Date: 2008-06-16 06:56:54 -0400 (Mon, 16 Jun 2008)
New Revision: 4477
Added:
branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/JBMMessageManager.java
branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/JBMMessageManagerImpl.java
branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/test/
branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/test/HBMUserTestCase.java
Removed:
branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/dto/JBMMessageReferencePK.java
branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/dto/JBMMessageReferencePOJO.java
branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/dto/JBMTransactionPOJO.java
branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/JBMTransactionManager.java
branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/JBMTransactionManagerImpl.java
branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/MessageManager.java
branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/MessageManagerImpl.java
branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/MessageReferenceManager.java
branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/MessageReferenceManagerImpl.java
Modified:
branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/dto/JBMMessagePOJO.java
branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/lib/persistence.xml
branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/util/JBMJDBCPersistenceUtil.java
Log:
modified new version, dropping the existing model
Modified: branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/dto/JBMMessagePOJO.java
===================================================================
--- branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/dto/JBMMessagePOJO.java 2008-06-15 14:05:29 UTC (rev 4476)
+++ branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/dto/JBMMessagePOJO.java 2008-06-16 10:56:54 UTC (rev 4477)
@@ -1,176 +1,151 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.messaging.jdbc.hb.dto;
-
-import java.io.Serializable;
-import java.math.BigInteger;
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Lob;
-import javax.persistence.Table;
-
-/**
- * JBMMessagePOJO to map to JBM_MSG table
- *
- * @author <a href="mailto:bershath at gmail.com">Tyronne Wickramarathne</a>
- * @version $Revision: 1 $
- */
-
-
- at Entity
- at Table( name = "JBM_MSG" )
-public class JBMMessagePOJO implements Serializable
-{
-
-
- private static final long serialVersionUID = -754566647626471534L;
-
- private BigInteger messageID;
- private char[] reliable;
- private BigInteger expiration;
- private BigInteger timestamp;
- private int priority;
- private int type;
- private BigInteger time;
- private String headers;
- private String payload;
-
-
- public JBMMessagePOJO()
- {
-
- }
-
- @Id
- @Column( name = "MESSAGE_ID" , nullable = false , precision = 0 )
- public BigInteger getMessageID()
- {
- return messageID;
- }
-
- @Lob
- @Column( name = "RELIABLE" , length = 1 )
- public char[] getReliable()
- {
- return reliable;
- }
-
- @Column( name = "EXPIRATION" , length = 20 )
- public BigInteger getExpiration()
- {
- return expiration;
- }
-
- @Column( name = "TIMESTAMP", length = 20 )
- public BigInteger getTimestamp()
- {
- return timestamp;
- }
-
- @Column( name = "PRIORITY", length = 4 )
- public int getPriority()
- {
- return priority;
- }
-
- @Column( name = "TYPE" , length = 4 )
- public int getType()
- {
- return type;
- }
-
- @Column( name="INS_TIME", length = 20 )
- public BigInteger getTime()
- {
- return time;
- }
-
- @Lob
- @Column( name="HEADERS")
- public String getHeaders()
- {
- return headers;
- }
-
- @Lob
- @Column( name="PAYLOAD")
- public String getPayload()
- {
- return payload;
- }
-
-
- public void setMessageID(BigInteger messageID)
- {
- this.messageID = messageID;
- }
-
-
- public void setReliable(char[] reliable)
- {
- this.reliable = reliable;
- }
-
-
- public void setExpiration(BigInteger expiration)
- {
- this.expiration = expiration;
- }
-
-
- public void setTimestamp(BigInteger timestamp)
- {
- this.timestamp = timestamp;
- }
-
-
- public void setPriority(int priority)
- {
- this.priority = priority;
- }
-
-
- public void setType(int type)
- {
- this.type = type;
- }
-
-
- public void setTime(BigInteger time)
- {
- this.time = time;
- }
-
-
- public void setHeaders(String headers) {
- this.headers = headers;
- }
-
-
- public void setPayload(String payload) {
- this.payload = payload;
- }
-
-
-}
+/**
+ *
+ */
+package org.jboss.messaging.jdbc.hb.pm.src.org.jboss.messaging.jdbc.hb.dto;
+
+import java.io.Serializable;
+import java.math.BigInteger;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.Table;
+
+/**
+ * @author tywickra
+ *
+ */
+ at Entity
+ at Table( name = "JBM_MSG" )
+public class JBMMessagePOJO implements Serializable
+{
+ private static final long serialVersionUID = -4199005333462105317L;
+
+ private BigInteger messageID;
+ private char[] reliable;
+ private BigInteger expiration;
+ private BigInteger timestamp;
+ private int priority;
+ private int type;
+ private BigInteger time;
+ private byte[] headers;
+ private byte[] payload;
+
+
+ public JBMMessagePOJO()
+ {
+
+ }
+
+ @Id
+ @Column( name = "MESSAGE_ID" , nullable = false , precision = 0 )
+ public BigInteger getMessageID()
+ {
+ return messageID;
+ }
+
+ @Lob
+ @Column( name = "RELIABLE" , length = 1 )
+ public char[] getReliable()
+ {
+ return reliable;
+ }
+
+ @Column( name = "EXPIRATION" , length = 20 )
+ public BigInteger getExpiration()
+ {
+ return expiration;
+ }
+
+ @Column( name = "TIMESTAMP", length = 20 )
+ public BigInteger getTimestamp()
+ {
+ return timestamp;
+ }
+
+ @Column( name = "PRIORITY", length = 4 )
+ public int getPriority()
+ {
+ return priority;
+ }
+
+ @Column( name = "TYPE" , length = 4 )
+ public int getType()
+ {
+ return type;
+ }
+
+ @Column( name="INS_TIME", length = 20 )
+ public BigInteger getTime()
+ {
+ return time;
+ }
+
+ @Lob
+ @Column( name="HEADERS")
+ public byte[] getHeaders()
+ {
+ return headers;
+ }
+
+ @Lob
+ @Column( name="PAYLOAD")
+ public byte[] getPayload()
+ {
+ return payload;
+ }
+
+
+ public void setMessageID(BigInteger messageID)
+ {
+ this.messageID = messageID;
+ }
+
+
+ public void setReliable(char[] reliable)
+ {
+ this.reliable = reliable;
+ }
+
+
+ public void setExpiration(BigInteger expiration)
+ {
+ this.expiration = expiration;
+ }
+
+
+ public void setTimestamp(BigInteger timestamp)
+ {
+ this.timestamp = timestamp;
+ }
+
+
+ public void setPriority(int priority)
+ {
+ this.priority = priority;
+ }
+
+
+ public void setType(int type)
+ {
+ this.type = type;
+ }
+
+
+ public void setTime(BigInteger time)
+ {
+ this.time = time;
+ }
+
+
+ public void setHeaders(byte[] headers) {
+ this.headers = headers;
+ }
+
+
+ public void setPayload(byte[] payload) {
+ this.payload = payload;
+ }
+
+
+}
Deleted: branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/dto/JBMMessageReferencePK.java
===================================================================
--- branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/dto/JBMMessageReferencePK.java 2008-06-15 14:05:29 UTC (rev 4476)
+++ branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/dto/JBMMessageReferencePK.java 2008-06-16 10:56:54 UTC (rev 4477)
@@ -1,119 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.messaging.jdbc.hb.dto;
-
-
-
-import java.io.Serializable;
-import java.math.BigInteger;
-
-import javax.persistence.Column;
-import javax.persistence.Embeddable;
-
-
-/**
- * JBMMessageReferencePK , a composite primary key implementation for JBM_MSG_REF table
- *
- * @author <a href="mailto:bershath at gmail.com">Tyronne Wickramarathne</a>
- * @version $Revision: 1 $
- */
-
-
- at Embeddable
-public class JBMMessageReferencePK implements Serializable
-{
-
- private static final long serialVersionUID = 8186484857739990716L;
-
- private BigInteger channelId;
- private BigInteger messageId;
-
-
-
- public JBMMessageReferencePK()
- {
-
- }
-
- @Column( name = "CHANNEL_ID", length = 20 , nullable = false , precision = 0 )
- public BigInteger getChannelId()
- {
- return channelId;
- }
-
-
- @Column( name = "MESSAGE_ID", length = 20 , nullable = false , precision = 0 )
- public BigInteger getMessageId()
- {
- return messageId;
- }
-
- public void setChannelId(BigInteger channelId)
- {
- this.channelId = channelId;
- }
-
-
- public void setMessageId(BigInteger messageId)
- {
- this.messageId = messageId;
- }
-
- @Override
- public int hashCode()
- {
- final int prime = 31;
- int result = 1;
- result = prime * result
- + ((channelId == null) ? 0 : channelId.hashCode());
- result = prime * result
- + ((messageId == null) ? 0 : messageId.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- final JBMMessageReferencePK other = (JBMMessageReferencePK) obj;
- if (channelId == null)
- {
- if (other.channelId != null)
- return false;
- } else if (!channelId.equals(other.channelId))
- return false;
- if (messageId == null)
- {
- if (other.messageId != null)
- return false;
- } else if (!messageId.equals(other.messageId))
- return false;
- return true;
- }
-
-}
Deleted: branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/dto/JBMMessageReferencePOJO.java
===================================================================
--- branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/dto/JBMMessageReferencePOJO.java 2008-06-15 14:05:29 UTC (rev 4476)
+++ branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/dto/JBMMessageReferencePOJO.java 2008-06-16 10:56:54 UTC (rev 4477)
@@ -1,150 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.messaging.jdbc.hb.dto;
-
-import java.io.Serializable;
-import java.math.BigInteger;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Lob;
-import javax.persistence.Table;
-
-
-/**
- * JBMMessageReferencePOJO a mapping POJO class for JBM_MSG_REF table
- *
- * @author <a href="mailto:bershath at gmail.com">Tyronne Wickramarathne</a>
- * @version $Revision: 1 $
- */
-
-
- at Entity
- at Table( name = "JBM_MSG_REF" )
-public class JBMMessageReferencePOJO implements Serializable
-{
-
-
- private static final long serialVersionUID = 5857373425228346565L;
-
-
- @Id private JBMMessageReferencePK jbMessageReferencePK;
- private BigInteger transactionId;
- private char[] state;
- private BigInteger ordering;
- private BigInteger pageOrdering;
- private int deliveryCount;
- private BigInteger scheduledDelivery;
-
-
-
- public JBMMessageReferencePOJO()
- {
-
- }
-
-
- public JBMMessageReferencePK getJbMessageReferencePK()
- {
- return jbMessageReferencePK;
- }
-
- public void setJbMessageReferencePK(JBMMessageReferencePK jbMessageReferencePK)
- {
- this.jbMessageReferencePK = jbMessageReferencePK;
- }
-
-
-
- @Column( name = "TRANSACTION_ID", length = 20 )
- public BigInteger getTransactionId()
- {
- return transactionId;
- }
-
- @Lob
- @Column( name = "STATE", length = 1 )
- public char[] getState()
- {
- return state;
- }
-
- @Column( name = "ORD", length = 20 )
- public BigInteger getOrdering()
- {
- return ordering;
- }
-
- @Column( name = "PAGE_ORD", length = 20 )
- public BigInteger getPageOrdering()
- {
- return pageOrdering;
- }
-
- @Column( name = "DELIVERY_COUNT", length = 11 )
- public int getDeliveryCount()
- {
- return deliveryCount;
- }
-
- @Column( name = "SCHED_DELIVERY", length = 20 )
- public BigInteger getScheduledDelivery()
- {
- return scheduledDelivery;
- }
-
- public void setTransactionId(BigInteger transactionId)
- {
- this.transactionId = transactionId;
- }
-
- public void setState(char[] state)
- {
- this.state = state;
- }
-
- public void setOrdering(BigInteger ordering)
- {
- this.ordering = ordering;
- }
-
- public void setPageOrdering(BigInteger pageOrdering)
- {
- this.pageOrdering = pageOrdering;
- }
-
- public void setDeliveryCount(int deliveryCount)
- {
- this.deliveryCount = deliveryCount;
- }
-
- public void setScheduledDelivery(BigInteger scheduledDelivery)
- {
- this.scheduledDelivery = scheduledDelivery;
- }
-
-
-
-
-
-}
Deleted: branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/dto/JBMTransactionPOJO.java
===================================================================
--- branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/dto/JBMTransactionPOJO.java 2008-06-15 14:05:29 UTC (rev 4476)
+++ branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/dto/JBMTransactionPOJO.java 2008-06-16 10:56:54 UTC (rev 4477)
@@ -1,123 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.messaging.jdbc.hb.dto;
-
-import java.io.Serializable;
-import java.math.BigInteger;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Lob;
-import javax.persistence.Table;
-
-
-/**
- * JBMTransactionPOJO a mapping POJO class for JBM_TX table
- *
- * @author <a href="mailto:bershath at gmail.com">Tyronne Wickramarathne</a>
- * @version $Revision: 1 $
- */
-
-
- at Entity
- at Table( name = "JBM_TX" )
-public class JBMTransactionPOJO implements Serializable
-{
-
-
- private static final long serialVersionUID = -6875604807491686323L;
-
- private BigInteger transactionId;
- private int nodeId;
- private String branchQual;
- private int formatId;
- private String globalTXID;
-
-
- public JBMTransactionPOJO()
- {
-
- }
-
- @Id
- @Column( name = "TRANSACTION_ID", length = 20 , nullable = false , precision = 0 )
- public BigInteger getTransactionId()
- {
- return transactionId;
- }
-
- @Column( name = "NODE_ID", length = 11 )
- public int getNodeId()
- {
- return nodeId;
- }
-
- @Lob
- @Column( name = "BRANCH_QUAL", length = 254 )
- public String getBranchQual()
- {
- return branchQual;
- }
-
-
- @Column( name = "FORMAT_ID", length = 11 )
- public int getFormatId()
- {
- return formatId;
- }
-
- @Lob
- @Column( name = "GLOBAL_TXID", length = 20 )
- public String getGlobalTXID()
- {
- return globalTXID;
- }
-
- public void setTransactionId(BigInteger transactionId)
- {
- this.transactionId = transactionId;
- }
-
- public void setNodeId(int nodeId)
- {
- this.nodeId = nodeId;
- }
-
- public void setBranchQual(String branchQual)
- {
- this.branchQual = branchQual;
- }
-
- public void setFormatId(int formatId)
- {
- this.formatId = formatId;
- }
-
- public void setGlobalTXID(String globalTXID)
- {
- this.globalTXID = globalTXID;
- }
-
-
-}
Added: branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/JBMMessageManager.java
===================================================================
--- branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/JBMMessageManager.java (rev 0)
+++ branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/JBMMessageManager.java 2008-06-16 10:56:54 UTC (rev 4477)
@@ -0,0 +1,16 @@
+package org.jboss.messaging.jdbc.hb.pm.src.org.jboss.messaging.jdbc.hb.factory;
+
+
+import java.math.BigInteger;
+
+public interface JBMMessageManager {
+
+ public BigInteger addMessage(JBMMessagePOJO jbmMessagePOJO);
+
+ public BigInteger removeMessage(JBMMessagePOJO jbmMessagePOJO);
+
+ public BigInteger updateMessage(JBMMessagePOJO jbmMessagePOJO);
+
+ public JBMMessagePOJO findMessageById(BigInteger messageId);
+
+}
Added: branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/JBMMessageManagerImpl.java
===================================================================
--- branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/JBMMessageManagerImpl.java (rev 0)
+++ branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/JBMMessageManagerImpl.java 2008-06-16 10:56:54 UTC (rev 4477)
@@ -0,0 +1,147 @@
+/**
+ *
+ */
+package org.jboss.messaging.jdbc.hb.pm.src.org.jboss.messaging.jdbc.hb.factory;
+
+import java.math.BigInteger;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.EntityTransaction;
+
+import org.jboss.logging.Logger;
+
+/**
+ * @author tywickra
+ *
+ */
+public class JBMMessageManagerImpl implements JBMMessageManager {
+
+ private static final Logger log = Logger.getLogger(JBMMessageManagerImpl.class);
+
+ private EntityManagerFactory emf;
+ private EntityManager em;
+ private EntityTransaction etx;
+ private boolean etxStatus;
+
+ public JBMMessageManagerImpl() {
+
+ }
+ /* (non-Javadoc)
+ * @see labs.org.jboss.JBMMessageManager#addMessage(labs.org.jboss.JBMMessagePOJO)
+ */
+ public BigInteger addMessage(JBMMessagePOJO jbmMessagePOJO) {
+ try{
+ etxStatus = true;
+ emf = JBMHBPersistenceUtil.getEmf();
+ em = emf.createEntityManager();
+ etx = em.getTransaction();
+ etx.begin();
+ log.trace("Transaction begin, to add message "+jbmMessagePOJO.getMessageID());
+ em.persist(jbmMessagePOJO);
+ }catch(Exception exception){
+ etxStatus = false;
+ log.error("An Exception occured while adding message " + jbmMessagePOJO.getMessageID() );
+ exception.printStackTrace();
+ }finally{
+ if(etxStatus){
+ log.trace("Preparing to add message " + jbmMessagePOJO.getMessageID() );
+ etx.commit();
+ log.trace("Message successfully added " + jbmMessagePOJO.getMessageID() );
+ } else {
+ log.trace("Preparing to roll back adding message" + jbmMessagePOJO.getMessageID() );
+ etx.rollback();
+ log.trace("Transaction rolled back with the message id " + jbmMessagePOJO.getMessageID() );
+ log.trace("Message didn't persisted " + jbmMessagePOJO.getMessageID() );
+ }
+ if(em != null)
+ em.close();
+ }
+ return jbmMessagePOJO.getMessageID();
+ }
+
+ /* (non-Javadoc)
+ * @see labs.org.jboss.JBMMessageManager#removeMessage(labs.org.jboss.JBMMessagePOJO)
+ */
+ public BigInteger removeMessage(JBMMessagePOJO jbmMessagePOJO) {
+ try{
+ etxStatus = true;
+ emf = JBMHBPersistenceUtil.getEmf();
+ em = emf.createEntityManager();
+ etx = em.getTransaction();
+ etx.begin();
+ log.trace("Transaction begin to remove message "+jbmMessagePOJO.getMessageID());
+ em.remove(jbmMessagePOJO);
+ }catch(Exception exception){
+ etxStatus = false;
+ log.error("An Exception occured while removing message " + jbmMessagePOJO.getMessageID() );
+ exception.printStackTrace();
+ }finally{
+ if(etxStatus){
+ log.trace("Preparing to remove message " + jbmMessagePOJO.getMessageID() );
+ etx.commit();
+ log.trace("Message successfully removed " + jbmMessagePOJO.getMessageID() );
+ } else {
+ log.trace("Preparing to roll back the transaction with the message id " + jbmMessagePOJO.getMessageID() );
+ etx.rollback();
+ log.trace("Transaction rolled back with the message id " + jbmMessagePOJO.getMessageID() );
+ log.trace("Message didn't persisted " + jbmMessagePOJO.getMessageID() );
+ }
+ if(em != null)
+ em.close();
+ }
+ return jbmMessagePOJO.getMessageID();
+ }
+
+ /* (non-Javadoc)
+ * @see labs.org.jboss.JBMMessageManager#updateMessage(labs.org.jboss.JBMMessagePOJO)
+ */
+ public BigInteger updateMessage(JBMMessagePOJO jbmMessagePOJO) {
+ try{
+ etxStatus = true;
+ emf = JBMHBPersistenceUtil.getEmf();
+ em = emf.createEntityManager();
+ etx = em.getTransaction();
+ etx.begin();
+ log.trace("Transaction begin to update message "+jbmMessagePOJO.getMessageID());
+ em.refresh(jbmMessagePOJO);
+ }catch(Exception exception){
+ etxStatus = false;
+ log.error("An Exception occured while updating message " + jbmMessagePOJO.getMessageID() );
+ exception.printStackTrace();
+ }finally{
+ if(etxStatus){
+ log.trace("Preparing to update message " + jbmMessagePOJO.getMessageID() );
+ etx.commit();
+ log.trace("Message successfully updated " + jbmMessagePOJO.getMessageID() );
+ } else {
+ log.trace("Preparing to roll back the transaction with the message id " + jbmMessagePOJO.getMessageID() );
+ etx.rollback();
+ log.trace("Transaction rolled back with the message id " + jbmMessagePOJO.getMessageID() );
+ log.trace("Message didn't updated " + jbmMessagePOJO.getMessageID() );
+ }
+ if(em != null)
+ em.close();
+ }
+ return jbmMessagePOJO.getMessageID();
+ }
+
+
+ public JBMMessagePOJO findMessageById(BigInteger messageId) {
+ try{
+ emf = JBMHBPersistenceUtil.getEmf();
+ em = emf.createEntityManager();
+ JBMMessagePOJO jbmMessage = new JBMMessagePOJO();
+ jbmMessage.setMessageID(messageId);
+ return em.find(JBMMessagePOJO.class,jbmMessage.getMessageID());
+ }catch(Exception ex){
+ log.error("Unable to retrieve message with the id " + messageId );
+ return null;
+ } finally{
+ if(em != null){
+ em.close();
+ }
+ }
+ }
+
+}
Deleted: branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/JBMTransactionManager.java
===================================================================
--- branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/JBMTransactionManager.java 2008-06-15 14:05:29 UTC (rev 4476)
+++ branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/JBMTransactionManager.java 2008-06-16 10:56:54 UTC (rev 4477)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.messaging.jdbc.hb.factory;
-
-import org.jboss.messaging.jdbc.hb.dto.JBMTransactionPOJO;
-
-
-/**
- * @author bershath
- *
- */
-public interface JBMTransactionManager
-{
- boolean addTransaction(JBMTransactionPOJO jBMTransactionPOJO);
- JBMTransactionPOJO updateTransaction(JBMTransactionPOJO jBMTransactionPOJO);
- boolean removeTransaction(JBMTransactionPOJO jBMTransactionPOJO);
-
-}
Deleted: branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/JBMTransactionManagerImpl.java
===================================================================
--- branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/JBMTransactionManagerImpl.java 2008-06-15 14:05:29 UTC (rev 4476)
+++ branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/JBMTransactionManagerImpl.java 2008-06-16 10:56:54 UTC (rev 4477)
@@ -1,68 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.messaging.jdbc.hb.factory;
-
-import org.jboss.messaging.jdbc.hb.dto.JBMTransactionPOJO;
-
-/**
- * JBMTransactionManagerImpl , implementation class for the JBMTransactionManager
- *
- * @author <a href="mailto:bershath at gmail.com">Tyronne Wickramarathne</a>
- * @version $Revision: 1 $
- */
-
-public class JBMTransactionManagerImpl implements JBMTransactionManager {
-
- /**
- *
- */
- public JBMTransactionManagerImpl() {
- // TODO Auto-generated constructor stub
- }
-
- /* (non-Javadoc)
- * @see org.jboss.messaging.jdbc.hb.factory.JBMTransactionManager#addTransaction(org.jboss.messaging.jdbc.hb.dto.JBMTransactionPOJO)
- */
- public boolean addTransaction(JBMTransactionPOJO transactionPOJO) {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.messaging.jdbc.hb.factory.JBMTransactionManager#removeTransaction(org.jboss.messaging.jdbc.hb.dto.JBMTransactionPOJO)
- */
- public boolean removeTransaction(JBMTransactionPOJO transactionPOJO) {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.messaging.jdbc.hb.factory.JBMTransactionManager#updateTransaction(org.jboss.messaging.jdbc.hb.dto.JBMTransactionPOJO)
- */
- public JBMTransactionPOJO updateTransaction(
- JBMTransactionPOJO transactionPOJO) {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
Deleted: branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/MessageManager.java
===================================================================
--- branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/MessageManager.java 2008-06-15 14:05:29 UTC (rev 4476)
+++ branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/MessageManager.java 2008-06-16 10:56:54 UTC (rev 4477)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.messaging.jdbc.hb.factory;
-
-import java.util.List;
-
-import org.jboss.messaging.jdbc.hb.dto.JBMMessagePOJO;
-
-/**
- * MessageManager , an interface providing services related to JBM_MSG
- *
- * @author <a href="mailto:bershath at gmail.com">Tyronne Wickramarathne</a>
- * @version $Revision: 1 $
- */
-
-public interface MessageManager
-{
- boolean addMessage(JBMMessagePOJO jBMMessagePOJO);
- JBMMessagePOJO updateMessage(JBMMessagePOJO jBMMessagePOJO);
- boolean removeMessage(JBMMessagePOJO jBMMessagePOJO);
- List<JBMMessagePOJO> getAllMessages();
- boolean addMessages(List<JBMMessagePOJO> jBMMessagePOJOs);
-}
Deleted: branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/MessageManagerImpl.java
===================================================================
--- branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/MessageManagerImpl.java 2008-06-15 14:05:29 UTC (rev 4476)
+++ branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/MessageManagerImpl.java 2008-06-16 10:56:54 UTC (rev 4477)
@@ -1,86 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.messaging.jdbc.hb.factory;
-
-import java.util.List;
-
-import org.jboss.messaging.jdbc.hb.dto.JBMMessagePOJO;
-
-
-/**
- * MessageManagerImpl , implementation class for the MessageManager
- *
- * @author <a href="mailto:bershath at gmail.com">Tyronne Wickramarathne</a>
- * @version $Revision: 1 $
- */
-
-public class MessageManagerImpl implements MessageManager {
-
- /**
- *
- */
- public MessageManagerImpl() {
- // TODO Auto-generated constructor stub
- }
-
- /* (non-Javadoc)
- * @see org.jboss.messaging.jdbc.hb.factory.MessageManager#addMessage(org.jboss.messaging.jdbc.hb.dto.JBMMessagePOJO)
- */
- public boolean addMessage(JBMMessagePOJO messagePOJO) {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.messaging.jdbc.hb.factory.MessageManager#addMessages(java.util.List)
- */
- public boolean addMessages(List<JBMMessagePOJO> messagePOJOs) {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.messaging.jdbc.hb.factory.MessageManager#getAllMessages()
- */
- public List<JBMMessagePOJO> getAllMessages() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.messaging.jdbc.hb.factory.MessageManager#removeMessage(org.jboss.messaging.jdbc.hb.dto.JBMMessagePOJO)
- */
- public boolean removeMessage(JBMMessagePOJO messagePOJO) {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.messaging.jdbc.hb.factory.MessageManager#updateMessage(org.jboss.messaging.jdbc.hb.dto.JBMMessagePOJO)
- */
- public JBMMessagePOJO updateMessage(JBMMessagePOJO messagePOJO) {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
Deleted: branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/MessageReferenceManager.java
===================================================================
--- branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/MessageReferenceManager.java 2008-06-15 14:05:29 UTC (rev 4476)
+++ branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/MessageReferenceManager.java 2008-06-16 10:56:54 UTC (rev 4477)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.messaging.jdbc.hb.factory;
-
-import java.math.BigInteger;
-import java.util.List;
-
-import org.jboss.messaging.jdbc.hb.dto.JBMMessageReferencePK;
-import org.jboss.messaging.jdbc.hb.dto.JBMMessageReferencePOJO;
-
-/**
- * MessageReferenceManager , an interface providing services related to JBM_MSG_REF
- *
- * @author <a href="mailto:bershath at gmail.com">Tyronne Wickramarathne</a>
- * @version $Revision: 1 $
- */
-
-public interface MessageReferenceManager
-{
-
- boolean addMessageReference(JBMMessageReferencePOJO jMessageReferencePOJO);
- JBMMessageReferencePOJO updateMessageReference(JBMMessageReferencePOJO jMessageReferencePOJO);
- boolean removeMessageReference(JBMMessageReferencePOJO jMessageReferencePOJO);
- List<JBMMessageReferencePOJO> getPagedReferences(BigInteger channelId, int fromValue, int toValue);
- List<JBMMessageReferencePOJO> getNonPagedReferences(BigInteger channelId);
- List<JBMMessageReferencePOJO> getReferences();
- boolean updateNonPagedReferences(List<JBMMessageReferencePOJO> nonPagedReferences);
- List<JBMMessageReferencePOJO> getMinMaxByChannelId(BigInteger minValue,BigInteger maxValue);
- List<JBMMessageReferencePOJO> getMessageReferencesByChannelId(BigInteger channelId);
- JBMMessageReferencePOJO getMessageReference(JBMMessageReferencePOJO jMessageReferencePOJO);
- boolean updateDeliveryCount(JBMMessageReferencePK messageReferencePK);
- boolean updateChannelID(List<JBMMessageReferencePOJO> jBMMessageReferencePOJOs);
-
-}
Deleted: branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/MessageReferenceManagerImpl.java
===================================================================
--- branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/MessageReferenceManagerImpl.java 2008-06-15 14:05:29 UTC (rev 4476)
+++ branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/factory/MessageReferenceManagerImpl.java 2008-06-16 10:56:54 UTC (rev 4477)
@@ -1,153 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.messaging.jdbc.hb.factory;
-
-import java.math.BigInteger;
-import java.util.List;
-
-import org.jboss.messaging.jdbc.hb.dto.JBMMessageReferencePK;
-import org.jboss.messaging.jdbc.hb.dto.JBMMessageReferencePOJO;
-
-/**
- * MessageReferenceManagerImpl , implementation class for the MessageReferenceManager
- *
- * @author <a href="mailto:bershath at gmail.com">Tyronne Wickramarathne</a>
- * @version $Revision: 1 $
- */
-
-public class MessageReferenceManagerImpl implements MessageReferenceManager {
-
- /**
- *
- */
- public MessageReferenceManagerImpl() {
- // TODO Auto-generated constructor stub
- }
-
- /* (non-Javadoc)
- * @see org.jboss.messaging.jdbc.hb.factory.MessageReferenceManager#addMessageReference(org.jboss.messaging.jdbc.hb.dto.JBMMessageReferencePOJO)
- */
- public boolean addMessageReference(
- JBMMessageReferencePOJO messageReferencePOJO) {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.messaging.jdbc.hb.factory.MessageReferenceManager#getMessageReference(org.jboss.messaging.jdbc.hb.dto.JBMMessageReferencePOJO)
- */
- public JBMMessageReferencePOJO getMessageReference(
- JBMMessageReferencePOJO messageReferencePOJO) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.messaging.jdbc.hb.factory.MessageReferenceManager#getMessageReferencesByChannelId(java.math.BigInteger)
- */
- public List<JBMMessageReferencePOJO> getMessageReferencesByChannelId(
- BigInteger channelId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.messaging.jdbc.hb.factory.MessageReferenceManager#getMinMaxByChannelId(java.math.BigInteger, java.math.BigInteger)
- */
- public List<JBMMessageReferencePOJO> getMinMaxByChannelId(
- BigInteger minValue, BigInteger maxValue) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.messaging.jdbc.hb.factory.MessageReferenceManager#getNonPagedReferences(java.math.BigInteger)
- */
- public List<JBMMessageReferencePOJO> getNonPagedReferences(
- BigInteger channelId) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.messaging.jdbc.hb.factory.MessageReferenceManager#getPagedReferences(java.math.BigInteger, int, int)
- */
- public List<JBMMessageReferencePOJO> getPagedReferences(
- BigInteger channelId, int fromValue, int toValue) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.messaging.jdbc.hb.factory.MessageReferenceManager#getReferences()
- */
- public List<JBMMessageReferencePOJO> getReferences() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.messaging.jdbc.hb.factory.MessageReferenceManager#removeMessageReference(org.jboss.messaging.jdbc.hb.dto.JBMMessageReferencePOJO)
- */
- public boolean removeMessageReference(
- JBMMessageReferencePOJO messageReferencePOJO) {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.messaging.jdbc.hb.factory.MessageReferenceManager#updateChannelID(java.util.List)
- */
- public boolean updateChannelID(
- List<JBMMessageReferencePOJO> messageReferencePOJOs) {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.messaging.jdbc.hb.factory.MessageReferenceManager#updateDeliveryCount(org.jboss.messaging.jdbc.hb.dto.JBMMessageReferencePK)
- */
- public boolean updateDeliveryCount(JBMMessageReferencePK messageReferencePK) {
- // TODO Auto-generated method stub
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.messaging.jdbc.hb.factory.MessageReferenceManager#updateMessageReference(org.jboss.messaging.jdbc.hb.dto.JBMMessageReferencePOJO)
- */
- public JBMMessageReferencePOJO updateMessageReference(
- JBMMessageReferencePOJO messageReferencePOJO) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.jboss.messaging.jdbc.hb.factory.MessageReferenceManager#updateNonPagedReferences(java.util.List)
- */
- public boolean updateNonPagedReferences(
- List<JBMMessageReferencePOJO> nonPagedReferences) {
- // TODO Auto-generated method stub
- return false;
- }
-
-}
Modified: branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/lib/persistence.xml
===================================================================
--- branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/lib/persistence.xml 2008-06-15 14:05:29 UTC (rev 4476)
+++ branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/lib/persistence.xml 2008-06-16 10:56:54 UTC (rev 4477)
@@ -1,14 +1,14 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<persistence>
- <persistence-unit name="JBMJDBCEntityManager">
- <!--jta-data-source>java:/JBMDS</jta-data-source-->
- <properties>
- <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
- <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
- <property name="hibernate.show_sql" value="true"/>
- <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
- <property name="hibernate.connection.url" value="jdbc:hsqldb:."/>
- <property name="hibernate.connection.user" value="sa"/>
- </properties>
- </persistence-unit>
+<?xml version="1.0" encoding="UTF-8"?>
+<persistence>
+ <persistence-unit name="jbmEntityManager">
+ <!--jta-data-source>java:/myDS</jta-data-source-->
+ <properties>
+ <property name="hibernate.hbm2ddl.auto" value="update"/>
+ <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
+ <property name="hibernate.show_sql" value="true"/>
+ <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
+ <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/hbm"/>
+ <property name="hibernate.connection.user" value="root"/>
+ </properties>
+ </persistence-unit>
</persistence>
\ No newline at end of file
Added: branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/test/HBMUserTestCase.java
===================================================================
--- branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/test/HBMUserTestCase.java (rev 0)
+++ branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/test/HBMUserTestCase.java 2008-06-16 10:56:54 UTC (rev 4477)
@@ -0,0 +1,166 @@
+package org.jboss.messaging.jdbc.hb.pm.src.org.jboss.messaging.jdbc.hb.test;
+
+
+import java.math.BigInteger;
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.EntityTransaction;
+import javax.persistence.Persistence;
+
+import org.jboss.logging.Logger;
+
+
+
+import junit.framework.TestCase;
+
+public class HBMUserTestCase extends TestCase {
+
+ private static final Logger log = Logger.getLogger(HBMUserTestCase.class);
+
+ public HBMUserTestCase() {
+ super("HBMUserTestCase");
+ }
+
+
+
+ public void testAddRecords() throws Exception
+ {
+// EntityManagerFactory emf = Persistence.createEntityManagerFactory("jbmEntityManager");
+//
+//
+// //EntityManagerFactory emf = JBMHBPersistenceUtil.getEmf();
+//
+// EntityManager em1 = emf.createEntityManager();
+// EntityTransaction tx1 = em1.getTransaction();
+//
+// tx1.begin();
+// JBMMessagePOJO jbmMessage = new JBMMessagePOJO();
+// jbmMessage.setMessageID(new BigInteger("2"));
+// jbmMessage.setExpiration(new BigInteger("2"));
+// jbmMessage.setPayload("PAYLOAD".getBytes());
+// jbmMessage.setHeaders("HEADERS".getBytes());
+// jbmMessage.setPriority(1);
+// jbmMessage.setReliable("R".toCharArray());
+// jbmMessage.setTime(new BigInteger("20080611"));
+// jbmMessage.setType(3);
+// jbmMessage.setTimestamp(new BigInteger("1158"));
+// em1.persist(jbmMessage);
+// tx1.commit();
+// em1.close();
+ }
+
+// public void testAddMessage() throws Exception{
+//
+// JBMMessagePOJO jbmMessage = new JBMMessagePOJO();
+// jbmMessage.setMessageID(new BigInteger("3"));
+// jbmMessage.setExpiration(new BigInteger("2"));
+// jbmMessage.setPayload("PAYLOAD".getBytes());
+// jbmMessage.setHeaders("HEADERS".getBytes());
+// jbmMessage.setPriority(1);
+// jbmMessage.setReliable("R".toCharArray());
+// jbmMessage.setTime(new BigInteger("20080611"));
+// jbmMessage.setType(3);
+// jbmMessage.setTimestamp(new BigInteger("1158"));
+//
+// JBMMessageManager jbm = new JBMMessageManagerImpl();
+// log.trace(jbm.addMessage(jbmMessage));
+// }
+
+
+
+ public void testRemoveMessage() throws Exception{
+
+ JBMMessagePOJO jbmMessage = new JBMMessagePOJO();
+ jbmMessage.setMessageID(new BigInteger("3"));
+ jbmMessage.setExpiration(new BigInteger("2"));
+ jbmMessage.setPayload("PAYLOAD".getBytes());
+ jbmMessage.setHeaders("HEADERS".getBytes());
+ jbmMessage.setPriority(1);
+ jbmMessage.setReliable("R".toCharArray());
+ jbmMessage.setTime(new BigInteger("20080611"));
+ jbmMessage.setType(3);
+ jbmMessage.setTimestamp(new BigInteger("1158"));
+
+ JBMMessageManager jbm = new JBMMessageManagerImpl();
+ jbm.removeMessage(jbmMessage);
+ }
+
+
+ public void testUpdateMessage() throws Exception{
+
+ JBMMessagePOJO jbmMessage = new JBMMessagePOJO();
+ jbmMessage.setMessageID(new BigInteger("3"));
+ jbmMessage.setExpiration(new BigInteger("3"));
+ jbmMessage.setPayload("UPDATEDPAYLOAD".getBytes());
+ jbmMessage.setHeaders("HEADERS".getBytes());
+ jbmMessage.setPriority(1);
+ jbmMessage.setReliable("R".toCharArray());
+ jbmMessage.setTime(new BigInteger("20080611"));
+ jbmMessage.setType(3);
+ jbmMessage.setTimestamp(new BigInteger("1158"));
+
+ JBMMessageManager jbm = new JBMMessageManagerImpl();
+ jbm.updateMessage(jbmMessage);
+ }
+
+// public void testMyAddRecords() throws Exception
+// {
+// EntityManagerFactory emf = Persistence.createEntityManagerFactory("jbmEntityManager");
+//
+// EntityManager em1 = emf.createEntityManager();
+// EntityTransaction tx1 = em1.getTransaction();
+//
+// tx1.begin();
+// JBMMessagePOJO jbmMessage = new JBMMessagePOJO();
+// jbmMessage.setMessageID(new BigInteger("2"));
+//// jbmMessage.setExpiration(new BigInteger("2"));
+//// jbmMessage.setPayload("PAYLOAD".getBytes());
+//// jbmMessage.setHeaders("HEADERS".getBytes());
+//// jbmMessage.setPriority(1);
+//// jbmMessage.setReliable("R".toCharArray());
+//// jbmMessage.setTime(new BigInteger("20080611"));
+//// jbmMessage.setType(3);
+//// jbmMessage.setTimestamp(new BigInteger("1158"));
+//
+// em1.remove(em1.find(JBMMessagePOJO.class,jbmMessage.getMessageID()));
+// tx1.commit();
+// em1.close();
+// }
+
+
+
+
+ public void testMyUpdateRecords() throws Exception
+ {
+ EntityManagerFactory emf = Persistence.createEntityManagerFactory("jbmEntityManager");
+
+ EntityManager em1 = emf.createEntityManager();
+ EntityTransaction tx1 = em1.getTransaction();
+
+ tx1.begin();
+ JBMMessagePOJO jbmMessage = new JBMMessagePOJO();
+ jbmMessage.setMessageID(new BigInteger("3"));
+ //jbmMessage = em1.find(JBMMessagePOJO.class,jbmMessage.getMessageID());
+
+ jbmMessage.setExpiration(new BigInteger("2"));
+ jbmMessage.setPayload("PAYLOADUPDATED".getBytes());
+ jbmMessage.setHeaders("HEADERSUPDATED".getBytes());
+ jbmMessage.setPriority(2);
+ jbmMessage.setReliable("U".toCharArray());
+ jbmMessage.setTime(new BigInteger("20080101"));
+ jbmMessage.setType(3);
+ jbmMessage.setTimestamp(new BigInteger("1200"));
+
+ em1.persist(jbmMessage);
+ tx1.commit();
+ em1.close();
+ }
+
+
+
+
+
+
+
+
+}
Modified: branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/util/JBMJDBCPersistenceUtil.java
===================================================================
--- branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/util/JBMJDBCPersistenceUtil.java 2008-06-15 14:05:29 UTC (rev 4476)
+++ branches/Branch_Hibernate_Persistence/src/main/org/jboss/messaging/jdbc/hb/pm/src/org/jboss/messaging/jdbc/hb/util/JBMJDBCPersistenceUtil.java 2008-06-16 10:56:54 UTC (rev 4477)
@@ -1,45 +1,15 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.messaging.jdbc.hb.util;
-
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-
-/**
- * JBMJDBCPersistenceUtil to map to JBM_MSG table
- *
- * @author <a href="mailto:bershath at gmail.com">Tyronne Wickramarathne</a>
- * @version $Revision: 1 $
- */
-
-
-public class JBMJDBCPersistenceUtil {
- private static EntityManagerFactory emf;
- static {
- emf = Persistence.createEntityManagerFactory("JBMJDBCEntityManager");
- }
- public static EntityManagerFactory getEmf() {
- return emf;
- }
-
-}
-
+package org.jboss.messaging.jdbc.hb.pm.src.org.jboss.messaging.jdbc.hb.util;
+
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.Persistence;
+
+public class JBMHBPersistenceUtil {
+ private static EntityManagerFactory emf;
+ static {
+ emf = Persistence.createEntityManagerFactory("jbmEntityManager");
+ }
+ public static EntityManagerFactory getEmf() {
+ return emf;
+ }
+
+}
More information about the jboss-cvs-commits
mailing list