Created
December 1, 2010 13:13
-
-
Save QNENet/723461 to your computer and use it in GitHub Desktop.
Why does mirah generate a main method in this case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mirah code | |
------------------------------------------------------------------------------------- | |
package org.eclipse.ecf.examples.sharedobject.server | |
import org.eclipse.ecf.core.ContainerFactory | |
import org.eclipse.ecf.core.IContainer | |
import org.eclipse.ecf.core.identity.ID | |
import org.eclipse.ecf.core.identity.IDFactory | |
import org.osgi.framework.BundleActivator | |
import org.osgi.framework.BundleContext | |
class Activator | |
implements BundleActivator | |
def start(context:BundleContext) throws Exception | |
@myserver = createServer("ecf.generic.server", "ecftcp://localhost:4280/mygroup") | |
puts "Server has been created on #{"ecftcp://localhost:4280/mygroup"}" | |
end | |
def stop(context:BundleContext) throws Exception | |
@myserver.dispose if @myserver | |
end | |
def createServer(container_str:String, connection_id_str:String) | |
idFactory = IDFactory.getDefault | |
connection_id = idFactory.createStringID(connection_id_str) | |
containerFactory = ContainerFactory.getDefault | |
return containerFactory.createContainer(container_str, connection_id) | |
end | |
end | |
-------------------------------------------------------------------------------------- | |
generated code | |
-------------------------------------------------------------------------------------- | |
// Generated from Activator.mirah | |
package org.eclipse.ecf.examples.sharedobject.server; | |
public class Activator extends java.lang.Object implements org.osgi.framework.BundleActivator { | |
private org.eclipse.ecf.core.IContainer myserver; | |
public static void main(java.lang.String[] argv) { | |
public void start(org.osgi.framework.BundleContext context) throws java.lang.Exception { | |
this.myserver = this.createServer("ecf.generic.server", "ecftcp://localhost:4280/mygroup"); | |
java.io.PrintStream temp$1 = java.lang.System.out; | |
temp$1.println("Server has been created on " + "ecftcp://localhost:4280/mygroup"); | |
} | |
public void stop(org.osgi.framework.BundleContext context) throws java.lang.Exception { | |
if ((this.myserver != null)) { | |
org.eclipse.ecf.core.IContainer temp$1 = this.myserver; | |
temp$1.dispose(); | |
} | |
} | |
public org.eclipse.ecf.core.IContainer createServer(java.lang.String container_str, java.lang.String connection_id_str) { | |
org.eclipse.ecf.core.identity.IIDFactory idFactory = null; | |
org.eclipse.ecf.core.identity.ID connection_id = null; | |
org.eclipse.ecf.core.IContainerFactory containerFactory = null; | |
idFactory = org.eclipse.ecf.core.identity.IDFactory.getDefault(); | |
connection_id = idFactory.createStringID(connection_id_str); | |
containerFactory = org.eclipse.ecf.core.ContainerFactory.getDefault(); | |
return containerFactory.createContainer(container_str, connection_id); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment