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

adding appjs theo

parent f4cdd773
No related branches found
No related tags found
No related merge requests found
Showing
with 437 additions and 14 deletions
/home/costea/workspace_sally4/sally4.git/OfficeBase/target/OfficeBase-0.0.3-SNAPSHOT.jar
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry including="**/*.java" kind="src" path="src/main/resources"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>OfficeBase</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<!-- Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with this
work for additional information regarding copyright ownership. The ASF licenses
this file to You 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. -->
<modelVersion>4.0.0</modelVersion>
<packaging>bundle</packaging>
<groupId>info.kwarc.sally4</groupId>
<artifactId>OfficeBase</artifactId>
<version>${sally4.version}</version>
<parent>
<groupId>info.kwarc.sally</groupId>
<artifactId>sally</artifactId>
<version>1.0</version>
<relativePath>..</relativePath>
</parent>
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>4.3.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.ipojo.annotations</artifactId>
<version>1.11.2</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>info.kwarc.sally4</groupId>
<artifactId>core</artifactId>
<version>${sally4.version}</version>
</dependency>
<dependency>
<groupId>info.kwarc.sally4</groupId>
<artifactId>utils</artifactId>
<version>${sally4.version}</version>
</dependency>
<dependency>
<groupId>info.kwarc.sally4</groupId>
<artifactId>docmanager</artifactId>
<version>${sally4.version}</version>
</dependency>
<dependency>
<groupId>info.kwarc.sally4</groupId>
<artifactId>servlet</artifactId>
<version>${sally4.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- BND Maven Plugin Configuration -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Private-Package>info.kwarc.sally4.officebase.impl*</Private-Package>
<Export-Package>info.kwarc.sally4.officebase*;libs*</Export-Package>
</instructions>
</configuration>
</plugin>
<!-- iPOJO Maven Plugin Configuration : nothing to do -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-ipojo-plugin</artifactId>
<version>1.11.2</version>
<executions>
<execution>
<goals>
<goal>ipojo-bundle</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
package info.kwarc.sally4.officebase;
import info.kwarc.sally4.docmanager.SallyDoc;
public interface SelectClient {
SallyDoc getDoc();
}
package info.kwarc.sally4.officebase.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 OfficeBaseFactory {
@Requires(filter="(factory.name=SelectInstance)")
Factory selectWorkflows;
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 ("select".equals(iface)) {
createInstance(selectWorkflows, "SelectClient", newDoc.getDocQueue());
return;
}
}
}
}
package info.kwarc.sally4.officebase.impl;
import info.kwarc.sally4.core.CamelContextProvider;
import info.kwarc.sally4.core.SallyInteraction;
import info.kwarc.sally4.docmanager.SallyDoc;
import info.kwarc.sally4.marshalling.CommUtils;
import info.kwarc.sally4.officebase.SelectClient;
import info.kwarc.sally4.servlet.SallyServlet;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.spi.DataFormat;
import org.apache.felix.ipojo.annotations.Component;
import org.apache.felix.ipojo.annotations.Provides;
import org.apache.felix.ipojo.annotations.Requires;
import org.apache.felix.ipojo.annotations.Validate;
@Component(name="SelectInstance")
@Provides(specifications=SelectClient.class)
public class OfficeBaseInstance extends RouteBuilder implements SelectClient{
String planetaryClientNamespace = "http://kwarc.info/sally/comm/planetaryclient";
@Requires
SallyServlet t;
@Requires(id="docQueue", filter="(filterThatWillNeverSucceed=1)")
SallyDoc route;
@Requires
SallyInteraction interact;
@Requires
CamelContextProvider camelContextProvider;
@Validate
void doStart() {
}
public OfficeBaseInstance() {
}
@Override
public void configure() throws Exception {
DataFormat worker = CommUtils.getDataFormat("mathhubworker", getClass().getClassLoader());
getContext().addComponent("alex", route.getAlexComponent());
from("direct:start")
.to("direct:requestAuthKey");
}
@Override
public SallyDoc getDoc() {
return route;
}
}
OfficeBase/src/main/resources/libs/mhwsettings.png

702 B

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://kwarc.info/sally/comm/mathhubworker" elementFormDefault="qualified">
</xs:schema>
\ No newline at end of file
<html>
<script type="text/javascript" src=""></script>
<script src='/sally/jobad/libs/js/libs.js'></script>
<link rel='stylesheet' type='text/css' href='/sally/jobad/libs/css/libs.css'>
<script src='/sally/jobad/JOBAD.min.js'></script>
<link rel='stylesheet' type='text/css' href='/sally/jobad/JOBAD.min.css'>
<body class="bootstrap">
<div class="navbar navbar-inverse">
<div class="navbar-inner">
<a class="brand" href="#">MathHub Workers</a>
</div>
</div>
<#list body.env?keys as e>
<form action="setmhw">
<div class="row-fluid">
<div class="span1">${e_index+1}.</div>
<button class="span11 btn">
${body.env[e].getDescription()}
</button>
<input type="hidden" name="envid" value="${e}" />
<input type="hidden" name="id" value="${body.doc_queue_id}" />
</div>
</form>
</#list>
</body>
</html>
\ No newline at end of file
package info.kwarc.sally4.mathhubworker.impl;
/*
import info.kwarc.sally4.docmanager.SallyDoc;
import info.kwarc.sally4.docmanager.impl.SallyDocImpl;
import info.kwarc.sally4.docmanager.mocks.MockDocumentManager;
import info.kwarc.sally4.docmanager.mocks.MockGlobalContextProvider;
import info.kwarc.sally4.mathhubworker.routes.LMHWorkflowInstance;
import org.apache.camel.CamelContext;
import org.apache.camel.EndpointInject;
import org.apache.camel.Exchange;
import org.apache.camel.ProducerTemplate;
import org.apache.camel.component.mock.MockEndpoint;
import org.apache.camel.test.junit4.CamelTestSupport;
import org.junit.Test;
public class MathHubWorkerManagerImplTest extends CamelTestSupport{
MockDocumentManager man;
MathHubWorkerManagerImpl workerManager;
@EndpointInject(uri="sallyservlet:///planetary/mhwsettings")
ProducerTemplate starter;
@EndpointInject(uri="mock:result")
MockEndpoint result;
public MathHubWorkerManagerImplTest() {
}
@Test
public void test() throws Exception {
LMHWorkflow lmhWorkflow = new LMHWorkflow();
SallyDoc alexRoute = new SallyDocImpl("lmhqueue", "e1", "u1", "", new String[]{"lmhworker"});
LMHWorkflowInstance lmhInstance = new LMHWorkflowInstance(alexRoute, lmhWorkflow);
man.addWorkflowInstances(lmhInstance);
starter.sendBody("");
for (Exchange e: result.getExchanges()) {
System.out.println(e.getIn().getBody(String.class));
}
}
@Test
public void test2() throws Exception {
LMHWorkflow lmhWorkflow = new LMHWorkflow();
SallyDoc alexRoute = new SallyDocImpl("q1", "e1", "u1", "", new String[]{"lmhworker"});
LMHWorkflowInstance lmhInstance = new LMHWorkflowInstance(alexRoute, lmhWorkflow);
man.addWorkflowInstances(lmhInstance);
starter.sendBody("");
}
@Override
protected CamelContext createCamelContext() throws Exception {
man = new MockDocumentManager();
workerManager = new MathHubWorkerManagerImpl();
workerManager.docManager = man;
workerManager.camelContextProvider = new MockGlobalContextProvider();
workerManager.start();
return workerManager.getContext();
}
}
*/
\ No newline at end of file
......@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.04.17 at 03:49:09 PM CEST
// Generated on: 2014.04.23 at 02:05:16 PM CEST
//
......
......@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.04.17 at 03:49:09 PM CEST
// Generated on: 2014.04.23 at 02:05:16 PM CEST
//
......
......@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.04.17 at 03:49:09 PM CEST
// Generated on: 2014.04.23 at 02:05:16 PM CEST
//
......@@ -52,14 +52,6 @@ public class ObjectFactory {
return new Registerdocumentresponse();
}
/**
* Create an instance of {@link Onsallyframe }
*
*/
public Onsallyframe createOnsallyframe() {
return new Onsallyframe();
}
/**
* Create an instance of {@link Heartbeatrequest }
*
......
......@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.04.17 at 03:49:09 PM CEST
// Generated on: 2014.04.23 at 02:05:16 PM CEST
//
......
......@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.04.17 at 03:49:09 PM CEST
// Generated on: 2014.04.23 at 02:05:16 PM CEST
//
......
......@@ -2,7 +2,7 @@
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.04.17 at 03:49:09 PM CEST
// Generated on: 2014.04.23 at 02:05:16 PM CEST
//
@javax.xml.bind.annotation.XmlSchema(namespace = "http://kwarc.info/sally/comm/core", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
......
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2014.04.23 at 01:50:46 PM CEST
//
package info.kwarc.sally.comm.select;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the info.kwarc.sally.comm.select package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: info.kwarc.sally.comm.select
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link Onsallyframe }
*
*/
public Onsallyframe createOnsallyframe() {
return new Onsallyframe();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment