Skip to content

Commit

Permalink
BugFix:
Browse files Browse the repository at this point in the history
1.

NewAdd:
1.
  • Loading branch information
yishenggudou committed Dec 18, 2018
1 parent 894fd96 commit 93b050b
Show file tree
Hide file tree
Showing 26 changed files with 303 additions and 77 deletions.
18 changes: 18 additions & 0 deletions app/blitzcrank-common/blitzcrank-common.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.python:jython:2.7.1b3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
</component>
</module>
93 changes: 93 additions & 0 deletions app/blitzcrank-common/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.github.yishenggudou</groupId>
<artifactId>blitzcrank</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<groupId>com.github.yishenggudou</groupId>
<artifactId>blitzcrank-common</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.python/jython -->
<dependency>
<groupId>org.python</groupId>
<artifactId>jython</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<filesets>
<fileset>
<directory>src/main/resources/jython-packages/jwrapper/build</directory>
<includes>
<include>**</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
<fileset>
<directory>src/main/resources/jython-packages/jwrapper/jwrapper.egg-info</directory>
<includes>
<include>**</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
<fileset>
<directory>src/main/resources/jython-packages/jwrapper/temp</directory>
<includes>
<include>**</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>com.github.yishenggudou</groupId>
<artifactId>jython-compile-maven-plugin</artifactId>
<version>0.0.6</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>jython</goal>
</goals>
</execution>
</executions>
<configuration>
<libraries>
<param>${project.basedir}/src/main/resources/jython-packages/jwrapper</param>
</libraries>
</configuration>
</plugin>
</plugins>
</build>
</project>
19 changes: 19 additions & 0 deletions app/blitzcrank-tasks/blitzcrank-tasks.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="blitzcrank-common" />
<orderEntry type="library" name="Maven: org.python:jython:2.7.1b3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
</component>
</module>
97 changes: 97 additions & 0 deletions app/blitzcrank-tasks/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
<?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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.github.yishenggudou</groupId>
<artifactId>blitzcrank</artifactId>
<version>1.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<groupId>com.github.yishenggudou</groupId>
<artifactId>blitzcrank-tasks</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.github.yishenggudou</groupId>
<artifactId>blitzcrank-common</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.python/jython -->
<dependency>
<groupId>org.python</groupId>
<artifactId>jython</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<filesets>
<fileset>
<directory>src/main/resources/jython-packages/jwrapper/build</directory>
<includes>
<include>**</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
<fileset>
<directory>src/main/resources/jython-packages/jwrapper/jwrapper.egg-info</directory>
<includes>
<include>**</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
<fileset>
<directory>src/main/resources/jython-packages/jwrapper/temp</directory>
<includes>
<include>**</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>com.github.yishenggudou</groupId>
<artifactId>jython-compile-maven-plugin</artifactId>
<version>0.0.6</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>jython</goal>
</goals>
</execution>
</executions>
<configuration>
<libraries>
<param>${project.basedir}/src/main/resources/jython-packages/jwrapper</param>
</libraries>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public IRunner get(String moduleName, String className) {
PySystemState.initialize(sysProps, properties);
JythonObjectFactory factory = new JythonObjectFactory(pySystemState,
IRunner.class, moduleName, className);
IRunner runner = (IRunner) factory.createObject(IRunner.class, className);
IRunner runner = (IRunner) factory.createWrapperObject();
return runner;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.github.yishenggudou.blitzcrank;

import org.python.core.Py;
import org.python.core.PyModule;
import org.python.core.PyObject;
import org.python.core.PySystemState;

Expand All @@ -10,23 +11,31 @@
public class JythonObjectFactory {

private final Class interfaceType;
private final PyObject klass;
private PyModule klass;

public JythonObjectFactory(PySystemState state, Class interfaceType, String moduleName, String className) {
this.interfaceType = interfaceType;
PyObject importer = state.getBuiltins().__getitem__(Py.newString("__import__"));
PyObject module = importer.__call__(Py.newString(moduleName));
klass = module.__getattr__(className);
klass = (PyModule) module.__getattr__(className);
System.err.println("module=" + module + ",class=" + klass);
}

public JythonObjectFactory(Class interfaceType, String moduleName, String className) {
this(new PySystemState(), interfaceType, moduleName, className);
}

public Object createWrapperObject() {
PyObject a = klass;
Object resp = klass.newJ(interfaceType);
return resp;
}


public Object createObject() {
return klass.__call__().__tojava__(interfaceType);
PyObject a = klass.__call__();
Object resp = a.__tojava__(interfaceType);
return resp;
}


Expand All @@ -48,7 +57,6 @@ public Object createObject(Object args[], String keywords[]) {
for (int i = 0; i < args.length; i++) {
convertedArgs[i] = Py.java2py(args[i]);
}

return klass.__call__(convertedArgs, keywords).__tojava__(interfaceType);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# yishenggudou@gmail.com
# @timger http://weibo.com/zhanghaibo
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# Packages
*.egg
*.egg-info
jwrapper.egg-info
build
eggs
parts
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# yishenggudou@gmail.com
# @timger http://weibo.com/zhanghaibo
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,18 @@
# -*- coding: utf-8 -*-
# yishenggudou@gmail.com
# @timger http://weibo.com/zhanghaibo

from com.github.yishenggudou.blitzcrank import IRunner


class BaskRunner(IRunner):
"""
"""
var = 1



def __init__(self):
pass



def initialize(self, params, settings):
pass

Expand All @@ -30,5 +26,6 @@ def getStatus(self):
def getResult(self):
return ""


if __name__ == '__main__':
pass
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# yishenggudou@gmail.com
# @timger http://weibo.com/zhanghaibo
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.github.yishenggudou.blitzcrank;

import org.junit.Test;

public class blitzcrankEngineTest {

@Test
public void get() {
BlitzcrankEngine blitzcrankEngine = new BlitzcrankEngine();
IRunner runner = blitzcrankEngine.get("jwrapper.BaskRunner", "BaskRunner");
runner.run();
}
}

0 comments on commit 93b050b

Please sign in to comment.