You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2009/07/30 00:26:01 UTC

svn commit: r799101 - in /openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client: ./ META-INF/ src/echo/stateless/client/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/superbiz/ src/main/java/org/superbiz/echo/ src/main/jav...

Author: jgallimore
Date: Wed Jul 29 22:26:00 2009
New Revision: 799101

URL: http://svn.apache.org/viewvc?rev=799101&view=rev
Log:
Mavenized eclipse plugin sample OEP-34

Added:
    openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/
    openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/
    openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/
    openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/
    openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/
    openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/
    openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/Activator.java
    openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/Application.java
    openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/ApplicationActionBarAdvisor.java
    openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/ApplicationWorkbenchAdvisor.java
    openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/ApplicationWorkbenchWindowAdvisor.java
    openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/EchoClient.java
    openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/Perspective.java
Removed:
    openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/echo/stateless/client/Activator.java
    openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/echo/stateless/client/Application.java
    openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/echo/stateless/client/ApplicationActionBarAdvisor.java
    openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/echo/stateless/client/ApplicationWorkbenchAdvisor.java
    openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/echo/stateless/client/ApplicationWorkbenchWindowAdvisor.java
    openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/echo/stateless/client/EchoClient.java
    openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/echo/stateless/client/Perspective.java
Modified:
    openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/META-INF/MANIFEST.MF
    openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/plugin.xml

Modified: openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/META-INF/MANIFEST.MF?rev=799101&r1=799100&r2=799101&view=diff
==============================================================================
--- openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/META-INF/MANIFEST.MF (original)
+++ openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/META-INF/MANIFEST.MF Wed Jul 29 22:26:00 2009
@@ -3,10 +3,12 @@
 Bundle-Name: Client Plug-in
 Bundle-SymbolicName: echo.stateless.client; singleton:=true
 Bundle-Version: 1.0.0.beta
-Bundle-Activator: echo.stateless.client.Activator
+Bundle-Activator: org.superbiz.echo.client.Activator
 Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime,
  echo.stateless.bean;bundle-version="1.0.0.beta",
  org.apache.openejb.server;bundle-version="1.0.0.beta"
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ClassPath: target/classes/,
+ .

Modified: openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/plugin.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/plugin.xml?rev=799101&r1=799100&r2=799101&view=diff
==============================================================================
--- openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/plugin.xml (original)
+++ openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/plugin.xml Wed Jul 29 22:26:00 2009
@@ -23,7 +23,7 @@
          point="org.eclipse.core.runtime.applications">
       <application>
          <run
-               class="echo.stateless.client.Application">
+               class="org.superbiz.echo.client.Application">
          </run>
       </application>
    </extension>
@@ -31,7 +31,7 @@
          point="org.eclipse.ui.perspectives">
       <perspective
             name="RCP Perspective"
-            class="echo.stateless.client.Perspective"
+            class="org.superbiz.echo.client.Perspective"
             id="echo.stateless.client.perspective">
       </perspective>
    </extension>

Added: openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/Activator.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/Activator.java?rev=799101&view=auto
==============================================================================
--- openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/Activator.java (added)
+++ openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/Activator.java Wed Jul 29 22:26:00 2009
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ */
+ 
+package org.superbiz.echo.client;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+    // The plug-in ID
+    public static final String PLUGIN_ID = "echo.stateless.client";
+
+    // The shared instance
+    private static Activator plugin;
+
+    /**
+     * The constructor
+     */
+    public Activator() {
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+     * )
+     */
+    public void start(BundleContext context) throws Exception {
+	super.start(context);
+	plugin = this;
+	Bundle app = Platform.getBundle("echo.stateless.bean");
+	app.start();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
+     * )
+     */
+    public void stop(BundleContext context) throws Exception {
+	plugin = null;
+	super.stop(context);
+    }
+
+    /**
+     * Returns the shared instance
+     * 
+     * @return the shared instance
+     */
+    public static Activator getDefault() {
+	return plugin;
+    }
+
+    /**
+     * Returns an image descriptor for the image file at the given plug-in
+     * relative path
+     * 
+     * @param path
+     *            the path
+     * @return the image descriptor
+     */
+    public static ImageDescriptor getImageDescriptor(String path) {
+	return imageDescriptorFromPlugin(PLUGIN_ID, path);
+    }
+}

Added: openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/Application.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/Application.java?rev=799101&view=auto
==============================================================================
--- openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/Application.java (added)
+++ openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/Application.java Wed Jul 29 22:26:00 2009
@@ -0,0 +1,71 @@
+/*
+ * 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.
+ */
+ 
+package org.superbiz.echo.client;
+
+import org.eclipse.equinox.app.IApplication;
+import org.eclipse.equinox.app.IApplicationContext;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * This class controls all aspects of the application's execution
+ */
+public class Application implements IApplication {
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @seeorg.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.
+     * IApplicationContext)
+     */
+    public Object start(IApplicationContext context) throws Exception {
+	EchoClient client = new EchoClient();
+	System.out.println(client.echo("Hello World"));
+	Display display = PlatformUI.createDisplay();
+	try {
+	    int returnCode = PlatformUI.createAndRunWorkbench(display,
+		    new ApplicationWorkbenchAdvisor());
+	    if (returnCode == PlatformUI.RETURN_RESTART)
+		return IApplication.EXIT_RESTART;
+	    else
+		return IApplication.EXIT_OK;
+	} finally {
+	    display.dispose();
+	}
+
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.eclipse.equinox.app.IApplication#stop()
+     */
+    public void stop() {
+	final IWorkbench workbench = PlatformUI.getWorkbench();
+	if (workbench == null)
+	    return;
+	final Display display = workbench.getDisplay();
+	display.syncExec(new Runnable() {
+	    public void run() {
+		if (!display.isDisposed())
+		    workbench.close();
+	    }
+	});
+    }
+}

Added: openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/ApplicationActionBarAdvisor.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/ApplicationActionBarAdvisor.java?rev=799101&view=auto
==============================================================================
--- openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/ApplicationActionBarAdvisor.java (added)
+++ openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/ApplicationActionBarAdvisor.java Wed Jul 29 22:26:00 2009
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+ 
+package org.superbiz.echo.client;
+
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.application.ActionBarAdvisor;
+import org.eclipse.ui.application.IActionBarConfigurer;
+
+public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
+
+    public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
+	super(configurer);
+    }
+
+    protected void makeActions(IWorkbenchWindow window) {
+    }
+
+    protected void fillMenuBar(IMenuManager menuBar) {
+    }
+
+}

Added: openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/ApplicationWorkbenchAdvisor.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/ApplicationWorkbenchAdvisor.java?rev=799101&view=auto
==============================================================================
--- openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/ApplicationWorkbenchAdvisor.java (added)
+++ openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/ApplicationWorkbenchAdvisor.java Wed Jul 29 22:26:00 2009
@@ -0,0 +1,36 @@
+/*
+ * 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.
+ */
+ 
+package org.superbiz.echo.client;
+
+import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
+import org.eclipse.ui.application.WorkbenchAdvisor;
+import org.eclipse.ui.application.WorkbenchWindowAdvisor;
+
+public class ApplicationWorkbenchAdvisor extends WorkbenchAdvisor {
+
+    private static final String PERSPECTIVE_ID = "echo.stateless.client.perspective";
+
+    public WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
+	    IWorkbenchWindowConfigurer configurer) {
+	return new ApplicationWorkbenchWindowAdvisor(configurer);
+    }
+
+    public String getInitialWindowPerspectiveId() {
+	return PERSPECTIVE_ID;
+    }
+}

Added: openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/ApplicationWorkbenchWindowAdvisor.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/ApplicationWorkbenchWindowAdvisor.java?rev=799101&view=auto
==============================================================================
--- openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/ApplicationWorkbenchWindowAdvisor.java (added)
+++ openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/ApplicationWorkbenchWindowAdvisor.java Wed Jul 29 22:26:00 2009
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+ 
+package org.superbiz.echo.client;
+
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.ui.application.ActionBarAdvisor;
+import org.eclipse.ui.application.IActionBarConfigurer;
+import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
+import org.eclipse.ui.application.WorkbenchWindowAdvisor;
+
+public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
+
+    public ApplicationWorkbenchWindowAdvisor(
+	    IWorkbenchWindowConfigurer configurer) {
+	super(configurer);
+    }
+
+    public ActionBarAdvisor createActionBarAdvisor(
+	    IActionBarConfigurer configurer) {
+	return new ApplicationActionBarAdvisor(configurer);
+    }
+
+    public void preWindowOpen() {
+	IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
+	configurer.setInitialSize(new Point(400, 300));
+	configurer.setShowCoolBar(false);
+	configurer.setShowStatusLine(false);
+	configurer.setTitle("Echo Stateless Application");
+    }
+}

Added: openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/EchoClient.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/EchoClient.java?rev=799101&view=auto
==============================================================================
--- openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/EchoClient.java (added)
+++ openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/EchoClient.java Wed Jul 29 22:26:00 2009
@@ -0,0 +1,47 @@
+/*
+ * 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.
+ */
+ 
+package org.superbiz.echo.client;
+
+import java.util.Properties;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.superbiz.echo.ejb.EchoServer;
+
+public class EchoClient {
+
+    private EchoServer server;
+
+    public EchoClient() {
+	try {
+	    Properties p = new Properties();
+	    p.put(Context.INITIAL_CONTEXT_FACTORY,
+		    "org.apache.openejb.client.LocalInitialContextFactory");
+	    InitialContext initialContext = new InitialContext(p);
+	    server = (EchoServer) initialContext.lookup("EchoServerBeanRemote");
+	} catch (NamingException e) {
+	    server = null;
+	}
+    }
+
+    public String echo(String message) {
+	return server.echo(message);
+    }
+}

Added: openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/Perspective.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/Perspective.java?rev=799101&view=auto
==============================================================================
--- openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/Perspective.java (added)
+++ openejb/trunk/openejb-eclipse-plugin/examples/echo.stateless.client/src/main/java/org/superbiz/echo/client/Perspective.java Wed Jul 29 22:26:00 2009
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+ 
+package org.superbiz.echo.client;
+
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+
+public class Perspective implements IPerspectiveFactory {
+
+    public void createInitialLayout(IPageLayout layout) {
+    }
+}