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/02/18 17:54:35 UTC
svn commit: r745570 - in
/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins:
echo.stateless.bean/src/echo/stateless/bean/ echo.stateless.client/
openejb.server/src/main/java/org/apache/openejb/eclipse/
Author: jgallimore
Date: Wed Feb 18 16:54:34 2009
New Revision: 745570
URL: http://svn.apache.org/viewvc?rev=745570&view=rev
Log:
OEP-24 added ASF headers and changed indenting a bit
Modified:
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/echo.stateless.bean/src/echo/stateless/bean/EchoServer.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/echo.stateless.bean/src/echo/stateless/bean/EchoServerBean.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/echo.stateless.bean/src/echo/stateless/bean/EchoStatelessPlugin.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/echo.stateless.client/plugin.xml
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/openejb.server/src/main/java/org/apache/openejb/eclipse/OpenEjbApplication.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/openejb.server/src/main/java/org/apache/openejb/eclipse/OpenEjbDeploymentService.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/openejb.server/src/main/java/org/apache/openejb/eclipse/OpenEjbPlugin.java
openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/openejb.server/src/main/java/org/apache/openejb/eclipse/OpenEjbServer.java
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/echo.stateless.bean/src/echo/stateless/bean/EchoServer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/echo.stateless.bean/src/echo/stateless/bean/EchoServer.java?rev=745570&r1=745569&r2=745570&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/echo.stateless.bean/src/echo/stateless/bean/EchoServer.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/echo.stateless.bean/src/echo/stateless/bean/EchoServer.java Wed Feb 18 16:54:34 2009
@@ -1,3 +1,19 @@
+/*
+ * 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 echo.stateless.bean;
import javax.ejb.Remote;
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/echo.stateless.bean/src/echo/stateless/bean/EchoServerBean.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/echo.stateless.bean/src/echo/stateless/bean/EchoServerBean.java?rev=745570&r1=745569&r2=745570&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/echo.stateless.bean/src/echo/stateless/bean/EchoServerBean.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/echo.stateless.bean/src/echo/stateless/bean/EchoServerBean.java Wed Feb 18 16:54:34 2009
@@ -1,3 +1,19 @@
+/*
+ * 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 echo.stateless.bean;
import javax.ejb.Stateless;
@@ -5,8 +21,8 @@
@Stateless
public class EchoServerBean implements EchoServer {
- public String echo(String message) {
- System.out.println("Client sent: " + message);
- return "Server: " + message;
- }
+ public String echo(String message) {
+ System.out.println("Client sent: " + message);
+ return "Server: " + message;
+ }
}
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/echo.stateless.bean/src/echo/stateless/bean/EchoStatelessPlugin.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/echo.stateless.bean/src/echo/stateless/bean/EchoStatelessPlugin.java?rev=745570&r1=745569&r2=745570&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/echo.stateless.bean/src/echo/stateless/bean/EchoStatelessPlugin.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/echo.stateless.bean/src/echo/stateless/bean/EchoStatelessPlugin.java Wed Feb 18 16:54:34 2009
@@ -1,3 +1,19 @@
+/*
+ * 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 echo.stateless.bean;
import org.apache.openejb.eclipse.OpenEjbApplication;
@@ -10,53 +26,52 @@
*/
public class EchoStatelessPlugin extends AbstractUIPlugin {
- // The plug-in ID
- public static final String PLUGIN_ID = "echo.stateless.bean";
+ // The plug-in ID
+ public static final String PLUGIN_ID = "echo.stateless.bean";
- // The shared instance
- private static EchoStatelessPlugin plugin;
+ // The shared instance
+ private static EchoStatelessPlugin plugin;
- /**
- * The constructor
- */
- public EchoStatelessPlugin() {
- }
-
- /*
- * (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 bundle = context.getBundle();
- OpenEjbApplication application = new OpenEjbApplication(bundle);
- context.registerService(OpenEjbApplication.class.getName(),
- application, null);
- }
-
- /*
- * (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 EchoStatelessPlugin getDefault() {
- return plugin;
- }
+ /**
+ * The constructor
+ */
+ public EchoStatelessPlugin() {
+ }
+
+ /*
+ * (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 bundle = context.getBundle();
+ OpenEjbApplication application = new OpenEjbApplication(bundle);
+ context.registerService(OpenEjbApplication.class.getName(), application, null);
+ }
+
+ /*
+ * (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 EchoStatelessPlugin getDefault() {
+ return plugin;
+ }
}
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/echo.stateless.client/plugin.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/echo.stateless.client/plugin.xml?rev=745570&r1=745569&r2=745570&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/echo.stateless.client/plugin.xml (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/echo.stateless.client/plugin.xml Wed Feb 18 16:54:34 2009
@@ -1,5 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
+<!--
+ ~ 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.
+-->
<plugin>
<extension
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/openejb.server/src/main/java/org/apache/openejb/eclipse/OpenEjbApplication.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/openejb.server/src/main/java/org/apache/openejb/eclipse/OpenEjbApplication.java?rev=745570&r1=745569&r2=745570&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/openejb.server/src/main/java/org/apache/openejb/eclipse/OpenEjbApplication.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/openejb.server/src/main/java/org/apache/openejb/eclipse/OpenEjbApplication.java Wed Feb 18 16:54:34 2009
@@ -1,3 +1,19 @@
+/*
+ * 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.apache.openejb.eclipse;
import java.io.IOException;
@@ -25,80 +41,75 @@
public class OpenEjbApplication {
- private AppInfo appInfo;
- private URL rootUrl;
+ private AppInfo appInfo;
+ private URL rootUrl;
- public OpenEjbApplication(Bundle bundle) throws IOException {
- this.rootUrl = bundle.getEntry("/");
- this.rootUrl = FileLocator.toFileURL(this.rootUrl);
- this.appInfo = null;
- }
-
- public OpenEjbApplication(URL rootUrl) {
- this.appInfo = null;
- this.rootUrl = rootUrl;
- }
-
- public AppInfo getAppInfo() {
- return appInfo;
- }
-
- public URL getRootUrl() {
- return rootUrl;
- }
-
- public void deploy(Properties properties) throws OpenEJBException {
-
- ConfigurationFactory factory = new ConfigurationFactory();
-
- String url = rootUrl.getPath();
- Assembler assembler = SystemInstance.get()
- .getComponent(Assembler.class);
- Openejb openejb = storeProperties(properties, factory);
-
- for (Resource resource : openejb.getResource()) {
- ResourceInfo serviceInfo = factory.configureService(resource,
- ResourceInfo.class);
- assembler.createResource(serviceInfo);
- }
-
- Deployer deployer = new DeployerEjb();
- this.appInfo = deployer.deploy(url, properties);
- }
-
- public void undeploy() throws NoSuchApplicationException, UndeployException {
- Assembler assembler = SystemInstance.get()
- .getComponent(Assembler.class);
- assembler.destroyApplication(this.appInfo.jarPath);
- }
-
- private Openejb storeProperties(Properties properties,
- ConfigurationFactory factory) {
-
- IStringVariableManager manager = VariablesPlugin.getDefault()
- .getStringVariableManager();
- Openejb openejb = new Openejb();
- for (Object k : properties.keySet()) {
- Object v = properties.get(k);
- if (v instanceof String) {
- String key = (String) k;
- String value = (String) v;
- try {
- value = manager.performStringSubstitution(value, false);
- } catch (CoreException e) {
- e.printStackTrace();
+ public OpenEjbApplication(Bundle bundle) throws IOException {
+ this.rootUrl = bundle.getEntry("/");
+ this.rootUrl = FileLocator.toFileURL(this.rootUrl);
+ this.appInfo = null;
+ }
+
+ public OpenEjbApplication(URL rootUrl) {
+ this.appInfo = null;
+ this.rootUrl = rootUrl;
+ }
+
+ public AppInfo getAppInfo() {
+ return appInfo;
+ }
+
+ public URL getRootUrl() {
+ return rootUrl;
+ }
+
+ public void deploy(Properties properties) throws OpenEJBException {
+
+ ConfigurationFactory factory = new ConfigurationFactory();
+
+ String url = rootUrl.getPath();
+ Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
+ Openejb openejb = storeProperties(properties, factory);
+
+ for (Resource resource : openejb.getResource()) {
+ ResourceInfo serviceInfo = factory.configureService(resource, ResourceInfo.class);
+ assembler.createResource(serviceInfo);
}
- SystemInstance.get().setProperty(key, value);
- if (value.startsWith("new://")) {
- try {
- URI uri = new URI(value);
- openejb.add(factory.toConfigDeclaration(key, uri));
- } catch (Exception e) {
- e.printStackTrace();
- }
+
+ Deployer deployer = new DeployerEjb();
+ this.appInfo = deployer.deploy(url, properties);
+ }
+
+ public void undeploy() throws NoSuchApplicationException, UndeployException {
+ Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
+ assembler.destroyApplication(this.appInfo.jarPath);
+ }
+
+ private Openejb storeProperties(Properties properties, ConfigurationFactory factory) {
+
+ IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager();
+ Openejb openejb = new Openejb();
+ for (Object k : properties.keySet()) {
+ Object v = properties.get(k);
+ if (v instanceof String) {
+ String key = (String) k;
+ String value = (String) v;
+ try {
+ value = manager.performStringSubstitution(value, false);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ SystemInstance.get().setProperty(key, value);
+ if (value.startsWith("new://")) {
+ try {
+ URI uri = new URI(value);
+ openejb.add(factory.toConfigDeclaration(key, uri));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
}
- }
+ return openejb;
}
- return openejb;
- }
}
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/openejb.server/src/main/java/org/apache/openejb/eclipse/OpenEjbDeploymentService.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/openejb.server/src/main/java/org/apache/openejb/eclipse/OpenEjbDeploymentService.java?rev=745570&r1=745569&r2=745570&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/openejb.server/src/main/java/org/apache/openejb/eclipse/OpenEjbDeploymentService.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/openejb.server/src/main/java/org/apache/openejb/eclipse/OpenEjbDeploymentService.java Wed Feb 18 16:54:34 2009
@@ -1,3 +1,19 @@
+/*
+ * 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.apache.openejb.eclipse;
import java.io.File;
@@ -16,103 +32,97 @@
public class OpenEjbDeploymentService {
- private ServiceTracker deploymentTracker;
- private BundleContext bundleContext;
- private OpenEjbServer ejbServer;
-
- public OpenEjbDeploymentService(BundleContext bundleContext) {
- this.bundleContext = bundleContext;
- this.deploymentTracker = null;
- this.ejbServer = null;
- }
-
- public void open() {
-
- try {
- if (ejbServer == null) {
- Bundle bundle = bundleContext.getBundle();
- URL baseUrl = bundle.getEntry("/");
- baseUrl = FileLocator.toFileURL(baseUrl);
- File baseDir = new File(baseUrl.getPath());
-
- ejbServer = new OpenEjbServer();
- ejbServer.init(baseDir);
- }
- } catch (Exception e) {
- e.printStackTrace();
- return;
+ private ServiceTracker deploymentTracker;
+ private BundleContext bundleContext;
+ private OpenEjbServer ejbServer;
+
+ public OpenEjbDeploymentService(BundleContext bundleContext) {
+ this.bundleContext = bundleContext;
+ this.deploymentTracker = null;
+ this.ejbServer = null;
}
- deploymentTracker = new ServiceTracker(bundleContext,
- OpenEjbApplication.class.getName(), null);
- deploymentTracker.open();
-
- ServiceListener sl = new ServiceListener() {
-
- public void serviceChanged(ServiceEvent ev) {
- ServiceReference sr = ev.getServiceReference();
- switch (ev.getType()) {
-
- case ServiceEvent.REGISTERED:
- deployApplication(sr);
- break;
-
- case ServiceEvent.UNREGISTERING:
- undeployApplication(sr);
- break;
+ public void open() {
+
+ try {
+ if (ejbServer == null) {
+ Bundle bundle = bundleContext.getBundle();
+ URL baseUrl = bundle.getEntry("/");
+ baseUrl = FileLocator.toFileURL(baseUrl);
+ File baseDir = new File(baseUrl.getPath());
+
+ ejbServer = new OpenEjbServer();
+ ejbServer.init(baseDir);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ return;
}
- }
- };
- // Generate a ServiceEvent for any existing OpenEJbApplication services.
+ deploymentTracker = new ServiceTracker(bundleContext, OpenEjbApplication.class.getName(), null);
+ deploymentTracker.open();
+
+ ServiceListener sl = new ServiceListener() {
- String filter = "(objectclass=" + OpenEjbApplication.class.getName()
- + ")";
- try {
- bundleContext.addServiceListener(sl, filter);
- ServiceReference[] srl = bundleContext.getServiceReferences(null,
- filter);
- if (srl != null) {
- for (ServiceReference sr : srl) {
- sl.serviceChanged(new ServiceEvent(ServiceEvent.REGISTERED,
- sr));
+ public void serviceChanged(ServiceEvent ev) {
+ ServiceReference sr = ev.getServiceReference();
+ switch (ev.getType()) {
+
+ case ServiceEvent.REGISTERED:
+ deployApplication(sr);
+ break;
+
+ case ServiceEvent.UNREGISTERING:
+ undeployApplication(sr);
+ break;
+ }
+ }
+ };
+
+ // Generate a ServiceEvent for any existing OpenEJbApplication services.
+
+ String filter = "(objectclass=" + OpenEjbApplication.class.getName() + ")";
+ try {
+ bundleContext.addServiceListener(sl, filter);
+ ServiceReference[] srl = bundleContext.getServiceReferences(null, filter);
+ if (srl != null) {
+ for (ServiceReference sr : srl) {
+ sl.serviceChanged(new ServiceEvent(ServiceEvent.REGISTERED, sr));
+ }
+ }
+ } catch (InvalidSyntaxException e) {
+ e.printStackTrace();
}
- }
- } catch (InvalidSyntaxException e) {
- e.printStackTrace();
}
- }
- public void close() throws Exception {
- deploymentTracker.close();
- ejbServer.destroy();
- }
-
- private void deployApplication(ServiceReference sr) {
- OpenEjbApplication application = (OpenEjbApplication) bundleContext
- .getService(sr);
- Properties properties = new Properties();
- for (String key : sr.getPropertyKeys()) {
- Object value = sr.getProperty(key);
- if (value instanceof String) {
- properties.put(key, value);
- }
+ public void close() throws Exception {
+ deploymentTracker.close();
+ ejbServer.destroy();
}
- try {
- application.deploy(properties);
- } catch (OpenEJBException e) {
- e.printStackTrace();
+
+ private void deployApplication(ServiceReference sr) {
+ OpenEjbApplication application = (OpenEjbApplication) bundleContext.getService(sr);
+ Properties properties = new Properties();
+ for (String key : sr.getPropertyKeys()) {
+ Object value = sr.getProperty(key);
+ if (value instanceof String) {
+ properties.put(key, value);
+ }
+ }
+ try {
+ application.deploy(properties);
+ } catch (OpenEJBException e) {
+ e.printStackTrace();
+ }
}
- }
- private void undeployApplication(ServiceReference sr) {
- try {
- OpenEjbApplication application = (OpenEjbApplication) bundleContext
- .getService(sr);
- application.undeploy();
- } catch (Exception e) {
- e.printStackTrace();
+ private void undeployApplication(ServiceReference sr) {
+ try {
+ OpenEjbApplication application = (OpenEjbApplication) bundleContext.getService(sr);
+ application.undeploy();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
- }
}
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/openejb.server/src/main/java/org/apache/openejb/eclipse/OpenEjbPlugin.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/openejb.server/src/main/java/org/apache/openejb/eclipse/OpenEjbPlugin.java?rev=745570&r1=745569&r2=745570&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/openejb.server/src/main/java/org/apache/openejb/eclipse/OpenEjbPlugin.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/openejb.server/src/main/java/org/apache/openejb/eclipse/OpenEjbPlugin.java Wed Feb 18 16:54:34 2009
@@ -1,3 +1,19 @@
+/*
+ * 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.apache.openejb.eclipse;
import java.io.IOException;
@@ -17,68 +33,68 @@
public class OpenEjbPlugin extends Plugin {
- private OpenEjbDeploymentService service = null;
- private IStringVariableManager manager = null;
+ private OpenEjbDeploymentService service = null;
+ private IStringVariableManager manager = null;
- private static OpenEjbPlugin plugin;
-
- public OpenEjbPlugin () {
- super();
- manager = VariablesPlugin.getDefault().getStringVariableManager();
- addPropertyVariables(System.getProperties());
- plugin = this;
- }
-
- public static OpenEjbPlugin getDefault() {
- return plugin;
- }
-
- public void start(BundleContext aContext) throws Exception {
- super.start(aContext);
- service = new OpenEjbDeploymentService(aContext);
- service.open();
- }
-
- public void stop(BundleContext aContext) throws Exception {
- service.close();
- super.stop(aContext);
- }
-
- public Properties loadProperties(Bundle bundle, Path path) {
- Properties properties = new Properties();
- URL[] urls = FileLocator.findEntries(bundle, path);
- for (URL url : urls) {
- Properties p = new Properties();
- try {
- InputStream is = url.openStream();
- p.load(is);
- is.close();
- } catch (IOException ioe) {
- // Ignore any properties partially loaded from a bad file.
- p.clear();
- }
- addPropertyVariables(p);
- properties.putAll(p);
- }
- return properties;
- }
-
- private void addPropertyVariables(Properties properties) {
- for (Object k : properties.keySet()) {
- String key = (String) k;
- String value = properties.getProperty(key);
- IValueVariable variable = manager.getValueVariable(key);
- if (variable == null) {
- variable = manager.newValueVariable(key, "", false, value);
- try {
- manager.addVariables(new IValueVariable[] {variable});
- } catch (CoreException e) {
- e.printStackTrace();
+ private static OpenEjbPlugin plugin;
+
+ public OpenEjbPlugin() {
+ super();
+ manager = VariablesPlugin.getDefault().getStringVariableManager();
+ addPropertyVariables(System.getProperties());
+ plugin = this;
+ }
+
+ public static OpenEjbPlugin getDefault() {
+ return plugin;
+ }
+
+ public void start(BundleContext aContext) throws Exception {
+ super.start(aContext);
+ service = new OpenEjbDeploymentService(aContext);
+ service.open();
+ }
+
+ public void stop(BundleContext aContext) throws Exception {
+ service.close();
+ super.stop(aContext);
+ }
+
+ public Properties loadProperties(Bundle bundle, Path path) {
+ Properties properties = new Properties();
+ URL[] urls = FileLocator.findEntries(bundle, path);
+ for (URL url : urls) {
+ Properties p = new Properties();
+ try {
+ InputStream is = url.openStream();
+ p.load(is);
+ is.close();
+ } catch (IOException ioe) {
+ // Ignore any properties partially loaded from a bad file.
+ p.clear();
+ }
+ addPropertyVariables(p);
+ properties.putAll(p);
+ }
+ return properties;
+ }
+
+ private void addPropertyVariables(Properties properties) {
+ for (Object k : properties.keySet()) {
+ String key = (String) k;
+ String value = properties.getProperty(key);
+ IValueVariable variable = manager.getValueVariable(key);
+ if (variable == null) {
+ variable = manager.newValueVariable(key, "", false, value);
+ try {
+ manager.addVariables(new IValueVariable[] { variable });
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ } else {
+ variable.setValue(value);
+ }
}
- } else {
- variable.setValue(value);
- }
}
- }
}
Modified: openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/openejb.server/src/main/java/org/apache/openejb/eclipse/OpenEjbServer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/openejb.server/src/main/java/org/apache/openejb/eclipse/OpenEjbServer.java?rev=745570&r1=745569&r2=745570&view=diff
==============================================================================
--- openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/openejb.server/src/main/java/org/apache/openejb/eclipse/OpenEjbServer.java (original)
+++ openejb/trunk/sandbox/openejb-eclipse-plugin/plugins/openejb.server/src/main/java/org/apache/openejb/eclipse/OpenEjbServer.java Wed Feb 18 16:54:34 2009
@@ -1,3 +1,19 @@
+/*
+ * 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.apache.openejb.eclipse;
import java.io.File;
@@ -15,36 +31,34 @@
public class OpenEjbServer {
- public void init(File baseDir) throws OpenEJBException {
+ public void init(File baseDir) throws OpenEJBException {
- File homeDir = new File(System.getProperty("user.home"));
- homeDir = new File(homeDir, "openejb");
- if (!homeDir.exists()) {
- homeDir.mkdir();
- }
+ File homeDir = new File(System.getProperty("user.home"));
+ homeDir = new File(homeDir, "openejb");
+ if (!homeDir.exists()) {
+ homeDir.mkdir();
+ }
+
+ File metaInfDir = new File(baseDir, "META-INF");
+ File configFile = new File(metaInfDir, "openejb.xml");
+
+ // Setup environment
+ Properties properties = new Properties();
+ properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
+
+ properties.put("openejb.home", homeDir.getAbsolutePath());
+ properties.put("openejb.base", baseDir.getAbsolutePath());
+ properties.put("openejb.configuration", configFile.getAbsolutePath());
+ properties.put("openejb.deployments.classpath", "false");
- File metaInfDir = new File(baseDir, "META-INF");
- File configFile = new File(metaInfDir, "openejb.xml");
+ OpenEJB.init(properties);
+ }
- // Setup environment
- Properties properties = new Properties();
- properties.put(Context.INITIAL_CONTEXT_FACTORY,
- "org.apache.openejb.client.LocalInitialContextFactory");
-
- properties.put("openejb.home", homeDir.getAbsolutePath());
- properties.put("openejb.base", baseDir.getAbsolutePath());
- properties.put("openejb.configuration", configFile.getAbsolutePath());
- properties.put("openejb.deployments.classpath", "false");
-
- OpenEJB.init(properties);
- }
-
- public void destroy() throws NoSuchApplicationException, UndeployException {
- Assembler assembler = SystemInstance.get()
- .getComponent(Assembler.class);
- for (AppInfo appInfo : assembler.getDeployedApplications()) {
- assembler.destroyApplication(appInfo.jarPath);
+ public void destroy() throws NoSuchApplicationException, UndeployException {
+ Assembler assembler = SystemInstance.get().getComponent(Assembler.class);
+ for (AppInfo appInfo : assembler.getDeployedApplications()) {
+ assembler.destroyApplication(appInfo.jarPath);
+ }
+ OpenEJB.destroy();
}
- OpenEJB.destroy();
- }
}