Skip to content
Snippets Groups Projects
Commit 84987bb7 authored by Constantin Jucovschi's avatar Constantin Jucovschi
Browse files

first very promising results

parent 73b9840d
No related branches found
No related tags found
No related merge requests found
Showing
with 81 additions and 64 deletions
/home/costea/workspace_sally4/sally4.git/MathHubWorker/target/MathHubWorker-0.0.2-SNAPSHOT.jar
\ No newline at end of file
/home/costea/workspace_sally4/sally4.git/MathHubWorker/target/MathHubWorker-0.0.3-SNAPSHOT.jar
\ No newline at end of file
/home/costea/workspace_sally4/sally4.git/activemq/target/activemq-0.0.2-SNAPSHOT.jar
\ No newline at end of file
/home/costea/workspace_sally4/sally4.git/activemq/target/activemq-0.0.3-SNAPSHOT.jar
\ No newline at end of file
/home/costea/workspace_sally4/sally4.git/core/target/core-0.0.2-SNAPSHOT.jar
\ No newline at end of file
/home/costea/workspace_sally4/sally4.git/core/target/core-0.0.3-SNAPSHOT.jar
\ No newline at end of file
/home/costea/workspace_sally4/sally4.git/docmanager/target/docmanager-0.0.2-SNAPSHOT.jar
\ No newline at end of file
/home/costea/workspace_sally4/sally4.git/docmanager/target/docmanager-0.0.3-SNAPSHOT.jar
\ No newline at end of file
/home/costea/workspace_sally4/sally4.git/planetary/target/planetary-0.0.2-SNAPSHOT.jar
\ No newline at end of file
/home/costea/workspace_sally4/sally4.git/planetary/target/planetary-0.0.3-SNAPSHOT.jar
\ No newline at end of file
/home/costea/workspace_sally4/sally4.git/servlet/target/servlet-0.0.2-SNAPSHOT.jar
\ No newline at end of file
/home/costea/workspace_sally4/sally4.git/servlet/target/servlet-0.0.3-SNAPSHOT.jar
\ No newline at end of file
/home/costea/workspace_sally4/sally4.git/utils/target/utils-0.0.3-SNAPSHOT.jar
\ No newline at end of file
/home/costea/workspace_sally4/sally4.git/Felix/bundle/web/org.apache.felix.ipojo.webconsole-1.7.0.jar
\ No newline at end of file
/home/costea/workspace_sally4/sally4.git/Felix/bundle/web/org.apache.felix.webconsole-4.2.2-all.jar
\ No newline at end of file
File added
File added
package info.kwarc.sally4.mathhubworker;
import info.kwarc.sally.comm.planetaryclient.NewService;
import info.kwarc.sally.comm.planetaryclient.RemoveService;
public interface PlanetaryClient {
void newService(NewService service);
void stopService(RemoveService service);
}
package info.kwarc.sally4.mathhubworker.factories;
import info.kwarc.sally4.docmanager.SallyDoc;
import java.util.Dictionary;
import java.util.Hashtable;
import org.apache.felix.ipojo.ComponentInstance;
import org.apache.felix.ipojo.ConfigurationException;
import org.apache.felix.ipojo.Factory;
import org.apache.felix.ipojo.InstanceStateListener;
import org.apache.felix.ipojo.MissingHandlerException;
import org.apache.felix.ipojo.UnacceptableConfiguration;
import org.apache.felix.ipojo.annotations.Bind;
import org.apache.felix.ipojo.annotations.Component;
import org.apache.felix.ipojo.annotations.Instantiate;
import org.apache.felix.ipojo.annotations.Requires;
@Component
@Instantiate
public class MathHubFactory {
@Requires(filter="(factory.name=LMHWorkflowInstance)")
Factory lmhWorkflow;
@Requires(filter="(factory.name=PlanetaryWorkflowInstance)")
Factory planetaryWorkflow;
void createInstance(Factory factory, String name, String docQueue) throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
Dictionary<String, Object> configuration = new Hashtable<String, Object>();
Dictionary<String, Object> filters = new Hashtable<String, Object>();
filters.put("docQueue", "(docQueue="+docQueue+")");
configuration.put("requires.filters", filters);
configuration.put("instance.name", name+" for doc:"+docQueue);
ComponentInstance inst = factory.createComponentInstance(configuration);
inst.addInstanceStateListener(new InstanceStateListener() {
@Override
public void stateChanged(ComponentInstance arg0, int arg1) {
if (arg1 == ComponentInstance.INVALID) {
arg0.dispose();
}
}
});
}
@Bind(aggregate=true)
void newSallyDoc(SallyDoc newDoc) throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException {
for (String iface : newDoc.getInterfaces()) {
if ("planetaryclient".equals(iface)) {
createInstance(planetaryWorkflow, "PlanetaryClient", newDoc.getDocQueue());
return;
}
if ("lmhworker".equals(iface)) {
createInstance(lmhWorkflow, "LMHWorker ", newDoc.getDocQueue());
return;
}
}
}
}
package info.kwarc.sally4.mathhubworker.impl;
import info.kwarc.sally4.core.CamelContextProvider;
import info.kwarc.sally4.docmanager.AlexRoute;
import info.kwarc.sally4.docmanager.IDocWorkflow;
import info.kwarc.sally4.docmanager.IDocWorkflowInstance;
import info.kwarc.sally4.mathhubworker.MathHubWorkerManager;
import info.kwarc.sally4.mathhubworker.routes.LMHWorkflowInstance;
import org.apache.camel.CamelContext;
import org.apache.camel.impl.DefaultCamelContext;
import org.apache.felix.ipojo.annotations.Component;
import org.apache.felix.ipojo.annotations.Instantiate;
import org.apache.felix.ipojo.annotations.Provides;
import org.apache.felix.ipojo.annotations.Requires;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Component
@Instantiate
@Provides
public class LMHWorkflow implements IDocWorkflow {
@Requires
CamelContextProvider camelContextProvider;
@Requires
MathHubWorkerManager workerManager;
Logger log;
public LMHWorkflow() {
log = LoggerFactory.getLogger(getClass());
}
@Override
public String[] getInterfaceRequirements() {
return new String[]{"lmhworker"};
}
@Override
public String[] getHandlingNamespaces() {
return new String[] {"http://kwarc.info/sally/comm/mathhubworker"};
}
@Override
public IDocWorkflowInstance createDocumentInstance(AlexRoute route) {
CamelContext context = new DefaultCamelContext();
LMHWorkflowInstance lmhWorkflowInstance = new LMHWorkflowInstance(route, this);
try {
context.addRoutes(lmhWorkflowInstance);
context.start();
} catch (Exception e) {
e.printStackTrace();
}
return lmhWorkflowInstance;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment