001: /*
002: * This file is part of the WfMOpen project.
003: * Copyright (C) 2001-2005 Danet GmbH (www.danet.de), GS-AN.
004: * All rights reserved.
005: *
006: * This program is free software; you can redistribute it and/or modify
007: * it under the terms of the GNU General Public License as published by
008: * the Free Software Foundation; either version 2 of the License, or
009: * (at your option) any later version.
010: *
011: * This program is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014: * GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
019: *
020: * $Id: EisRmsFactory.java,v 1.3 2006/10/15 19:29:51 mlipp Exp $
021: *
022: * $Log: EisRmsFactory.java,v $
023: * Revision 1.3 2006/10/15 19:29:51 mlipp
024: * Merged changes from 1.4.x up to 1.4ea3pre1.
025: *
026: * Revision 1.2.2.1 2006/10/14 21:34:06 mlipp
027: * Simplified resource assignment service implementation.
028: *
029: * Revision 1.2 2006/09/29 12:32:13 drmlipp
030: * Consistently using WfMOpen as projct name now.
031: *
032: * Revision 1.1 2006/09/24 20:57:17 mlipp
033: * Moved RMS implementations in own sub-package.
034: *
035: * Revision 1.3 2006/07/10 10:34:49 drmlipp
036: * Added resource adaptor lookup.
037: *
038: * Revision 1.2 2006/07/05 10:58:28 drmlipp
039: * Fixed package names.
040: *
041: * Revision 1.1 2006/07/05 10:53:27 drmlipp
042: * Separated generic RMS adapter client from properties based adapter.
043: *
044: * Revision 1.1 2006/07/04 13:49:57 drmlipp
045: * Started.
046: *
047: */
048: package de.danet.an.workflow.rmsimpls.eisrms;
049:
050: import javax.naming.NamingException;
051:
052: import de.danet.an.util.EJBUtil;
053: import de.danet.an.workflow.rmsimpls.eisrms.aci.RmsConnectionFactory;
054: import de.danet.an.workflow.spis.rms.FactoryConfigurationError;
055: import de.danet.an.workflow.spis.rms.ResourceManagementService;
056: import de.danet.an.workflow.spis.rms.ResourceManagementServiceFactory;
057:
058: /**
059: * This class provides an implementaion of the factory API based on
060: * information obtained from an RMS resource adapter.<P>
061: *
062: * The resource adapter must provide the {@link RmsConnectionFactory
063: * <code>RmsConnectionFactory</code>}. The factory is obtained from JNDI
064: * using the logical name <code>java:comp/env/ra/RMS</code>. This is the only
065: * configuration option of this resource management service factory, as
066: * anything else is configured using properties of the resource adapter.
067: *
068: * @author <a href="mailto:lipp@danet.de">Michael Lipp</a>
069: * @version $Revision: 1.3 $
070: */
071: public class EisRmsFactory extends ResourceManagementServiceFactory {
072:
073: private static final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory
074: .getLog(EisRmsFactory.class);
075:
076: /**
077: * Create a new instance of this factory.
078: *
079: * @throws FactoryConfigurationError if configuration information is
080: * missing or invalid.
081: */
082: public EisRmsFactory() throws FactoryConfigurationError {
083: }
084:
085: /* Comment copied from interface. */
086: public ResourceManagementService newResourceManagementService()
087: throws FactoryConfigurationError {
088: if (getResourceAssignmentContext() == null) {
089: throw new FactoryConfigurationError(
090: "Resource assignment service not configured.");
091: }
092:
093: try {
094: RmsConnectionFactory fac = (RmsConnectionFactory) EJBUtil
095: .lookupJNDIEntry("java:comp/env/ra/RMS");
096: return new EisRmsService(fac,
097: getResourceAssignmentContext());
098: } catch (NamingException e) {
099: throw new FactoryConfigurationError(e);
100: }
101: }
102: }
|