+/*
+ * Copyright (C) 2007-2012 Argeo GmbH
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.argeo.slc.jcr.execution;
-import java.util.List;
import java.util.UUID;
import javax.jcr.Node;
import org.argeo.jcr.JcrUtils;
import org.argeo.slc.SlcException;
+import org.argeo.slc.core.execution.DefaultAgent;
import org.argeo.slc.core.execution.ProcessThread;
-import org.argeo.slc.core.runtime.DefaultAgent;
import org.argeo.slc.execution.ExecutionModulesManager;
import org.argeo.slc.execution.ExecutionProcess;
import org.argeo.slc.jcr.SlcJcrConstants;
import org.argeo.slc.jcr.SlcNames;
import org.argeo.slc.jcr.SlcTypes;
-import org.argeo.slc.runtime.SlcAgent;
-import org.argeo.slc.runtime.SlcAgentFactory;
/** SLC VM agent synchronizing with a JCR repository. */
-public class JcrAgent extends DefaultAgent implements SlcAgentFactory, SlcNames {
+public class JcrAgent extends DefaultAgent implements SlcNames {
private Repository repository;
- /** only one agent per VM is currently supported */
- private final String agentNodeName = "default";
+ private String agentNodeName = "default";
/*
* LIFECYCLE
protected ProcessThread createProcessThread(
ThreadGroup processesThreadGroup,
ExecutionModulesManager modulesManager, ExecutionProcess process) {
- return new JcrProcessThread(processesThreadGroup, modulesManager,
- (JcrExecutionProcess) process);
- }
-
- /*
- * SLC AGENT FACTORY
- */
- public SlcAgent getAgent(String uuid) {
- if (!uuid.equals(getAgentUuid()))
- throw new SlcException("Internal UUID " + getAgentUuid()
- + " is different from argument UUID " + uuid);
- return this;
- }
-
- public void pingAll(List<String> activeAgentIds) {
- ping();
+ if (process instanceof JcrProcessThread)
+ return new JcrProcessThread(processesThreadGroup, modulesManager,
+ (JcrExecutionProcess) process);
+ else
+ return super.createProcessThread(processesThreadGroup,
+ modulesManager, process);
}
/*
this.repository = repository;
}
+ public void setAgentNodeName(String agentNodeName) {
+ this.agentNodeName = agentNodeName;
+ }
+
}