[jbpm-commits] JBoss JBPM SVN: r4331 - in jbpm4/trunk/modules: deployment/src/main/java/org/jbpm/cmd and 10 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Mar 26 06:38:39 EDT 2009
Author: tom.baeyens at jboss.com
Date: 2009-03-26 06:38:38 -0400 (Thu, 26 Mar 2009)
New Revision: 4331
Added:
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployExecutionService.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/Deployer.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployerManager.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentProperty.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCache.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCacheImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/StartExecutionInLatestCmd.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/Deployment.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositoryService.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositorySession.java
Removed:
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/Deployment.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositoryService.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositorySession.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/cmd/StartExecutionInLatestCmd.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/jpdl/JpdlDeployer.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeployCmd.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/Deployer.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeployerManager.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentImpl.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentProperty.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCache.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCacheImpl.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryServiceImpl.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositorySessionImpl.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployExecutionService.java
jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployProcessService.java
Modified:
jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/JbpmTestCase.java
jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/StartExecutionTest.java
jbpm4/trunk/modules/deployment/src/test/resources/jbpm.cfg.xml
jbpm4/trunk/modules/deployment/src/test/resources/jbpm.execution.hbm.xml
jbpm4/trunk/modules/deployment/src/test/resources/jbpm.hibernate.cfg.xml
jbpm4/trunk/modules/deployment/src/test/resources/jbpm.history.hbm.xml
jbpm4/trunk/modules/deployment/src/test/resources/jbpm.jpdl.hbm.xml
jbpm4/trunk/modules/deployment/src/test/resources/jbpm.repository.hbm.xml
jbpm4/trunk/modules/deployment/src/test/resources/jbpm.task.hbm.xml
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ActivityImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CompositeElementImpl.java
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
Log:
revisiting deployment
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/Deployment.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/Deployment.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/Deployment.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.api;
-
-import java.util.zip.ZipInputStream;
-
-import org.jbpm.pvm.internal.stream.StreamInput;
-
-/**
- * @author Tom Baeyens
- */
-public interface Deployment {
-
- void setName(String name);
-
- Deployment addStreamInput(String name, StreamInput streamInput);
- Deployment addZipInputStream(ZipInputStream zipInputStream);
-
- /** @return deploymentId */
- long deploy();
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositoryService.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositoryService.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositoryService.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,38 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.api;
-
-import java.io.InputStream;
-
-
-/**
- * @author Tom Baeyens
- */
-public interface RepositoryService {
-
- public abstract Deployment createDeployment();
-
- public abstract void deleteDeployment(long deploymentDbid);
-
- public abstract InputStream getResource(String deploymentId, String resource);
-
-}
\ No newline at end of file
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositorySession.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositorySession.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/api/RepositorySession.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.api;
-
-import java.util.List;
-
-import org.jbpm.pvm.DeploymentImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public interface RepositorySession {
-
- Object getObject(long deploymentDbid, String objectName);
-
- long deploy(DeploymentImpl deployment);
-
- List<String> findObjectNames(String propertyKey, String propertyValue);
- List<String> findObjectPropertyValues(String objectName, String propertyKey);
- Object findObjectByPropertyValue(String propertyKey, String propertyValue);
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/cmd/StartExecutionInLatestCmd.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/cmd/StartExecutionInLatestCmd.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/cmd/StartExecutionInLatestCmd.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.cmd;
-
-import java.util.Map;
-
-import org.hibernate.Session;
-import org.jbpm.Execution;
-import org.jbpm.JbpmException;
-import org.jbpm.api.RepositorySession;
-import org.jbpm.client.ClientProcessDefinition;
-import org.jbpm.client.ClientProcessInstance;
-import org.jbpm.env.Environment;
-import org.jbpm.pvm.internal.cmd.VariablesCmd;
-
-
-/**
- * @author Tom Baeyens
- */
-public class StartExecutionInLatestCmd extends VariablesCmd<Execution> {
-
- private static final long serialVersionUID = 1L;
-
- protected String processDefinitionKey;
- protected String executionKey;
-
- public StartExecutionInLatestCmd(String processDefinitionKey, Map<String, Object> variables, String executionKey) {
- if (processDefinitionKey==null) {
- throw new JbpmException("processDefinitionKey is null");
- }
- this.processDefinitionKey = processDefinitionKey;
- this.variables = variables;
- this.executionKey = executionKey;
- }
-
- public Execution execute(Environment environment) throws Exception {
- ClientProcessDefinition processDefinition = null;
-
- RepositorySession repositorySession = environment.get(RepositorySession.class);
- processDefinition = (ClientProcessDefinition) repositorySession
- .findObjectByPropertyValue("jpdl.key", processDefinitionKey);
-
- if (processDefinition==null) {
- throw new JbpmException("no process definition with key '"+processDefinitionKey+"'");
- }
-
- ClientProcessInstance processInstance = processDefinition.createProcessInstance(executionKey);
- processInstance.setVariables(variables);
- processInstance.start();
-
- Session session = Environment.getFromCurrent(Session.class);
- session.save(processInstance);
- return processInstance;
- }
-
- public String getExecutionKey() {
- return executionKey;
- }
- public void setExecutionKey(String executionKey) {
- this.executionKey = executionKey;
- }
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/jpdl/JpdlDeployer.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/jpdl/JpdlDeployer.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/jpdl/JpdlDeployer.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,126 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.jpdl;
-
-import java.io.InputStream;
-import java.util.List;
-
-import org.jbpm.api.RepositorySession;
-import org.jbpm.env.Environment;
-import org.jbpm.internal.log.Log;
-import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
-import org.jbpm.jpdl.internal.xml.JpdlParser;
-import org.jbpm.pvm.Deployer;
-import org.jbpm.pvm.DeploymentImpl;
-import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
-import org.jbpm.pvm.internal.xml.Parse;
-
-
-/**
- * @author Tom Baeyens
- */
-public class JpdlDeployer implements Deployer {
-
- private static Log log = Log.getLog(JpdlDeployer.class.getName());
-
- static JpdlParser jpdlParser = new JpdlParser();
-
- public void deploy(DeploymentImpl deployment) {
-
- for (String resourceName: deployment.getResourceNames()) {
- InputStream inputStream = deployment.getResourceAsStream(resourceName);
-
- Parse parse = jpdlParser.createParse();
- parse.setProblems(deployment.getProblems());
- parse.setInputStream(inputStream);
- parse.execute();
-
- JpdlProcessDefinition processDefinition =
- (JpdlProcessDefinition) parse.getDocumentObject();
-
- if ( (processDefinition!=null)
- && (processDefinition.getName()!=null)
- ) {
- String processDefinitionName = processDefinition.getName();
-
- processDefinition.setDeploymentDbid(deployment.getDbid());
-
- String key = deployment.getObjectProperty(processDefinitionName, "jpdl.key");
- if (key!=null) {
- String id = deployment.getObjectProperty(processDefinitionName, "jpdl.id");
- processDefinition.setId(id);
- processDefinition.setKey(key);
-
- } else {
- checkKey(processDefinition, deployment);
- checkId(processDefinition, deployment);
-
- deployment.addObject(processDefinitionName, processDefinition);
- deployment.addObjectProperty(processDefinitionName, "jpdl.key", processDefinition.getKey());
- deployment.addObjectProperty(processDefinitionName, "jpdl.id", processDefinition.getId());
- }
- }
- }
- }
-
- protected void checkKey(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
- String processDefinitionName = processDefinition.getName();
- String processDefinitionKey = processDefinition.getKey();
-
- // if no key was specified in the jpdl process file
- if (processDefinitionKey==null) {
- // derive the key from the name
- // replace any non-word character with an underscore
- processDefinitionKey = processDefinitionName.replaceAll("\\W", "_");
- processDefinition.setKey(processDefinitionKey);
- }
-
- RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
- List<String> existingKeys = repositorySession.findObjectPropertyValues(processDefinitionName, "jpdl.key");
- if ( (!existingKeys.isEmpty())
- && existingKeys.get(0).equals(processDefinitionKey)
- ) {
- deployment.addProblem("invalid key '"+processDefinitionKey+"' in process "+processDefinition.getName()+". Existing process has name '"+processDefinitionName+"' and key '"+processDefinitionKey+"'");
- }
-
- List<String> existingNames = repositorySession.findObjectNames("jpdl.key", processDefinitionKey);
- if ( (!existingNames.isEmpty())
- && existingNames.get(0).equals(processDefinitionName)
- ) {
- deployment.addProblem("invalid name '"+processDefinitionName+"' in process "+processDefinition.getName()+". Existing process has name '"+processDefinitionName+"' and key '"+processDefinitionKey+"'");
- }
- }
-
- protected void checkId(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
- String id = processDefinition.getId();
- if (id==null) {
- id = processDefinition.getKey()+"-"+deployment.getDbid();
- log.trace("created id '"+id+"' for "+processDefinition);
- processDefinition.setId(id);
- }
-
- RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
- if (repositorySession.findObjectByPropertyValue("jpdl.id", id) != null) {
- deployment.addProblem("process '" + id + "' already exists");
- }
- }
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeployCmd.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeployCmd.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeployCmd.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.pvm;
-
-import org.jbpm.JbpmException;
-import org.jbpm.api.RepositorySession;
-import org.jbpm.cmd.Command;
-import org.jbpm.env.Environment;
-import org.jbpm.internal.log.Log;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DeployCmd implements Command<Long> {
-
- private static final long serialVersionUID = 1L;
-
- private static Log log = Log.getLog(DeployCmd.class.getName());
-
- DeploymentImpl deployment;
-
- public DeployCmd(DeploymentImpl deployment) {
- this.deployment = deployment;
- }
-
- public Long execute(Environment environment) throws Exception {
- RepositorySession repositorySession = environment.get(RepositorySession.class);
- long deploymentDbid = repositorySession.deploy(deployment);
-
- if (deployment.hasProblems()) {
- String problemsText = deployment.getProblemsText();
- if (problemsText!=null) {
- String errorMsg = "problems during deployment of "+deployment+": "+problemsText;
- log.info(errorMsg);
- throw new JbpmException(errorMsg);
- }
- }
-
- return deploymentDbid;
- }
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/Deployer.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/Deployer.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/Deployer.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,33 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.pvm;
-
-
-
-/**
- * @author Tom Baeyens
- */
-public interface Deployer {
-
- void deploy(DeploymentImpl deployment);
-
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeployerManager.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeployerManager.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeployerManager.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.pvm;
-
-import java.util.List;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DeployerManager {
-
- List<Deployer> deployers;
-
- public Object deploy(DeploymentImpl deployment) {
- for (Deployer deployer: deployers) {
- deployer.deploy(deployment);
- }
- return null;
- }
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentImpl.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentImpl.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentImpl.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,171 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.pvm;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.io.ObjectStreamException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-import org.jbpm.JbpmException;
-import org.jbpm.api.Deployment;
-import org.jbpm.cmd.CommandService;
-import org.jbpm.pvm.internal.lob.Lob;
-import org.jbpm.pvm.internal.stream.ByteArrayStreamInput;
-import org.jbpm.pvm.internal.stream.StreamInput;
-import org.jbpm.pvm.internal.util.IoUtil;
-import org.jbpm.pvm.internal.xml.ProblemList;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DeploymentImpl extends ProblemList implements Deployment {
-
- protected long dbid;
- protected String name;
- protected long timestamp;
-
- protected Map<String, Lob> resources;
-
- protected CommandService commandService;
-
- protected Map<String, Object> objects;
- protected Set<DeploymentProperty> objectProperties;
-
- public DeploymentImpl() {
- }
-
- public DeploymentImpl(CommandService commandService) {
- this.commandService = commandService;
- }
-
- public long deploy() {
- return commandService.execute(new DeployCmd(this));
- }
- public void setName(String name) {
- this.name = name;
- }
-
- public void setTimestamp(long timestamp) {
- this.timestamp = timestamp;
- }
-
- public Deployment addStreamInput(String name, StreamInput streamInput) {
- if (resources==null) {
- resources = new HashMap<String, Lob>();
- }
- byte[] bytes = IoUtil.readBytes(streamInput.openStream());
- Lob lob = new Lob(bytes);
- resources.put(name, lob);
- return this;
- }
-
- public Deployment addZipInputStream(ZipInputStream zipInputStream) {
- try {
- ZipEntry zipEntry = zipInputStream.getNextEntry();
- while(zipEntry!=null) {
- String entryName = zipEntry.getName();
- byte[] bytes = IoUtil.readBytes(zipInputStream);
- if (bytes!=null) {
- addStreamInput(entryName, new ByteArrayStreamInput(bytes));
- }
- zipEntry = zipInputStream.getNextEntry();
- }
- } catch (Exception e) {
- throw new JbpmException("couldn't read zip archive", e);
- }
- return this;
- }
-
- public Set<String> getResourceNames() {
- if (resources==null) {
- return Collections.EMPTY_SET;
- }
- return resources.keySet();
- }
-
- public InputStream getResourceAsStream(String resourceName) {
- if (resources!=null) {
- Lob lob = resources.get(resourceName);
- if (lob!=null) {
- byte[] bytes = lob.extractBytes();
- return new ByteArrayInputStream(bytes);
- }
- }
- return null;
- }
-
- public void addObject(String objectName, Object object) {
- if (objects==null) {
- objects = new HashMap<String, Object>();
- }
- objects.put(objectName, object);
- }
-
- public void addObjectProperty(String objectName, String key, String value) {
- if (objectProperties==null) {
- objectProperties = new HashSet<DeploymentProperty>();
- }
- objectProperties.add(new DeploymentProperty(this, objectName, key, value));
- }
-
- public String getObjectProperty(String objectName, String key) {
- if (objectProperties!=null) {
- for (DeploymentProperty deploymentProperty: objectProperties) {
- if ( (deploymentProperty.getObjectName().equals(objectName))
- && (deploymentProperty.getKey().equals(key))
- ) {
- return deploymentProperty.getValue();
- }
- }
- }
- return null;
- }
-
- protected Object writeReplace() throws ObjectStreamException {
- commandService = null;
- return this;
- }
-
- public long getDbid() {
- return dbid;
- }
- public String getName() {
- return name;
- }
- public long getTimestamp() {
- return timestamp;
- }
- public Map<String, Object> getObjects() {
- return objects;
- }
- public Set<DeploymentProperty> getObjectProperties() {
- return objectProperties;
- }
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentProperty.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentProperty.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/DeploymentProperty.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,66 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.pvm;
-
-import java.io.Serializable;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DeploymentProperty implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- long dbid;
- protected DeploymentImpl deployment;
- protected String objectName;
- protected String key;
- protected String value;
-
- public DeploymentProperty() {
- }
-
- public DeploymentProperty(DeploymentImpl deployment, String objectName, String key, String value) {
- this.deployment = deployment;
- this.objectName = objectName;
- this.key = key;
- this.value = value;
- }
-
- public String toString() {
- return "{"+objectName+","+key+","+value+"}";
- }
-
- public String getObjectName() {
- return objectName;
- }
- public String getKey() {
- return key;
- }
- public String getValue() {
- return value;
- }
- public DeploymentImpl getDeployment() {
- return deployment;
- }
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCache.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCache.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCache.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.pvm;
-
-import java.util.Map;
-
-
-/**
- * @author Tom Baeyens
- */
-public interface RepositoryCache {
-
- void set(long deploymentdbid, Map<String, Object> deployedObjects);
- Object get(long deploymentDbid, String objectName);
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCacheImpl.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCacheImpl.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryCacheImpl.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.pvm;
-
-import java.util.HashMap;
-import java.util.Map;
-
-
-/**
- * @author Tom Baeyens
- */
-public class RepositoryCacheImpl implements RepositoryCache {
-
- Map<Long, Map<String, Object>> deployments = new HashMap<Long, Map<String,Object>>();
-
- public Object get(long deploymentDbid, String objectName) {
- Map<String, Object> deploymentObjects = deployments.get(deploymentDbid);
- if (deploymentObjects==null) {
- return null;
- }
- return deploymentObjects.get(objectName);
- }
-
- public void set(long deploymentDbid, Map<String, Object> objects) {
- Map<String, Object> deploymentObjects = deployments.get(deploymentDbid);
- if (deploymentObjects==null) {
- deploymentObjects = new HashMap<String, Object>();
- deployments.put(deploymentDbid, deploymentObjects);
- }
- for (String objectName: objects.keySet()) {
- Object object = deploymentObjects.get(objectName);
- deploymentObjects.put(objectName, object);
- }
- }
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryServiceImpl.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositoryServiceImpl.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,47 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.pvm;
-
-import java.io.InputStream;
-
-import org.jbpm.api.Deployment;
-import org.jbpm.api.RepositoryService;
-import org.jbpm.cmd.CommandService;
-
-/**
- * @author Tom Baeyens
- */
-public class RepositoryServiceImpl implements RepositoryService {
-
- CommandService commandService;
-
- public Deployment createDeployment() {
- return new DeploymentImpl(commandService);
- }
-
- public void deleteDeployment(long deploymentdbid) {
- }
-
- public InputStream getResource(String deploymentId, String resource) {
- return null;
- }
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositorySessionImpl.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositorySessionImpl.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/pvm/RepositorySessionImpl.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,123 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.pvm;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.hibernate.Session;
-import org.jbpm.JbpmException;
-import org.jbpm.Problem;
-import org.jbpm.api.RepositorySession;
-import org.jbpm.internal.log.Log;
-
-/**
- * @author Tom Baeyens
- */
-public class RepositorySessionImpl implements RepositorySession {
-
- private static Log log = Log.getLog(RepositorySessionImpl.class.getName());
-
- Session session;
- RepositoryCache repositoryCache;
- DeployerManager deployerManager;
-
- public long deploy(DeploymentImpl deployment) {
- session.save(deployment);
-
- deployment.setTimestamp(System.currentTimeMillis());
- deployment.setProblems(new ArrayList<Problem>());
-
- deployerManager.deploy(deployment);
-
- if (deployment.hasProblems()) {
- for (Problem problem: deployment.getProblems()) {
- Throwable cause = problem.getCause();
- if (cause!=null) {
- log.debug("deployment exception", cause);
- }
- }
- throw new JbpmException("problems during deployment: "+deployment.getProblemsText());
- } else {
-
- repositoryCache.set(deployment.getDbid(), deployment.getObjects());
- }
-
- return deployment.getDbid();
- }
-
- public Object getObject(long deploymentDbid, String objectName) {
- Object object = repositoryCache.get(deploymentDbid, objectName);
- if (object!=null) {
- log.trace("repository cache hit");
-
- } else {
- log.trace("loading deployment "+deploymentDbid+" from db");
- DeploymentImpl deployment = (DeploymentImpl) session.load(DeploymentImpl.class, deploymentDbid);
- deploy(deployment);
-
- object = repositoryCache.get(deploymentDbid, objectName);
-
- if (object==null) {
- throw new JbpmException("deployment "+deploymentDbid+" doesn't contain object "+objectName);
- }
- }
- return object;
- }
-
- public Object findObjectByPropertyValue(String key, String value) {
- DeploymentProperty deploymentProperty = (DeploymentProperty) session.createQuery(
- "select deploymentProperty " +
- "from "+DeploymentProperty.class.getName()+" as deploymentProperty " +
- "where deploymentProperty.key = '"+key+"' " +
- " and deploymentProperty.value = '"+value+"' " +
- "order by deploymentProperty.deployment.timestamp desc "
- ).uniqueResult();
-
- if (deploymentProperty!=null) {
- long deploymentDbid = deploymentProperty.getDeployment().getDbid();
- String objectName = deploymentProperty.getObjectName();
-
- return getObject(deploymentDbid, objectName);
- }
-
- return null;
- }
-
- public List<String> findObjectNames(String key, String value) {
- return session.createQuery(
- "select distinct deploymentProperty.objectName " +
- "from "+DeploymentProperty.class.getName()+" as deploymentProperty " +
- "where deploymentProperty.key = '"+key+"' " +
- " and deploymentProperty.value = '"+value+"' "
- ).list();
- }
-
- public List<String> findObjectPropertyValues(String objectName, String key) {
- return session.createQuery(
- "select distinct deploymentProperty.value " +
- "from "+DeploymentProperty.class.getName()+" as deploymentProperty " +
- "where deploymentProperty.objectName = '"+objectName+"' " +
- " and deploymentProperty.key = '"+key+"' "
- ).list();
- }
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployExecutionService.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployExecutionService.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployExecutionService.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,37 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.tmp;
-
-import org.jbpm.Execution;
-import org.jbpm.cmd.StartExecutionInLatestCmd;
-import org.jbpm.pvm.internal.svc.ExecutionServiceImpl;
-
-
-/**
- * @author Tom Baeyens
- */
-public class DeployExecutionService extends ExecutionServiceImpl {
-
- public Execution startProcessInstanceByKey(String processDefinitionKey) {
- return commandService.execute(new StartExecutionInLatestCmd(processDefinitionKey, null, null));
- }
-}
Deleted: jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployProcessService.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployProcessService.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/main/java/org/jbpm/tmp/DeployProcessService.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -1,30 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt 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.tmp;
-
-import org.jbpm.pvm.internal.svc.ProcessServiceImpl;
-
-/**
- * @author Tom Baeyens
- */
-public class DeployProcessService extends ProcessServiceImpl {
-}
Modified: jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/JbpmTestCase.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/JbpmTestCase.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/JbpmTestCase.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -34,9 +34,9 @@
import org.jbpm.ProcessEngine;
import org.jbpm.ProcessService;
import org.jbpm.TaskService;
-import org.jbpm.api.RepositoryService;
import org.jbpm.cmd.CommandService;
import org.jbpm.job.Job;
+import org.jbpm.pvm.internal.repository.api.RepositoryService;
import org.jbpm.pvm.internal.stream.StringStreamInput;
import org.jbpm.task.Task;
import org.jbpm.test.BaseJbpmTestCase;
Modified: jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/StartExecutionTest.java
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/StartExecutionTest.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/test/java/org/jbpm/deploy/test/StartExecutionTest.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -22,6 +22,8 @@
package org.jbpm.deploy.test;
import org.jbpm.Execution;
+import org.jbpm.pvm.internal.repository.RepositoryCache;
+import org.jbpm.pvm.internal.repository.RepositoryCacheImpl;
/**
@@ -35,13 +37,31 @@
" <start>" +
" <transition to='a' />" +
" </start>" +
- " <state name='a' />" +
+ " <state name='a'>" +
+ " <transition to='b' />" +
+ " </state>" +
+ " <state name='b'>" +
+ " <transition to='c' />" +
+ " </state>" +
+ " <state name='c' />" +
"</process>"
);
Execution execution = executionService.startProcessInstanceByKey("ICL");
+ String executionId = execution.getId();
assertNotNull(execution);
assertEquals("a", execution.getActivityName());
+
+ execution = executionService.signalExecutionById(executionId);
+
+ assertEquals("b", execution.getActivityName());
+
+ RepositoryCache repositoryCache = processEngine.get(RepositoryCache.class);
+ repositoryCache.clear();
+
+ execution = executionService.signalExecutionById(executionId);
+
+ assertEquals("c", execution.getActivityName());
}
}
Modified: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.cfg.xml 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.cfg.xml 2009-03-26 10:38:38 UTC (rev 4331)
@@ -4,10 +4,10 @@
<process-engine-context>
- <object class="org.jbpm.pvm.RepositoryServiceImpl" auto-wire="true" />
- <object class="org.jbpm.pvm.RepositoryCacheImpl" />
+ <object class="org.jbpm.pvm.internal.repository.RepositoryServiceImpl" auto-wire="true" />
+ <object class="org.jbpm.pvm.internal.repository.RepositoryCacheImpl" />
- <object class="org.jbpm.tmp.DeployExecutionService" auto-wire="true" />
+ <object class="org.jbpm.pvm.internal.repository.DeployExecutionService" auto-wire="true" />
<process-service />
<history-service />
@@ -23,16 +23,14 @@
<hibernate-configuration>
<cfg resource="jbpm.hibernate.cfg.xml" />
- <cache-configuration resource="jbpm.cache.xml"
- usage="nonstrict-read-write" />
</hibernate-configuration>
<hibernate-session-factory />
- <object class="org.jbpm.pvm.DeployerManager">
+ <object class="org.jbpm.pvm.internal.repository.DeployerManager">
<field name="deployers">
<list>
- <object class="org.jbpm.jpdl.JpdlDeployer" />
+ <object class="org.jbpm.jpdl.internal.repository.JpdlDeployer" />
</list>
</field>
</object>
@@ -65,7 +63,7 @@
<transaction-context>
<transaction />
- <object class="org.jbpm.pvm.RepositorySessionImpl" auto-wire="true" />
+ <object class="org.jbpm.pvm.internal.repository.RepositorySessionImpl" auto-wire="true" />
<pvm-db-session />
<job-db-session />
Modified: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.execution.hbm.xml 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.execution.hbm.xml 2009-03-26 10:38:38 UTC (rev 4331)
@@ -28,12 +28,8 @@
<discriminator><column name="CLASS_" /></discriminator>
<version name="dbversion" column="DBVERSION_" />
- <many-to-one name="activity"
- class="org.jbpm.pvm.internal.model.ActivityImpl"
- column="ACT_"
- lazy="false"
- foreign-key="FK_EXEC_ACT"
- index="IDX_EXEC_ACT" />
+ <property name="activityName" column="ACTIVITYNAME_" />
+ <property name="processDefinitionId" column="PROCDEFID_" />
<property name="hasVariables" column="HASVARS_" />
<map name="variables"
@@ -63,19 +59,13 @@
<property name="priority" column="PRIORITY_" />
<property name="historyActivityInstanceDbid" column="HISACTINST_" />
- <many-to-one name="processDefinition"
- class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
- column="PROCESS_"
- foreign-key="FK_EXEC_PROCESS"
- index="IDX_EXEC_PROCESS" />
+ <!-- many-to-one name="transition" column="TRANSITION_" class="TransitionImpl" / -->
- <many-to-one name="transition" column="TRANSITION_" class="TransitionImpl" />
-
- <many-to-one name="transitionOrigin"
+ <!-- many-to-one name="transitionOrigin"
class="org.jbpm.pvm.internal.model.ActivityImpl"
column="TRANSORIG_"
foreign-key="FK_EXEC_TRANSORIG"
- index="IDX_EXEC_TRANSORIG" />
+ index="IDX_EXEC_TRANSORIG" / -->
<list name="executions"
cascade="all-delete-orphan"
@@ -212,7 +202,7 @@
<property name="text" type="text" column="TEXT_VALUE_"/>
</class>
- <class name="org.jbpm.pvm.internal.job.JobImpl" table="JBPM_JOB" discriminator-value="Job">
+ <class name="org.jbpm.pvm.internal.job.JobImpl" table="JBPM_JOB" discriminator-value="Job">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -240,21 +230,22 @@
cascade="none"
foreign-key="FK_JOB_EXE"
index="IDX_JOB_EXE"/>
- <many-to-one name="commandDescriptor"
+
+ <!-- many-to-one name="commandDescriptor"
column="CMDDESCR_"
class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
cascade="all"
foreign-key="FK_JOB_CMDDESCR"
- index="IDX_JOB_CMDDESCR"/>
+ index="IDX_JOB_CMDDESCR"/ -->
<subclass name="org.jbpm.pvm.internal.job.MessageImpl" discriminator-value="Msg">
<subclass name="org.jbpm.pvm.internal.model.op.ExecuteActivityMessage" discriminator-value="ExeActivityMsg" />
<subclass name="org.jbpm.pvm.internal.model.op.SignalMessage" discriminator-value="SignalMsg">
<property name="signalName" column="SIGNAL_" />
- <many-to-one name="activity"
+ <!-- many-to-one name="activity"
column="NODE_"
cascade="none"
- foreign-key="FK_JOB_NODE"/>
+ foreign-key="FK_JOB_NODE"/ -->
</subclass>
<subclass name="org.jbpm.pvm.internal.model.op.TakeTransitionMessage" discriminator-value="TakeTrMsg" />
<subclass name="org.jbpm.pvm.internal.model.op.ProceedToDestinationMessage" discriminator-value="ProceedDestMsg" />
@@ -357,20 +348,20 @@
]]>
</query>
- <query name="findExecutionByKey">
+ <!-- query name="findExecutionByKey">
<![CDATA[
select execution
from org.jbpm.pvm.internal.model.ExecutionImpl as execution
where execution.key = :executionKey
and execution.processDefinition.name = :processDefinitionName
]]>
- </query>
+ </query -->
<query name="findProcessInstanceIds">
<![CDATA[
select processInstance.id
from org.jbpm.pvm.internal.model.ExecutionImpl as processInstance
- where processInstance.processDefinition.id = :processDefinitionId
+ where processInstance.processDefinitionId = :processDefinitionId
and processInstance.parent is null
]]>
</query>
Modified: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.hibernate.cfg.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.hibernate.cfg.xml 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.hibernate.cfg.xml 2009-03-26 10:38:38 UTC (rev 4331)
@@ -15,7 +15,6 @@
<property name="hibernate.format_sql">true</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
- <mapping resource="jbpm.definition.hbm.xml" />
<mapping resource="jbpm.execution.hbm.xml" />
<mapping resource="jbpm.history.hbm.xml" />
<mapping resource="jbpm.task.hbm.xml" />
Modified: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.history.hbm.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.history.hbm.xml 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.history.hbm.xml 2009-03-26 10:38:38 UTC (rev 4331)
@@ -18,11 +18,11 @@
<property name="state" column="STATE_" />
<property name="endActivityName" column="ENDACTIVITY_" />
- <many-to-one name="processDefinition"
+ <!-- many-to-one name="processDefinition"
class="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
column="PROCDEF_"
foreign-key="FK_HISTPI_PROCDEF"
- index="IDX_HISTPI_PROCDEF" />
+ index="IDX_HISTPI_PROCDEF" / -->
<set name="historyActivityInstances"
cascade="all">
@@ -48,11 +48,11 @@
foreign-key="FK_HAI_HPI"
index="IDX_HAI_HPI" />
- <many-to-one name="activity"
+ <!-- many-to-one name="activity"
class="org.jbpm.pvm.internal.model.ActivityImpl"
column="ACTIVITY_"
foreign-key="FK_HISTAI_ACT"
- index="IDX_HISTAI_ACT" />
+ index="IDX_HISTAI_ACT" / -->
<property name="type" column="TYPE_" />
<property name="executionId" column="EXECUTION_" />
Modified: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.jpdl.hbm.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.jpdl.hbm.xml 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.jpdl.hbm.xml 2009-03-26 10:38:38 UTC (rev 4331)
@@ -3,7 +3,7 @@
<hibernate-mapping default-access="field">
- <subclass name="org.jbpm.jpdl.internal.model.JpdlProcessDefinition"
+ <!-- subclass name="org.jbpm.jpdl.internal.model.JpdlProcessDefinition"
extends="org.jbpm.pvm.internal.model.ProcessDefinitionImpl"
discriminator-value="jpdl">
<map name="swimlaneDefinitions"
@@ -22,7 +22,7 @@
<map-key type="string" column="NAME_" />
<one-to-many class="org.jbpm.pvm.internal.task.TaskDefinitionImpl" />
</map>
- </subclass>
+ </subclass -->
<subclass name="org.jbpm.jpdl.internal.model.JpdlExecution"
extends="org.jbpm.pvm.internal.model.ExecutionImpl"
@@ -38,7 +38,7 @@
</map>
</subclass>
- <class name="org.jbpm.jpdl.internal.activity.JpdlActivity" table="JBPM_JPDL_ACTIVITY" abstract="true" discriminator-value="X">
+ <!-- class name="org.jbpm.jpdl.internal.activity.JpdlActivity" table="JBPM_JPDL_ACTIVITY" abstract="true" discriminator-value="X">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -118,5 +118,6 @@
index="IDX_ACT_TASKDEF" />
</subclass>
</class>
+ -->
</hibernate-mapping>
\ No newline at end of file
Modified: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.repository.hbm.xml 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.repository.hbm.xml 2009-03-26 10:38:38 UTC (rev 4331)
@@ -4,7 +4,7 @@
<hibernate-mapping default-access="field">
<!-- ### Deployment ##################################################### -->
- <class name="org.jbpm.pvm.DeploymentImpl"
+ <class name="org.jbpm.pvm.internal.repository.DeploymentImpl"
table="JBPM_DEPLOYMENT">
<!-- ProcessElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
@@ -26,17 +26,17 @@
table="JBPM_DEPLOYPROPS"
cascade="all">
<key column="DEPLOYMENT_" />
- <one-to-many class="org.jbpm.pvm.DeploymentProperty" />
+ <one-to-many class="org.jbpm.pvm.internal.repository.DeploymentProperty" />
</set>
</class>
- <class name="org.jbpm.pvm.DeploymentProperty" table="JBPM_DEPLOYPROP">
+ <class name="org.jbpm.pvm.internal.repository.DeploymentProperty" table="JBPM_DEPLOYPROP">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
<many-to-one name="deployment"
- class="org.jbpm.pvm.DeploymentImpl"
+ class="org.jbpm.pvm.internal.repository.DeploymentImpl"
column="DEPLOYMENT_"
foreign-key="FK_DEPLPROP_DEPL"
index="IDX_DEPLPROP_DEPL" />
Modified: jbpm4/trunk/modules/deployment/src/test/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/trunk/modules/deployment/src/test/resources/jbpm.task.hbm.xml 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/deployment/src/test/resources/jbpm.task.hbm.xml 2009-03-26 10:38:38 UTC (rev 4331)
@@ -4,7 +4,7 @@
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping auto-import="false" package="org.jbpm.pvm.internal.task" default-access="field">
- <!-- ### ASSIGNABLE DEFINITIONS ######################################### -->
+ <!-- ### ASSIGNABLE DEFINITIONS #########################################
<class name="AssignableDefinitionImpl"
table="JBPM_ASSIGNDEF"
discriminator-value="A" >
@@ -32,8 +32,9 @@
<subclass name="SwimlaneDefinitionImpl" discriminator-value="S">
</subclass>
+ -->
- <!-- ### TASK DEFINITION ################################################ -->
+ <!-- ### TASK DEFINITION ################################################
<subclass name="TaskDefinitionImpl" discriminator-value="T">
<property name="priority" column="PRIORITY_"/>
@@ -60,6 +61,7 @@
</list>
</subclass>
</class>
+ -->
<!-- ### TASK ########################################################### -->
<class name="TaskImpl"
@@ -116,11 +118,11 @@
column="SWIMLANE_"
foreign-key="FK_TASK_SWIML" />
- <many-to-one name="taskDefinition"
+ <!-- many-to-one name="taskDefinition"
column="TASKDEF_"
class="org.jbpm.pvm.internal.task.TaskDefinitionImpl"
foreign-key="FK_TSK_TASKDEF"
- index="IDX_TSK_TASKDEF" />
+ index="IDX_TSK_TASKDEF" / -->
<list name="comments" cascade="all-delete-orphan">
<key column="TASK_" />
@@ -169,10 +171,10 @@
<property name="name" column="NAME_"/>
<property name="assignee" column="ASSIGNEE_"/>
- <many-to-one name="swimlaneDefinition"
+ <!-- many-to-one name="swimlaneDefinition"
class="SwimlaneDefinitionImpl"
column="SWIMLANEDEF_"
- foreign-key="FK_SWIMLANE_DEF" />
+ foreign-key="FK_SWIMLANE_DEF" / -->
<many-to-one name="execution"
class="org.jbpm.pvm.internal.model.ExecutionImpl"
Added: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java
===================================================================
--- jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java (rev 0)
+++ jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,127 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.jpdl.internal.repository;
+
+import java.io.InputStream;
+import java.util.List;
+
+import org.jbpm.env.Environment;
+import org.jbpm.internal.log.Log;
+import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.repository.Deployer;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
+import org.jbpm.pvm.internal.repository.api.RepositorySession;
+import org.jbpm.pvm.internal.xml.Parse;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class JpdlDeployer implements Deployer {
+
+ private static Log log = Log.getLog(JpdlDeployer.class.getName());
+
+ static JpdlParser jpdlParser = new JpdlParser();
+
+ public void deploy(DeploymentImpl deployment) {
+
+ for (String resourceName: deployment.getResourceNames()) {
+ InputStream inputStream = deployment.getResourceAsStream(resourceName);
+
+ Parse parse = jpdlParser.createParse();
+ parse.setProblems(deployment.getProblems());
+ parse.setInputStream(inputStream);
+ parse.execute();
+
+ JpdlProcessDefinition processDefinition =
+ (JpdlProcessDefinition) parse.getDocumentObject();
+
+ if ( (processDefinition!=null)
+ && (processDefinition.getName()!=null)
+ ) {
+ String processDefinitionName = processDefinition.getName();
+
+ processDefinition.setDeploymentDbid(deployment.getDbid());
+
+ String key = deployment.getObjectProperty(processDefinitionName, "jpdl.key");
+ if (key!=null) {
+ String id = deployment.getObjectProperty(processDefinitionName, "jpdl.id");
+ processDefinition.setId(id);
+ processDefinition.setKey(key);
+ deployment.addObject(processDefinitionName, processDefinition);
+
+ } else {
+ checkKey(processDefinition, deployment);
+ checkId(processDefinition, deployment);
+
+ deployment.addObject(processDefinitionName, processDefinition);
+ deployment.addObjectProperty(processDefinitionName, "jpdl.key", processDefinition.getKey());
+ deployment.addObjectProperty(processDefinitionName, "jpdl.id", processDefinition.getId());
+ }
+ }
+ }
+ }
+
+ protected void checkKey(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
+ String processDefinitionName = processDefinition.getName();
+ String processDefinitionKey = processDefinition.getKey();
+
+ // if no key was specified in the jpdl process file
+ if (processDefinitionKey==null) {
+ // derive the key from the name
+ // replace any non-word character with an underscore
+ processDefinitionKey = processDefinitionName.replaceAll("\\W", "_");
+ processDefinition.setKey(processDefinitionKey);
+ }
+
+ RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
+ List<String> existingKeys = repositorySession.findObjectPropertyValues(processDefinitionName, "jpdl.key");
+ if ( (!existingKeys.isEmpty())
+ && existingKeys.get(0).equals(processDefinitionKey)
+ ) {
+ deployment.addProblem("invalid key '"+processDefinitionKey+"' in process "+processDefinition.getName()+". Existing process has name '"+processDefinitionName+"' and key '"+processDefinitionKey+"'");
+ }
+
+ List<String> existingNames = repositorySession.findObjectNames("jpdl.key", processDefinitionKey);
+ if ( (!existingNames.isEmpty())
+ && existingNames.get(0).equals(processDefinitionName)
+ ) {
+ deployment.addProblem("invalid name '"+processDefinitionName+"' in process "+processDefinition.getName()+". Existing process has name '"+processDefinitionName+"' and key '"+processDefinitionKey+"'");
+ }
+ }
+
+ protected void checkId(ProcessDefinitionImpl processDefinition, DeploymentImpl deployment) {
+ String id = processDefinition.getId();
+ if (id==null) {
+ id = processDefinition.getKey()+"-"+deployment.getDbid();
+ log.trace("created id '"+id+"' for "+processDefinition);
+ processDefinition.setId(id);
+ }
+
+ RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
+ if (repositorySession.findObjectByPropertyValue("jpdl.id", id) != null) {
+ deployment.addProblem("process '" + id + "' already exists");
+ }
+ }
+}
Property changes on: jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ActivityImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ActivityImpl.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ActivityImpl.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -69,7 +69,7 @@
return activity;
}
- public Activity findActivity(String activityName) {
+ public ActivityImpl findActivity(String activityName) {
if (activityName==null) {
if (name==null) {
return this;
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CompositeElementImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CompositeElementImpl.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/CompositeElementImpl.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -112,10 +112,10 @@
return ((getActivitiesMap()!=null) && (activitiesMap.containsKey(activityName)));
}
- public Activity findActivity(String activityName) {
+ public ActivityImpl findActivity(String activityName) {
if (activities!=null) {
for(ActivityImpl n : activities) {
- Activity activity = n.findActivity(activityName);
+ ActivityImpl activity = n.findActivity(activityName);
if (activity!=null) {
return activity;
}
Modified: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-03-26 10:28:42 UTC (rev 4330)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -68,6 +68,7 @@
import org.jbpm.pvm.internal.model.op.ProceedToDestination;
import org.jbpm.pvm.internal.model.op.Signal;
import org.jbpm.pvm.internal.model.op.TakeTransition;
+import org.jbpm.pvm.internal.repository.api.RepositorySession;
import org.jbpm.pvm.internal.util.EqualsUtil;
import org.jbpm.pvm.internal.util.Priority;
import org.jbpm.session.MessageSession;
@@ -105,10 +106,12 @@
/** a unique id for this execution. */
protected String id;
- protected ProcessDefinitionImpl processDefinition;
+ protected String processDefinitionId;
+ private ProcessDefinitionImpl processDefinition;
/** current activity */
- protected ActivityImpl activity;
+ protected String activityName;
+ private ActivityImpl activity;
/** are concurrent executions that related to this execution. */
protected Collection<ExecutionImpl> executions;
@@ -171,8 +174,8 @@
// construction /////////////////////////////////////////////////////////////
public void initializeProcessInstance(ProcessDefinitionImpl processDefinition, String key) {
- this.processDefinition = processDefinition;
- this.activity = (ActivityImpl) processDefinition.getInitial();
+ setProcessDefinition(processDefinition);
+ setActivity ( (ActivityImpl) processDefinition.getInitial() );
this.processInstance = this;
this.state = STATE_CREATED;
this.key = key;
@@ -193,8 +196,8 @@
ExecutionImpl scopedExecution = initializeScopes();
fireHistoryEvent(new ProcessInstanceStart());
- fire(Event.START, processDefinition);
- if (activity!=null) {
+ fire(Event.START, getProcessDefinition());
+ if (getActivity()!=null) {
scopedExecution.performAtomicOperation(EXECUTE_ACTIVITY);
}
}
@@ -202,7 +205,7 @@
protected ExecutionImpl initializeScopes() {
LinkedList<ActivityImpl> enteredActivities = new LinkedList<ActivityImpl>();
- ActivityImpl initial = processDefinition.getInitial();
+ ActivityImpl initial = getProcessDefinition().getInitial();
ExecutionImpl scopedExecution = null;
if (initial!=null) {
@@ -215,8 +218,8 @@
scopedExecution = this;
- initializeVariables(processDefinition, this);
- initializeTimers(processDefinition);
+ initializeVariables(getProcessDefinition(), this);
+ initializeTimers(getProcessDefinition());
for (ActivityImpl enteredActivity: enteredActivities) {
if (enteredActivity.isLocalScope()) {
@@ -318,7 +321,7 @@
} else { // this is a process instance
fireHistoryEvent(new ProcessInstanceEnd());
- fire(Event.END, processDefinition);
+ fire(Event.END, getProcessDefinition());
if (superProcessExecution!=null) {
log.trace(toString()+" signals super process execution");
superProcessExecution.signal();
@@ -380,8 +383,8 @@
public void signal(String signal, Map<String, Object> parameters) {
checkLock();
- if (activity!=null) {
- performAtomicOperation(new Signal(signal, parameters, activity));
+ if (getActivity()!=null) {
+ performAtomicOperation(new Signal(signal, parameters, getActivity()));
} else if (transition!=null) {
performAtomicOperation(ExecutionImpl.PROCEED_TO_DESTINATION);
} else {
@@ -409,21 +412,21 @@
/** @see Execution#takeDefaultTransition() */
public void takeDefaultTransition() {
- TransitionImpl defaultTransition = activity.getDefaultTransition();
+ TransitionImpl defaultTransition = getActivity().getDefaultTransition();
if (defaultTransition==null) {
- throw new JbpmException("there is no default transition in "+activity);
+ throw new JbpmException("there is no default transition in "+getActivity());
}
take(defaultTransition);
}
/** @see Execution#take(String) */
public void take(String transitionName) {
- if (activity==null) {
+ if (getActivity()==null) {
throw new JbpmException(toString()+" is not positioned in activity");
}
TransitionImpl transition = findTransition(transitionName);
if (transition==null) {
- throw new JbpmException("there is no transition "+transitionName+" in "+activity);
+ throw new JbpmException("there is no transition "+transitionName+" in "+getActivity());
}
take(transition);
}
@@ -450,12 +453,12 @@
/** @see Execution#execute(String) */
public void execute(String activityName) {
- if (activity==null) {
+ if (getActivity()==null) {
throw new JbpmException("activity is null");
}
- Activity nestedActivity = activity.getActivity(activityName);
+ Activity nestedActivity = getActivity().getActivity(activityName);
if (nestedActivity==null) {
- throw new JbpmException("activity "+activityName+" doesn't exist in "+activity);
+ throw new JbpmException("activity "+activityName+" doesn't exist in "+getActivity());
}
execute(nestedActivity);
}
@@ -492,7 +495,7 @@
// there is no default transition and that there is a
// parent activity of the current activity
} else {
- ActivityImpl parentActivity = activity.getParentActivity();
+ ActivityImpl parentActivity = getActivity().getParentActivity();
// if there is a parent activity
if (parentActivity!=null) {
@@ -530,7 +533,7 @@
}
// move the execution to the destination
- activity = destination;
+ setActivity(destination);
transition = null;
transitionOrigin = null;
}
@@ -771,9 +774,9 @@
// create child execution
ExecutionImpl childExecution = newChildExecution();
- childExecution.processDefinition = this.processDefinition;
+ childExecution.setProcessDefinition(getProcessDefinition());
+ childExecution.setActivity(getActivity());
childExecution.processInstance = this.processInstance;
- childExecution.activity = this.activity;
childExecution.state = STATE_ACTIVE;
childExecution.name = name;
log.debug("creating "+childExecution);
@@ -784,7 +787,7 @@
IdGenerator keyGenerator = Environment.getFromCurrent(IdGenerator.class, false);
if (keyGenerator!=null) {
- childExecution.id = keyGenerator.createId(processDefinition, this, childExecution);
+ childExecution.id = keyGenerator.createId(getProcessDefinition(), this, childExecution);
}
return childExecution;
@@ -910,15 +913,6 @@
}
}
- // activity name ////////////////////////////////////////////////////////////////
-
- public String getActivityName() {
- if (activity==null) {
- return null;
- }
- return activity.getName();
- }
-
////////////////////////////////////////////////////////////////////////////////
public void fireHistoryEvent(HistoryEvent historyEvent) {
@@ -949,11 +943,11 @@
* of the current activity. This method allows process languages to overwrite this default
* implementation of the transition lookup by transitionName.*/
protected TransitionImpl findTransition(String transitionName) {
- return activity.findOutgoingTransition(transitionName);
+ return getActivity().findOutgoingTransition(transitionName);
}
protected TransitionImpl findDefaultTransition() {
- return activity.findDefaultTransition();
+ return getActivity().findDefaultTransition();
}
// history //////////////////////////////////////////////////////////////////
@@ -1000,7 +994,51 @@
public boolean equals(Object o) {
return EqualsUtil.equals(this, o);
}
+
+ // special getters and setters /////////////////////////////////////////////////
+
+ public ActivityImpl getActivity() {
+ if ( (activity==null)
+ && (activityName!=null)
+ ) {
+ activity = getProcessDefinition().findActivity(activityName);
+ }
+ return activity;
+ }
+
+ public void setActivity(ActivityImpl activity) {
+ this.activity = activity;
+ if (activity!=null) {
+ this.activityName = activity.getName();
+ } else {
+ this.activityName = null;
+ }
+ }
+ public String getActivityName() {
+ if (getActivity()!=null) {
+ return getActivity().getName();
+ }
+ return null;
+ }
+
+ public ProcessDefinitionImpl getProcessDefinition() {
+ if ( (processDefinition==null)
+ && (processDefinitionId!=null)
+ ) {
+ RepositorySession repositorySession = Environment.getFromCurrent(RepositorySession.class);
+ processDefinition = (ProcessDefinitionImpl) repositorySession.findObjectByPropertyValue("jpdl.id", processDefinitionId);
+ if (processDefinition==null) {
+ throw new JbpmException("couldn't find process definition "+processDefinitionId+" in the repository");
+ }
+ }
+ return processDefinition;
+ }
+ public void setProcessDefinition(ProcessDefinitionImpl processDefinition) {
+ this.processDefinition = processDefinition;
+ this.processDefinitionId = processDefinition.getId();
+ }
+
// getters and setters /////////////////////////////////////////////////////////
public boolean isProcessInstance() {
@@ -1032,9 +1070,6 @@
public int getPriority() {
return priority;
}
- public ProcessDefinitionImpl getProcessDefinition() {
- return processDefinition;
- }
public TransitionImpl getTransition() {
return transition;
}
@@ -1098,9 +1133,6 @@
public void setPreviousTransition(Transition previousTransition) {
this.previousTransition = previousTransition;
}
- public void setProcessDefinition(ProcessDefinitionImpl processDefinition) {
- this.processDefinition = processDefinition;
- }
public ExecutionImpl getSuperProcessExecution() {
return superProcessExecution;
}
@@ -1113,12 +1145,6 @@
public void setSubProcessInstance(ExecutionImpl subProcessExecution) {
this.subProcessInstance = subProcessExecution;
}
- public ActivityImpl getActivity() {
- return activity;
- }
- public void setActivity(ActivityImpl activity) {
- this.activity = activity;
- }
public void setKey(String key) {
this.key = key;
}
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.pvm.internal.repository;
+
+import org.jbpm.JbpmException;
+import org.jbpm.cmd.Command;
+import org.jbpm.env.Environment;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.repository.api.RepositorySession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeployCmd implements Command<Long> {
+
+ private static final long serialVersionUID = 1L;
+
+ private static Log log = Log.getLog(DeployCmd.class.getName());
+
+ DeploymentImpl deployment;
+
+ public DeployCmd(DeploymentImpl deployment) {
+ this.deployment = deployment;
+ }
+
+ public Long execute(Environment environment) throws Exception {
+ RepositorySession repositorySession = environment.get(RepositorySession.class);
+ long deploymentDbid = repositorySession.deploy(deployment);
+
+ if (deployment.hasProblems()) {
+ String problemsText = deployment.getProblemsText();
+ if (problemsText!=null) {
+ String errorMsg = "problems during deployment of "+deployment+": "+problemsText;
+ log.info(errorMsg);
+ throw new JbpmException(errorMsg);
+ }
+ }
+
+ return deploymentDbid;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployCmd.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployExecutionService.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployExecutionService.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployExecutionService.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.pvm.internal.repository;
+
+import org.jbpm.Execution;
+import org.jbpm.pvm.internal.svc.ExecutionServiceImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeployExecutionService extends ExecutionServiceImpl {
+
+ public Execution startProcessInstanceByKey(String processDefinitionKey) {
+ return commandService.execute(new StartExecutionInLatestCmd(processDefinitionKey, null, null));
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployExecutionService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/Deployer.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/Deployer.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/Deployer.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.pvm.internal.repository;
+
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface Deployer {
+
+ void deploy(DeploymentImpl deployment);
+
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/Deployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployerManager.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployerManager.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployerManager.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.pvm.internal.repository;
+
+import java.util.List;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeployerManager {
+
+ List<Deployer> deployers;
+
+ public Object deploy(DeploymentImpl deployment) {
+ for (Deployer deployer: deployers) {
+ deployer.deploy(deployment);
+ }
+ return null;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeployerManager.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,171 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.pvm.internal.repository;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.ObjectStreamException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+import org.jbpm.JbpmException;
+import org.jbpm.cmd.CommandService;
+import org.jbpm.pvm.internal.lob.Lob;
+import org.jbpm.pvm.internal.repository.api.Deployment;
+import org.jbpm.pvm.internal.stream.ByteArrayStreamInput;
+import org.jbpm.pvm.internal.stream.StreamInput;
+import org.jbpm.pvm.internal.util.IoUtil;
+import org.jbpm.pvm.internal.xml.ProblemList;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeploymentImpl extends ProblemList implements Deployment {
+
+ protected long dbid;
+ protected String name;
+ protected long timestamp;
+
+ protected Map<String, Lob> resources;
+
+ protected CommandService commandService;
+
+ protected Map<String, Object> objects;
+ protected Set<DeploymentProperty> objectProperties;
+
+ public DeploymentImpl() {
+ }
+
+ public DeploymentImpl(CommandService commandService) {
+ this.commandService = commandService;
+ }
+
+ public long deploy() {
+ return commandService.execute(new DeployCmd(this));
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setTimestamp(long timestamp) {
+ this.timestamp = timestamp;
+ }
+
+ public Deployment addStreamInput(String name, StreamInput streamInput) {
+ if (resources==null) {
+ resources = new HashMap<String, Lob>();
+ }
+ byte[] bytes = IoUtil.readBytes(streamInput.openStream());
+ Lob lob = new Lob(bytes);
+ resources.put(name, lob);
+ return this;
+ }
+
+ public Deployment addZipInputStream(ZipInputStream zipInputStream) {
+ try {
+ ZipEntry zipEntry = zipInputStream.getNextEntry();
+ while(zipEntry!=null) {
+ String entryName = zipEntry.getName();
+ byte[] bytes = IoUtil.readBytes(zipInputStream);
+ if (bytes!=null) {
+ addStreamInput(entryName, new ByteArrayStreamInput(bytes));
+ }
+ zipEntry = zipInputStream.getNextEntry();
+ }
+ } catch (Exception e) {
+ throw new JbpmException("couldn't read zip archive", e);
+ }
+ return this;
+ }
+
+ public Set<String> getResourceNames() {
+ if (resources==null) {
+ return Collections.EMPTY_SET;
+ }
+ return resources.keySet();
+ }
+
+ public InputStream getResourceAsStream(String resourceName) {
+ if (resources!=null) {
+ Lob lob = resources.get(resourceName);
+ if (lob!=null) {
+ byte[] bytes = lob.extractBytes();
+ return new ByteArrayInputStream(bytes);
+ }
+ }
+ return null;
+ }
+
+ public void addObject(String objectName, Object object) {
+ if (objects==null) {
+ objects = new HashMap<String, Object>();
+ }
+ objects.put(objectName, object);
+ }
+
+ public void addObjectProperty(String objectName, String key, String value) {
+ if (objectProperties==null) {
+ objectProperties = new HashSet<DeploymentProperty>();
+ }
+ objectProperties.add(new DeploymentProperty(this, objectName, key, value));
+ }
+
+ public String getObjectProperty(String objectName, String key) {
+ if (objectProperties!=null) {
+ for (DeploymentProperty deploymentProperty: objectProperties) {
+ if ( (deploymentProperty.getObjectName().equals(objectName))
+ && (deploymentProperty.getKey().equals(key))
+ ) {
+ return deploymentProperty.getValue();
+ }
+ }
+ }
+ return null;
+ }
+
+ protected Object writeReplace() throws ObjectStreamException {
+ commandService = null;
+ return this;
+ }
+
+ public long getDbid() {
+ return dbid;
+ }
+ public String getName() {
+ return name;
+ }
+ public long getTimestamp() {
+ return timestamp;
+ }
+ public Map<String, Object> getObjects() {
+ return objects;
+ }
+ public Set<DeploymentProperty> getObjectProperties() {
+ return objectProperties;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentProperty.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentProperty.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentProperty.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.pvm.internal.repository;
+
+import java.io.Serializable;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class DeploymentProperty implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ long dbid;
+ protected DeploymentImpl deployment;
+ protected String objectName;
+ protected String key;
+ protected String value;
+
+ public DeploymentProperty() {
+ }
+
+ public DeploymentProperty(DeploymentImpl deployment, String objectName, String key, String value) {
+ this.deployment = deployment;
+ this.objectName = objectName;
+ this.key = key;
+ this.value = value;
+ }
+
+ public String toString() {
+ return "{"+objectName+","+key+","+value+"}";
+ }
+
+ public String getObjectName() {
+ return objectName;
+ }
+ public String getKey() {
+ return key;
+ }
+ public String getValue() {
+ return value;
+ }
+ public DeploymentImpl getDeployment() {
+ return deployment;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentProperty.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCache.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCache.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCache.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,35 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.pvm.internal.repository;
+
+import java.util.Map;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface RepositoryCache {
+
+ void set(long deploymentdbid, Map<String, Object> deployedObjects);
+ Object get(long deploymentDbid, String objectName);
+ void clear();
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCache.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCacheImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCacheImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCacheImpl.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.pvm.internal.repository;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class RepositoryCacheImpl implements RepositoryCache {
+
+ Map<Long, Map<String, Object>> deployments = new HashMap<Long, Map<String,Object>>();
+
+ public Object get(long deploymentDbid, String objectName) {
+ Map<String, Object> deploymentObjects = deployments.get(deploymentDbid);
+ if (deploymentObjects==null) {
+ return null;
+ }
+ return deploymentObjects.get(objectName);
+ }
+
+ public void set(long deploymentDbid, Map<String, Object> objects) {
+ Map<String, Object> deploymentObjects = deployments.get(deploymentDbid);
+ if (deploymentObjects==null) {
+ deploymentObjects = new HashMap<String, Object>();
+ deployments.put(deploymentDbid, deploymentObjects);
+ }
+ for (String objectName: objects.keySet()) {
+ Object object = objects.get(objectName);
+ deploymentObjects.put(objectName, object);
+ }
+ }
+
+ public void clear() {
+ deployments = new HashMap<Long, Map<String,Object>>();
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCacheImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.pvm.internal.repository;
+
+import java.io.InputStream;
+
+import org.jbpm.cmd.CommandService;
+import org.jbpm.pvm.internal.repository.api.Deployment;
+import org.jbpm.pvm.internal.repository.api.RepositoryService;
+
+/**
+ * @author Tom Baeyens
+ */
+public class RepositoryServiceImpl implements RepositoryService {
+
+ CommandService commandService;
+
+ public Deployment createDeployment() {
+ return new DeploymentImpl(commandService);
+ }
+
+ public void deleteDeployment(long deploymentdbid) {
+ }
+
+ public InputStream getResource(String deploymentId, String resource) {
+ return null;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,123 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.pvm.internal.repository;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hibernate.Session;
+import org.jbpm.JbpmException;
+import org.jbpm.Problem;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.repository.api.RepositorySession;
+
+/**
+ * @author Tom Baeyens
+ */
+public class RepositorySessionImpl implements RepositorySession {
+
+ private static Log log = Log.getLog(RepositorySessionImpl.class.getName());
+
+ Session session;
+ RepositoryCache repositoryCache;
+ DeployerManager deployerManager;
+
+ public long deploy(DeploymentImpl deployment) {
+ session.save(deployment);
+
+ deployment.setTimestamp(System.currentTimeMillis());
+ deployment.setProblems(new ArrayList<Problem>());
+
+ deployerManager.deploy(deployment);
+
+ if (deployment.hasProblems()) {
+ for (Problem problem: deployment.getProblems()) {
+ Throwable cause = problem.getCause();
+ if (cause!=null) {
+ log.debug("deployment exception", cause);
+ }
+ }
+ throw new JbpmException("problems during deployment: "+deployment.getProblemsText());
+ } else {
+
+ repositoryCache.set(deployment.getDbid(), deployment.getObjects());
+ }
+
+ return deployment.getDbid();
+ }
+
+ public Object getObject(long deploymentDbid, String objectName) {
+ Object object = repositoryCache.get(deploymentDbid, objectName);
+ if (object!=null) {
+ log.trace("repository cache hit");
+
+ } else {
+ log.trace("loading deployment "+deploymentDbid+" from db");
+ DeploymentImpl deployment = (DeploymentImpl) session.load(DeploymentImpl.class, deploymentDbid);
+ deploy(deployment);
+
+ object = repositoryCache.get(deploymentDbid, objectName);
+
+ if (object==null) {
+ throw new JbpmException("deployment "+deploymentDbid+" doesn't contain object "+objectName);
+ }
+ }
+ return object;
+ }
+
+ public Object findObjectByPropertyValue(String key, String value) {
+ DeploymentProperty deploymentProperty = (DeploymentProperty) session.createQuery(
+ "select deploymentProperty " +
+ "from "+DeploymentProperty.class.getName()+" as deploymentProperty " +
+ "where deploymentProperty.key = '"+key+"' " +
+ " and deploymentProperty.value = '"+value+"' " +
+ "order by deploymentProperty.deployment.timestamp desc "
+ ).uniqueResult();
+
+ if (deploymentProperty!=null) {
+ long deploymentDbid = deploymentProperty.getDeployment().getDbid();
+ String objectName = deploymentProperty.getObjectName();
+
+ return getObject(deploymentDbid, objectName);
+ }
+
+ return null;
+ }
+
+ public List<String> findObjectNames(String key, String value) {
+ return session.createQuery(
+ "select distinct deploymentProperty.objectName " +
+ "from "+DeploymentProperty.class.getName()+" as deploymentProperty " +
+ "where deploymentProperty.key = '"+key+"' " +
+ " and deploymentProperty.value = '"+value+"' "
+ ).list();
+ }
+
+ public List<String> findObjectPropertyValues(String objectName, String key) {
+ return session.createQuery(
+ "select distinct deploymentProperty.value " +
+ "from "+DeploymentProperty.class.getName()+" as deploymentProperty " +
+ "where deploymentProperty.objectName = '"+objectName+"' " +
+ " and deploymentProperty.key = '"+key+"' "
+ ).list();
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/StartExecutionInLatestCmd.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/StartExecutionInLatestCmd.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/StartExecutionInLatestCmd.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.pvm.internal.repository;
+
+import java.util.Map;
+
+import org.hibernate.Session;
+import org.jbpm.Execution;
+import org.jbpm.JbpmException;
+import org.jbpm.client.ClientProcessDefinition;
+import org.jbpm.client.ClientProcessInstance;
+import org.jbpm.env.Environment;
+import org.jbpm.pvm.internal.cmd.VariablesCmd;
+import org.jbpm.pvm.internal.repository.api.RepositorySession;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class StartExecutionInLatestCmd extends VariablesCmd<Execution> {
+
+ private static final long serialVersionUID = 1L;
+
+ protected String processDefinitionKey;
+ protected String executionKey;
+
+ public StartExecutionInLatestCmd(String processDefinitionKey, Map<String, Object> variables, String executionKey) {
+ if (processDefinitionKey==null) {
+ throw new JbpmException("processDefinitionKey is null");
+ }
+ this.processDefinitionKey = processDefinitionKey;
+ this.variables = variables;
+ this.executionKey = executionKey;
+ }
+
+ public Execution execute(Environment environment) throws Exception {
+ ClientProcessDefinition processDefinition = null;
+
+ RepositorySession repositorySession = environment.get(RepositorySession.class);
+ processDefinition = (ClientProcessDefinition) repositorySession
+ .findObjectByPropertyValue("jpdl.key", processDefinitionKey);
+
+ if (processDefinition==null) {
+ throw new JbpmException("no process definition with key '"+processDefinitionKey+"'");
+ }
+
+ ClientProcessInstance processInstance = processDefinition.createProcessInstance(executionKey);
+ processInstance.setVariables(variables);
+ processInstance.start();
+
+ Session session = Environment.getFromCurrent(Session.class);
+ session.save(processInstance);
+ return processInstance;
+ }
+
+ public String getExecutionKey() {
+ return executionKey;
+ }
+ public void setExecutionKey(String executionKey) {
+ this.executionKey = executionKey;
+ }
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/StartExecutionInLatestCmd.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/Deployment.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/Deployment.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/Deployment.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.pvm.internal.repository.api;
+
+import java.util.zip.ZipInputStream;
+
+import org.jbpm.pvm.internal.stream.StreamInput;
+
+/**
+ * @author Tom Baeyens
+ */
+public interface Deployment {
+
+ void setName(String name);
+
+ Deployment addStreamInput(String name, StreamInput streamInput);
+ Deployment addZipInputStream(ZipInputStream zipInputStream);
+
+ /** @return deploymentId */
+ long deploy();
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/Deployment.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositoryService.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositoryService.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositoryService.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.pvm.internal.repository.api;
+
+import java.io.InputStream;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface RepositoryService {
+
+ public abstract Deployment createDeployment();
+
+ public abstract void deleteDeployment(long deploymentDbid);
+
+ public abstract InputStream getResource(String deploymentId, String resource);
+
+}
\ No newline at end of file
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositoryService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositorySession.java
===================================================================
--- jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositorySession.java (rev 0)
+++ jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositorySession.java 2009-03-26 10:38:38 UTC (rev 4331)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.pvm.internal.repository.api;
+
+import java.util.List;
+
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public interface RepositorySession {
+
+ Object getObject(long deploymentDbid, String objectName);
+
+ long deploy(DeploymentImpl deployment);
+
+ List<String> findObjectNames(String propertyKey, String propertyValue);
+ List<String> findObjectPropertyValues(String objectName, String propertyKey);
+ Object findObjectByPropertyValue(String propertyKey, String propertyValue);
+}
Property changes on: jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/api/RepositorySession.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
More information about the jbpm-commits
mailing list