[jboss-svn-commits] JBL Code SVN: r14183 - in labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba: datamgmt and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Aug 13 13:18:55 EDT 2007
Author: maciej.machulak
Date: 2007-08-13 13:18:55 -0400 (Mon, 13 Aug 2007)
New Revision: 14183
Added:
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManager.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManagerImpl.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManagerProvider.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DummyDataManager.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/ExecutionDataProvider.java
labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/ExecutionDataProviderImpl.java
Log:
Version 0.2.0 of the Business Activity Framework
- missing files...
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManager.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManager.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManager.java 2007-08-13 17:18:55 UTC (rev 14183)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.datamgmt;
+
+/**
+ * Interface of the datamgmt manager.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public interface DataManager
+{
+ public void put(Object objectId, Object object);
+ public Object get(Object objectId);
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManagerImpl.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManagerImpl.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManagerImpl.java 2007-08-13 17:18:55 UTC (rev 14183)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.datamgmt;
+
+import org.apache.log4j.Logger;
+import org.jboss.txbridge.ba.participant.Participant;
+
+/**
+ * Compensation Manager provides a lightweight API for the Business Programmer so that
+ * it can store any additional data which may be required by the datamgmt action.
+ * In low-level details it wraps a participant associated with the current service
+ * invocation.
+ * Compensation Manager is automatically injected by the underlying middleware mechanisms.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public class DataManagerImpl implements DataManager
+{
+ // Logger
+ private static Logger log = Logger.getLogger(DataManagerImpl.class);
+
+ // Task identifier
+ String taskId;
+
+ // Participant
+ Participant participant;
+
+ /**
+ * Constructor
+ *
+ * @param taskId is the task identifier.
+ * @param participant is the reference to the participant.
+ */
+ public DataManagerImpl(String taskId, Participant participant)
+ {
+ log.info("constructor()");
+ this.taskId = taskId;
+ this.participant = participant;
+ }
+
+ /**
+ * This method stores an object with a given ID. It uses the participant it is aware of and
+ * the task identifier.
+ *
+ * @param objectId is the ID of the object.
+ * @param object is the object itself :)
+ */
+ public void put(Object objectId, Object object)
+ {
+ log.info("put()");
+ participant.put(taskId,objectId,object);
+ }
+
+ /**
+ * This method retrieves an object with a given identifier. This method automatically
+ * associates the task id this datamgmt manager was associated with.
+ *
+ * @param objectId is the ID of the object.
+ * @return the object.
+ */
+ public Object get(Object objectId)
+ {
+ log.info("get()");
+ return participant.get(taskId,objectId);
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManagerProvider.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManagerProvider.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DataManagerProvider.java 2007-08-13 17:18:55 UTC (rev 14183)
@@ -0,0 +1,114 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.datamgmt;
+
+import org.apache.log4j.Logger;
+
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * This component is responsible for ensuring that a proper Data Manager is provided
+ * during execution of a service or a datamgmt action. It associates datamgmt managers
+ * with proper threads of execution.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public class DataManagerProvider
+{
+ private static Logger log = Logger.getLogger(DataManagerProvider.class);
+
+ private static volatile DataManagerProvider cmp = null;
+
+ private static ConcurrentMap<Long, DataManager> cmList;
+
+ private DataManagerProvider()
+ {
+ cmList = new ConcurrentHashMap<Long, DataManager>();
+ }
+
+ /**
+ * Returns the instance fo a datamgmt manager provider.
+ *
+ * @return the datamgmt manager.
+ */
+ public static DataManagerProvider getSingletonInstance()
+ {
+ log.info("getSingletonInstance()");
+ if (cmp == null)
+ {
+ synchronized (DataManagerProvider.class)
+ {
+ if (cmp == null)
+ {
+ log.info("Creating a new instance");
+ cmp = new DataManagerProvider();
+ }
+ }
+ }
+ return cmp;
+ }
+
+ /**
+ * This method associates a datamgmt manager with a given thread of execution.
+ *
+ * @param thread is the thread for which the datamgmt manager should be associated.
+ * @param cmp is the datamgmt manager, which should be associated.
+ */
+ public void associateCompensationManager(Long thread, DataManager cmp)
+ {
+ log.info("associateCompensationManager()");
+ cmList.put(thread,cmp);
+ }
+
+ /**
+ * This method returns the datamgmt manager object associated to a certain thread of execution.
+ * If there is no datamgmt manager associated to a certain thread of execution then it means
+ * the service is being executed outside the scope of the Business Activity and a dummy datamgmt
+ * manager is simply returned.
+ *
+ * @param thread thread ID for which the datamgmt manager should be returned.
+ * @return the DataManager object.
+ */
+ public DataManager getCompensationManager(Long thread)
+ {
+ log.info("getCompensationManager()");
+ DataManager cm = cmList.get(thread);
+ if (cm == null)
+ {
+ log.info("Returning a dummy datamgmt manager");
+ cm = new DummyDataManager();
+ }
+ return cm;
+ }
+
+ /**
+ * This method removes the association of a thread and a datamgmt manager.
+ *
+ * @param thread is the thread for which the associaction should be removed.
+ */
+ public void removeCompensationManager(Long thread)
+ {
+ log.info("removeCompensationManager()");
+ cmList.remove(thread);
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DummyDataManager.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DummyDataManager.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/DummyDataManager.java 2007-08-13 17:18:55 UTC (rev 14183)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.datamgmt;
+
+/**
+ * This class represents a dummy datamgmt manager. Such dummy datamgmt manager is used
+ * if a Web Service is invoked outside the scope of the Business Activity. It provides same
+ * methods as a normal datamgmt manager but does not store any values and always returns null.
+ *
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public class DummyDataManager implements DataManager
+{
+ /**
+ * This is a dummy method that... does nothing.
+ *
+ * @param objectId is the ID of the object.
+ * @param object is the object itself.
+ */
+ public void put(Object objectId, Object object)
+ {
+ }
+
+ /**
+ * This method does nothing - simply returns null.
+ *
+ * @param objectId is the object id.
+ * @return returns always null.
+ */
+ public Object get(Object objectId)
+ {
+ return null;
+ }
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/ExecutionDataProvider.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/ExecutionDataProvider.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/ExecutionDataProvider.java 2007-08-13 17:18:55 UTC (rev 14183)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.datamgmt;
+
+/**
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public interface ExecutionDataProvider extends DataManager
+{
+
+ public void putArguments(Object[] parameterList);
+
+ public Object[] getArguments();
+
+ public void putReturn(Object returnObject);
+
+ public Object[] getReturn();
+
+}
Added: labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/ExecutionDataProviderImpl.java
===================================================================
--- labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/ExecutionDataProviderImpl.java (rev 0)
+++ labs/jbosstm/workspace/baframework/trunk/src/org/jboss/txbridge/ba/datamgmt/ExecutionDataProviderImpl.java 2007-08-13 17:18:55 UTC (rev 14183)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags.
+ * See the copyright.txt in the distribution for a full listing
+ * of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU General Public License, v. 2.0.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ * You should have received a copy of the GNU General Public License,
+ * v. 2.0 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2007,
+ * @author JBoss Inc.
+ */
+package org.jboss.txbridge.ba.datamgmt;
+
+import org.jboss.txbridge.ba.participant.Participant;
+import org.apache.log4j.Logger;
+
+/**
+ * @author Maciej P. Machulak (mmachulak at redhat.com)
+ * @version 0.1
+ */
+public class ExecutionDataProviderImpl extends DataManagerImpl implements ExecutionDataProvider
+{
+ // Logger
+ private static Logger log = Logger.getLogger(DataManagerImpl.class);
+
+ /**
+ * Constructor
+ *
+ * @param taskId is the task identifier.
+ * @param participant is the reference to the participant.
+ */
+ public ExecutionDataProviderImpl(String taskId, Participant participant)
+ {
+ super(taskId,participant);
+ }
+
+ /**
+ *
+ *
+ * @param arguments is the list of parameters.
+ */
+ public void putArguments(Object[] arguments)
+ {
+ log.info("putArguments()");
+ participant.putArguments(taskId,arguments);
+ }
+
+ /**
+ *
+ *
+ * @return the list of parameters.
+ */
+ public Object[] getArguments()
+ {
+ log.info("getArguments()");
+ return participant.getArguments(taskId);
+ }
+
+ /**
+ *
+ *
+ * @param returnObject the return object that should be remembered.
+ */
+ public void putReturn(Object returnObject)
+ {
+ log.info("putReturn()");
+ participant.putReturn(taskId,returnObject);
+ }
+
+ /**
+ *
+ *
+ * @return the return object associated with a given task.
+ */
+ public Object[] getReturn()
+ {
+ log.info("getReturn()");
+ return participant.getReturn(taskId);
+ }
+
+}
More information about the jboss-svn-commits
mailing list