[jbpm-commits] JBoss JBPM SVN: r4273 - jbpm4/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Mar 18 05:20:51 EDT 2009


Author: heiko.braun at jboss.com
Date: 2009-03-18 05:20:51 -0400 (Wed, 18 Mar 2009)
New Revision: 4273

Added:
   jbpm4/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi/JBPMService.java
Log:
fix missing JBPMService.java

Added: jbpm4/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi/JBPMService.java
===================================================================
--- jbpm4/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi/JBPMService.java	                        (rev 0)
+++ jbpm4/trunk/modules/integration/spi/src/main/java/org/jbpm/integration/spi/JBPMService.java	2009-03-18 09:20:51 UTC (rev 4273)
@@ -0,0 +1,90 @@
+/*
+ * 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.jbpm.integration.spi;
+
+import org.jbpm.Configuration;
+import org.jbpm.ProcessEngine;
+import org.jbpm.integration.spi.mgmt.ServerConfig;
+import org.jbpm.internal.log.Log;
+
+import javax.naming.InitialContext;
+
+/**
+ * @author Heiko.Braun <heiko.braun at jboss.com>
+ */
+public class JBPMService
+{
+  private static final Log log = Log.getLog(JBPMService.class.getName());
+
+  private final static String DEFAULT_JNDI_NAME = "java:/ProcessEngine";
+  
+  private ProcessEngine processEngine;
+
+  // MC injected
+  private ServerConfig serverConfig;
+
+  // can be MC injected
+  private String jndiName = DEFAULT_JNDI_NAME;
+
+  public void start()
+  {
+    this.processEngine = new Configuration().buildProcessEngine();
+
+    try
+    {
+      InitialContext ctx = new InitialContext();
+      ctx.bind(DEFAULT_JNDI_NAME, new ProcessEngineReference("default", this.processEngine));
+
+      // debug out      
+      log.info(serverConfig.getImplementationTitle());
+      log.info(serverConfig.getImplementationVersion());
+      log.info("ProcessEngine bound to: " + this.jndiName);
+    }
+
+    catch (Exception e)
+    {
+      throw new RuntimeException("Failed to create JBPMService", e);
+    }
+
+  }
+
+  public void stop()
+  {
+    this.processEngine = null;
+    log.info("JBPMService stopped");
+  }
+
+  public ProcessEngine getProcessEngine()
+  {
+    return this.processEngine;
+  }
+
+  public void setServerConfig(ServerConfig serverConfig)
+  {
+    this.serverConfig = serverConfig;
+  }
+
+  public void setJndiName(String jndiName)
+  {
+    this.jndiName = jndiName;
+  }
+}




More information about the jbpm-commits mailing list