/*
* This file is part of the WfMOpen project.
* Copyright (C) 2001-2005 Danet GmbH (www.danet.de), GS-AN.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: EisRmsFactory.java 1753 2006-10-15 19:29:51Z mlipp $
*
* $Log$
* Revision 1.2.2.1 2006/10/14 21:34:06 mlipp
* Simplified resource assignment service implementation.
*
* Revision 1.2 2006/09/29 12:32:13 drmlipp
* Consistently using WfMOpen as projct name now.
*
* Revision 1.1 2006/09/24 20:57:17 mlipp
* Moved RMS implementations in own sub-package.
*
* Revision 1.3 2006/07/10 10:34:49 drmlipp
* Added resource adaptor lookup.
*
* Revision 1.2 2006/07/05 10:58:28 drmlipp
* Fixed package names.
*
* Revision 1.1 2006/07/05 10:53:27 drmlipp
* Separated generic RMS adapter client from properties based adapter.
*
* Revision 1.1 2006/07/04 13:49:57 drmlipp
* Started.
*
*/
package de.danet.an.workflow.rmsimpls.eisrms;
import javax.naming.NamingException;
import de.danet.an.util.EJBUtil;
import de.danet.an.workflow.rmsimpls.eisrms.aci.RmsConnectionFactory;
import de.danet.an.workflow.spis.rms.FactoryConfigurationError;
import de.danet.an.workflow.spis.rms.ResourceManagementService;
import de.danet.an.workflow.spis.rms.ResourceManagementServiceFactory;
/**
* This class provides an implementaion of the factory API based on
* information obtained from an RMS resource adapter.<P>
*
* The resource adapter must provide the {@link RmsConnectionFactory
* <code>RmsConnectionFactory</code>}. The factory is obtained from JNDI
* using the logical name <code>java:comp/env/ra/RMS</code>. This is the only
* configuration option of this resource management service factory, as
* anything else is configured using properties of the resource adapter.
*
* @author <a href="mailto:lipp@danet.de">Michael Lipp</a>
* @version $Revision: 1753 $
*/
public class EisRmsFactory extends ResourceManagementServiceFactory {
private static final org.apache.commons.logging.Log logger
= org.apache.commons.logging.LogFactory
.getLog(EisRmsFactory.class);
/**
* Create a new instance of this factory.
*
* @throws FactoryConfigurationError if configuration information is
* missing or invalid.
*/
public EisRmsFactory () throws FactoryConfigurationError {
}
/* Comment copied from interface. */
public ResourceManagementService newResourceManagementService ()
throws FactoryConfigurationError {
if (getResourceAssignmentContext() == null) {
throw new FactoryConfigurationError
("Resource assignment service not configured.");
}
try {
RmsConnectionFactory fac = (RmsConnectionFactory)
EJBUtil.lookupJNDIEntry("java:comp/env/ra/RMS");
return new EisRmsService (fac, getResourceAssignmentContext());
} catch (NamingException e) {
throw new FactoryConfigurationError(e);
}
}
}