You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by an...@apache.org on 2015/09/25 12:43:01 UTC
[26/33] tomee git commit: Align SNAPSHOT versions & reformat examples
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/component-interfaces/src/main/java/org/superbiz/FriendlyPersonRemote.java
----------------------------------------------------------------------
diff --git a/examples/component-interfaces/src/main/java/org/superbiz/FriendlyPersonRemote.java b/examples/component-interfaces/src/main/java/org/superbiz/FriendlyPersonRemote.java
index 92f352a..8b378d1 100644
--- a/examples/component-interfaces/src/main/java/org/superbiz/FriendlyPersonRemote.java
+++ b/examples/component-interfaces/src/main/java/org/superbiz/FriendlyPersonRemote.java
@@ -1,38 +1,38 @@
-/**
- * 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;
-
-import javax.ejb.Remote;
-
-//START SNIPPET: code
-@Remote
-public interface FriendlyPersonRemote {
-
- String greet(String friend);
-
- String greet(String language, String friend);
-
- void addGreeting(String language, String message);
-
- void setLanguagePreferences(String friend, String language);
-
- String getDefaultLanguage();
-
- void setDefaultLanguage(String defaultLanguage);
-
-}
-//END SNIPPET: code
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
+
+import javax.ejb.Remote;
+
+//START SNIPPET: code
+@Remote
+public interface FriendlyPersonRemote {
+
+ String greet(String friend);
+
+ String greet(String language, String friend);
+
+ void addGreeting(String language, String message);
+
+ void setLanguagePreferences(String friend, String language);
+
+ String getDefaultLanguage();
+
+ void setDefaultLanguage(String defaultLanguage);
+
+}
+//END SNIPPET: code
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/component-interfaces/src/test/java/org/superbiz/FriendlyPersonTest.java
----------------------------------------------------------------------
diff --git a/examples/component-interfaces/src/test/java/org/superbiz/FriendlyPersonTest.java b/examples/component-interfaces/src/test/java/org/superbiz/FriendlyPersonTest.java
index 6a31fbf..60cb575 100644
--- a/examples/component-interfaces/src/test/java/org/superbiz/FriendlyPersonTest.java
+++ b/examples/component-interfaces/src/test/java/org/superbiz/FriendlyPersonTest.java
@@ -1,180 +1,180 @@
-/**
- * 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;
-
-import junit.framework.TestCase;
-
-import javax.ejb.embeddable.EJBContainer;
-import javax.naming.Context;
-import java.util.Locale;
-
-/**
- * @version $Rev$ $Date$
- */
-public class FriendlyPersonTest extends TestCase {
-
- private Context context;
-
- protected void setUp() throws Exception {
- context = EJBContainer.createEJBContainer().getContext();
- }
-
- /**
- * Here we lookup and test the FriendlyPerson bean via its EJB 2.1 EJBHome and EJBObject interfaces
- *
- * @throws Exception
- */
- //START SNIPPET: remotehome
- public void testEjbHomeAndEjbObject() throws Exception {
- Object object = context.lookup("java:global/component-interfaces/FriendlyPerson!org.superbiz.FriendlyPersonEjbHome");
- FriendlyPersonEjbHome home = (FriendlyPersonEjbHome) object;
- FriendlyPersonEjbObject friendlyPerson = home.create();
-
- friendlyPerson.setDefaultLanguage("en");
-
- assertEquals("Hello David!", friendlyPerson.greet("David"));
- assertEquals("Hello Amelia!", friendlyPerson.greet("Amelia"));
-
- friendlyPerson.setLanguagePreferences("Amelia", "es");
-
- assertEquals("Hello David!", friendlyPerson.greet("David"));
- assertEquals("Hola Amelia!", friendlyPerson.greet("Amelia"));
-
- // Amelia took some French, let's see if she remembers
- assertEquals("Bonjour Amelia!", friendlyPerson.greet("fr", "Amelia"));
-
- // Dave should take some Polish and if he had, he could say Hi in Polish
- assertEquals("Witaj Dave!", friendlyPerson.greet("pl", "Dave"));
-
- // Let's see if I speak Portuguese
- assertEquals("Sorry, I don't speak " + new Locale("pt").getDisplayLanguage() + ".", friendlyPerson.greet("pt", "David"));
-
- // Ok, well I've been meaning to learn, so...
- friendlyPerson.addGreeting("pt", "Ola {0}!");
-
- assertEquals("Ola David!", friendlyPerson.greet("pt", "David"));
- }
- //END SNIPPET: remotehome
-
- /**
- * Here we lookup and test the FriendlyPerson bean via its EJB 2.1 EJBLocalHome and EJBLocalObject interfaces
- *
- * @throws Exception
- */
- public void testEjbLocalHomeAndEjbLocalObject() throws Exception {
- Object object = context.lookup("java:global/component-interfaces/FriendlyPerson!org.superbiz.FriendlyPersonEjbLocalHome");
- FriendlyPersonEjbLocalHome home = (FriendlyPersonEjbLocalHome) object;
- FriendlyPersonEjbLocalObject friendlyPerson = home.create();
-
- friendlyPerson.setDefaultLanguage("en");
-
- assertEquals("Hello David!", friendlyPerson.greet("David"));
- assertEquals("Hello Amelia!", friendlyPerson.greet("Amelia"));
-
- friendlyPerson.setLanguagePreferences("Amelia", "es");
-
- assertEquals("Hello David!", friendlyPerson.greet("David"));
- assertEquals("Hola Amelia!", friendlyPerson.greet("Amelia"));
-
- // Amelia took some French, let's see if she remembers
- assertEquals("Bonjour Amelia!", friendlyPerson.greet("fr", "Amelia"));
-
- // Dave should take some Polish and if he had, he could say Hi in Polish
- assertEquals("Witaj Dave!", friendlyPerson.greet("pl", "Dave"));
-
- // Let's see if I speak Portuguese
- assertEquals("Sorry, I don't speak " + new Locale("pt").getDisplayLanguage() + ".", friendlyPerson.greet("pt", "David"));
-
- // Ok, well I've been meaning to learn, so...
- friendlyPerson.addGreeting("pt", "Ola {0}!");
-
- assertEquals("Ola David!", friendlyPerson.greet("pt", "David"));
- }
-
- /**
- * Here we lookup and test the FriendlyPerson bean via its EJB 3.0 business remote interface
- *
- * @throws Exception
- */
- //START SNIPPET: remote
- public void testBusinessRemote() throws Exception {
- Object object = context.lookup("java:global/component-interfaces/FriendlyPerson!org.superbiz.FriendlyPersonRemote");
-
- FriendlyPersonRemote friendlyPerson = (FriendlyPersonRemote) object;
-
- friendlyPerson.setDefaultLanguage("en");
-
- assertEquals("Hello David!", friendlyPerson.greet("David"));
- assertEquals("Hello Amelia!", friendlyPerson.greet("Amelia"));
-
- friendlyPerson.setLanguagePreferences("Amelia", "es");
-
- assertEquals("Hello David!", friendlyPerson.greet("David"));
- assertEquals("Hola Amelia!", friendlyPerson.greet("Amelia"));
-
- // Amelia took some French, let's see if she remembers
- assertEquals("Bonjour Amelia!", friendlyPerson.greet("fr", "Amelia"));
-
- // Dave should take some Polish and if he had, he could say Hi in Polish
- assertEquals("Witaj Dave!", friendlyPerson.greet("pl", "Dave"));
-
- // Let's see if I speak Portuguese
- assertEquals("Sorry, I don't speak " + new Locale("pt").getDisplayLanguage() + ".", friendlyPerson.greet("pt", "David"));
-
- // Ok, well I've been meaning to learn, so...
- friendlyPerson.addGreeting("pt", "Ola {0}!");
-
- assertEquals("Ola David!", friendlyPerson.greet("pt", "David"));
- }
- //START SNIPPET: remote
-
- /**
- * Here we lookup and test the FriendlyPerson bean via its EJB 3.0 business local interface
- *
- * @throws Exception
- */
- public void testBusinessLocal() throws Exception {
- Object object = context.lookup("java:global/component-interfaces/FriendlyPerson!org.superbiz.FriendlyPersonLocal");
-
- FriendlyPersonLocal friendlyPerson = (FriendlyPersonLocal) object;
-
- friendlyPerson.setDefaultLanguage("en");
-
- assertEquals("Hello David!", friendlyPerson.greet("David"));
- assertEquals("Hello Amelia!", friendlyPerson.greet("Amelia"));
-
- friendlyPerson.setLanguagePreferences("Amelia", "es");
-
- assertEquals("Hello David!", friendlyPerson.greet("David"));
- assertEquals("Hola Amelia!", friendlyPerson.greet("Amelia"));
-
- // Amelia took some French, let's see if she remembers
- assertEquals("Bonjour Amelia!", friendlyPerson.greet("fr", "Amelia"));
-
- // Dave should take some Polish and if he had, he could say Hi in Polish
- assertEquals("Witaj Dave!", friendlyPerson.greet("pl", "Dave"));
-
- // Let's see if I speak Portuguese
- assertEquals("Sorry, I don't speak " + new Locale("pt").getDisplayLanguage() + ".", friendlyPerson.greet("pt", "David"));
-
- // Ok, well I've been meaning to learn, so...
- friendlyPerson.addGreeting("pt", "Ola {0}!");
-
- assertEquals("Ola David!", friendlyPerson.greet("pt", "David"));
- }
-
-}
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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;
+
+import junit.framework.TestCase;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.naming.Context;
+import java.util.Locale;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class FriendlyPersonTest extends TestCase {
+
+ private Context context;
+
+ protected void setUp() throws Exception {
+ context = EJBContainer.createEJBContainer().getContext();
+ }
+
+ /**
+ * Here we lookup and test the FriendlyPerson bean via its EJB 2.1 EJBHome and EJBObject interfaces
+ *
+ * @throws Exception
+ */
+ //START SNIPPET: remotehome
+ public void testEjbHomeAndEjbObject() throws Exception {
+ Object object = context.lookup("java:global/component-interfaces/FriendlyPerson!org.superbiz.FriendlyPersonEjbHome");
+ FriendlyPersonEjbHome home = (FriendlyPersonEjbHome) object;
+ FriendlyPersonEjbObject friendlyPerson = home.create();
+
+ friendlyPerson.setDefaultLanguage("en");
+
+ assertEquals("Hello David!", friendlyPerson.greet("David"));
+ assertEquals("Hello Amelia!", friendlyPerson.greet("Amelia"));
+
+ friendlyPerson.setLanguagePreferences("Amelia", "es");
+
+ assertEquals("Hello David!", friendlyPerson.greet("David"));
+ assertEquals("Hola Amelia!", friendlyPerson.greet("Amelia"));
+
+ // Amelia took some French, let's see if she remembers
+ assertEquals("Bonjour Amelia!", friendlyPerson.greet("fr", "Amelia"));
+
+ // Dave should take some Polish and if he had, he could say Hi in Polish
+ assertEquals("Witaj Dave!", friendlyPerson.greet("pl", "Dave"));
+
+ // Let's see if I speak Portuguese
+ assertEquals("Sorry, I don't speak " + new Locale("pt").getDisplayLanguage() + ".", friendlyPerson.greet("pt", "David"));
+
+ // Ok, well I've been meaning to learn, so...
+ friendlyPerson.addGreeting("pt", "Ola {0}!");
+
+ assertEquals("Ola David!", friendlyPerson.greet("pt", "David"));
+ }
+ //END SNIPPET: remotehome
+
+ /**
+ * Here we lookup and test the FriendlyPerson bean via its EJB 2.1 EJBLocalHome and EJBLocalObject interfaces
+ *
+ * @throws Exception
+ */
+ public void testEjbLocalHomeAndEjbLocalObject() throws Exception {
+ Object object = context.lookup("java:global/component-interfaces/FriendlyPerson!org.superbiz.FriendlyPersonEjbLocalHome");
+ FriendlyPersonEjbLocalHome home = (FriendlyPersonEjbLocalHome) object;
+ FriendlyPersonEjbLocalObject friendlyPerson = home.create();
+
+ friendlyPerson.setDefaultLanguage("en");
+
+ assertEquals("Hello David!", friendlyPerson.greet("David"));
+ assertEquals("Hello Amelia!", friendlyPerson.greet("Amelia"));
+
+ friendlyPerson.setLanguagePreferences("Amelia", "es");
+
+ assertEquals("Hello David!", friendlyPerson.greet("David"));
+ assertEquals("Hola Amelia!", friendlyPerson.greet("Amelia"));
+
+ // Amelia took some French, let's see if she remembers
+ assertEquals("Bonjour Amelia!", friendlyPerson.greet("fr", "Amelia"));
+
+ // Dave should take some Polish and if he had, he could say Hi in Polish
+ assertEquals("Witaj Dave!", friendlyPerson.greet("pl", "Dave"));
+
+ // Let's see if I speak Portuguese
+ assertEquals("Sorry, I don't speak " + new Locale("pt").getDisplayLanguage() + ".", friendlyPerson.greet("pt", "David"));
+
+ // Ok, well I've been meaning to learn, so...
+ friendlyPerson.addGreeting("pt", "Ola {0}!");
+
+ assertEquals("Ola David!", friendlyPerson.greet("pt", "David"));
+ }
+
+ /**
+ * Here we lookup and test the FriendlyPerson bean via its EJB 3.0 business remote interface
+ *
+ * @throws Exception
+ */
+ //START SNIPPET: remote
+ public void testBusinessRemote() throws Exception {
+ Object object = context.lookup("java:global/component-interfaces/FriendlyPerson!org.superbiz.FriendlyPersonRemote");
+
+ FriendlyPersonRemote friendlyPerson = (FriendlyPersonRemote) object;
+
+ friendlyPerson.setDefaultLanguage("en");
+
+ assertEquals("Hello David!", friendlyPerson.greet("David"));
+ assertEquals("Hello Amelia!", friendlyPerson.greet("Amelia"));
+
+ friendlyPerson.setLanguagePreferences("Amelia", "es");
+
+ assertEquals("Hello David!", friendlyPerson.greet("David"));
+ assertEquals("Hola Amelia!", friendlyPerson.greet("Amelia"));
+
+ // Amelia took some French, let's see if she remembers
+ assertEquals("Bonjour Amelia!", friendlyPerson.greet("fr", "Amelia"));
+
+ // Dave should take some Polish and if he had, he could say Hi in Polish
+ assertEquals("Witaj Dave!", friendlyPerson.greet("pl", "Dave"));
+
+ // Let's see if I speak Portuguese
+ assertEquals("Sorry, I don't speak " + new Locale("pt").getDisplayLanguage() + ".", friendlyPerson.greet("pt", "David"));
+
+ // Ok, well I've been meaning to learn, so...
+ friendlyPerson.addGreeting("pt", "Ola {0}!");
+
+ assertEquals("Ola David!", friendlyPerson.greet("pt", "David"));
+ }
+ //START SNIPPET: remote
+
+ /**
+ * Here we lookup and test the FriendlyPerson bean via its EJB 3.0 business local interface
+ *
+ * @throws Exception
+ */
+ public void testBusinessLocal() throws Exception {
+ Object object = context.lookup("java:global/component-interfaces/FriendlyPerson!org.superbiz.FriendlyPersonLocal");
+
+ FriendlyPersonLocal friendlyPerson = (FriendlyPersonLocal) object;
+
+ friendlyPerson.setDefaultLanguage("en");
+
+ assertEquals("Hello David!", friendlyPerson.greet("David"));
+ assertEquals("Hello Amelia!", friendlyPerson.greet("Amelia"));
+
+ friendlyPerson.setLanguagePreferences("Amelia", "es");
+
+ assertEquals("Hello David!", friendlyPerson.greet("David"));
+ assertEquals("Hola Amelia!", friendlyPerson.greet("Amelia"));
+
+ // Amelia took some French, let's see if she remembers
+ assertEquals("Bonjour Amelia!", friendlyPerson.greet("fr", "Amelia"));
+
+ // Dave should take some Polish and if he had, he could say Hi in Polish
+ assertEquals("Witaj Dave!", friendlyPerson.greet("pl", "Dave"));
+
+ // Let's see if I speak Portuguese
+ assertEquals("Sorry, I don't speak " + new Locale("pt").getDisplayLanguage() + ".", friendlyPerson.greet("pt", "David"));
+
+ // Ok, well I've been meaning to learn, so...
+ friendlyPerson.addGreeting("pt", "Ola {0}!");
+
+ assertEquals("Ola David!", friendlyPerson.greet("pt", "David"));
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/custom-injection/src/main/java/org/superbiz/enventries/Pickup.java
----------------------------------------------------------------------
diff --git a/examples/custom-injection/src/main/java/org/superbiz/enventries/Pickup.java b/examples/custom-injection/src/main/java/org/superbiz/enventries/Pickup.java
index 650a4fa..b33dd5a 100644
--- a/examples/custom-injection/src/main/java/org/superbiz/enventries/Pickup.java
+++ b/examples/custom-injection/src/main/java/org/superbiz/enventries/Pickup.java
@@ -1,35 +1,35 @@
-/**
- * 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.enventries;
-
-//START SNIPPET: code
-
-import java.beans.PropertyEditorManager;
-
-public enum Pickup {
-
- HUMBUCKER,
- SINGLE_COIL;
-
- // Here's the little magic where we register the PickupEditor
- // which knows how to create this object from a string.
- // You can add any of your own Property Editors in the same way.
- static {
- PropertyEditorManager.registerEditor(Pickup.class, PickupEditor.class);
- }
-}
-//END SNIPPET: code
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.enventries;
+
+//START SNIPPET: code
+
+import java.beans.PropertyEditorManager;
+
+public enum Pickup {
+
+ HUMBUCKER,
+ SINGLE_COIL;
+
+ // Here's the little magic where we register the PickupEditor
+ // which knows how to create this object from a string.
+ // You can add any of your own Property Editors in the same way.
+ static {
+ PropertyEditorManager.registerEditor(Pickup.class, PickupEditor.class);
+ }
+}
+//END SNIPPET: code
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/custom-injection/src/main/java/org/superbiz/enventries/PickupEditor.java
----------------------------------------------------------------------
diff --git a/examples/custom-injection/src/main/java/org/superbiz/enventries/PickupEditor.java b/examples/custom-injection/src/main/java/org/superbiz/enventries/PickupEditor.java
index 05b8207..808cfe2 100644
--- a/examples/custom-injection/src/main/java/org/superbiz/enventries/PickupEditor.java
+++ b/examples/custom-injection/src/main/java/org/superbiz/enventries/PickupEditor.java
@@ -1,45 +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.enventries;
-
-/**
- * With a java.beans.PropertyEditor, you can go way beyond the built-in
- * types that OpenEJB supports and can extend dependency injection to
- * just about anywhere.
- * <p/>
- * In the world of electric guitars, two types of pickups are used: humbucking, and single-coil.
- * Guitarists often refer to their guitars as HSS, meaning a guitar with 1 humbucker and
- * 2 single coil pickups, and so on. This little PropertyEditor supports that shorthand notation.
- *
- * @version $Revision$ $Date$
- */
-//START SNIPPET: code
-public class PickupEditor extends java.beans.PropertyEditorSupport {
-
- public void setAsText(String text) throws IllegalArgumentException {
- text = text.trim();
-
- if (text.equalsIgnoreCase("H")) {
- setValue(Pickup.HUMBUCKER);
- } else if (text.equalsIgnoreCase("S")) {
- setValue(Pickup.SINGLE_COIL);
- } else {
- throw new IllegalStateException("H and S are the only supported Pickup aliases");
- }
- }
-}
-//END SNIPPET: code
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.enventries;
+
+/**
+ * With a java.beans.PropertyEditor, you can go way beyond the built-in
+ * types that OpenEJB supports and can extend dependency injection to
+ * just about anywhere.
+ * <p/>
+ * In the world of electric guitars, two types of pickups are used: humbucking, and single-coil.
+ * Guitarists often refer to their guitars as HSS, meaning a guitar with 1 humbucker and
+ * 2 single coil pickups, and so on. This little PropertyEditor supports that shorthand notation.
+ *
+ * @version $Revision$ $Date$
+ */
+//START SNIPPET: code
+public class PickupEditor extends java.beans.PropertyEditorSupport {
+
+ public void setAsText(String text) throws IllegalArgumentException {
+ text = text.trim();
+
+ if (text.equalsIgnoreCase("H")) {
+ setValue(Pickup.HUMBUCKER);
+ } else if (text.equalsIgnoreCase("S")) {
+ setValue(Pickup.SINGLE_COIL);
+ } else {
+ throw new IllegalStateException("H and S are the only supported Pickup aliases");
+ }
+ }
+}
+//END SNIPPET: code
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/custom-injection/src/main/java/org/superbiz/enventries/Stratocaster.java
----------------------------------------------------------------------
diff --git a/examples/custom-injection/src/main/java/org/superbiz/enventries/Stratocaster.java b/examples/custom-injection/src/main/java/org/superbiz/enventries/Stratocaster.java
index 29f5f9f..95a2fcf 100644
--- a/examples/custom-injection/src/main/java/org/superbiz/enventries/Stratocaster.java
+++ b/examples/custom-injection/src/main/java/org/superbiz/enventries/Stratocaster.java
@@ -1,76 +1,76 @@
-/**
- * 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.enventries;
-
-import javax.annotation.Resource;
-import javax.ejb.Stateless;
-import java.io.File;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-/**
- * In addition to the standard env-entry types (String, Integer, Long, Short, Byte, Boolean, Double, Float, Character)
- * OpenEJB supports many other types.
- */
-//START SNIPPET: code
-@Stateless
-public class Stratocaster {
-
- @Resource(name = "pickups")
- private List<Pickup> pickups;
-
- @Resource(name = "style")
- private Style style;
-
- @Resource(name = "dateCreated")
- private Date dateCreated;
-
- @Resource(name = "guitarStringGuages")
- private Map<String, Float> guitarStringGuages;
-
- @Resource(name = "certificateOfAuthenticity")
- private File certificateOfAuthenticity;
-
- public Date getDateCreated() {
- return dateCreated;
- }
-
- /**
- * Gets the guage of the electric guitar strings
- * used in this guitar.
- *
- * @param string
- * @return
- */
- public float getStringGuage(String string) {
- return guitarStringGuages.get(string);
- }
-
- public List<Pickup> getPickups() {
- return pickups;
- }
-
- public Style getStyle() {
- return style;
- }
-
- public File getCertificateOfAuthenticity() {
- return certificateOfAuthenticity;
- }
-}
-//END SNIPPET: code
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.enventries;
+
+import javax.annotation.Resource;
+import javax.ejb.Stateless;
+import java.io.File;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * In addition to the standard env-entry types (String, Integer, Long, Short, Byte, Boolean, Double, Float, Character)
+ * OpenEJB supports many other types.
+ */
+//START SNIPPET: code
+@Stateless
+public class Stratocaster {
+
+ @Resource(name = "pickups")
+ private List<Pickup> pickups;
+
+ @Resource(name = "style")
+ private Style style;
+
+ @Resource(name = "dateCreated")
+ private Date dateCreated;
+
+ @Resource(name = "guitarStringGuages")
+ private Map<String, Float> guitarStringGuages;
+
+ @Resource(name = "certificateOfAuthenticity")
+ private File certificateOfAuthenticity;
+
+ public Date getDateCreated() {
+ return dateCreated;
+ }
+
+ /**
+ * Gets the guage of the electric guitar strings
+ * used in this guitar.
+ *
+ * @param string
+ * @return
+ */
+ public float getStringGuage(String string) {
+ return guitarStringGuages.get(string);
+ }
+
+ public List<Pickup> getPickups() {
+ return pickups;
+ }
+
+ public Style getStyle() {
+ return style;
+ }
+
+ public File getCertificateOfAuthenticity() {
+ return certificateOfAuthenticity;
+ }
+}
+//END SNIPPET: code
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/custom-injection/src/main/java/org/superbiz/enventries/Style.java
----------------------------------------------------------------------
diff --git a/examples/custom-injection/src/main/java/org/superbiz/enventries/Style.java b/examples/custom-injection/src/main/java/org/superbiz/enventries/Style.java
index 6956a40..57fc335 100644
--- a/examples/custom-injection/src/main/java/org/superbiz/enventries/Style.java
+++ b/examples/custom-injection/src/main/java/org/superbiz/enventries/Style.java
@@ -1,30 +1,30 @@
-/**
- * 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.enventries;
-
-/**
- * @version $Revision$ $Date$
- */
-//START SNIPPET: code
-public enum Style {
-
- STANDARD,
- DELUX,
- VINTAGE;
-
-}
-//END SNIPPET: code
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.enventries;
+
+/**
+ * @version $Revision$ $Date$
+ */
+//START SNIPPET: code
+public enum Style {
+
+ STANDARD,
+ DELUX,
+ VINTAGE;
+
+}
+//END SNIPPET: code
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/custom-injection/src/test/java/org/superbiz/enventries/StratocasterTest.java
----------------------------------------------------------------------
diff --git a/examples/custom-injection/src/test/java/org/superbiz/enventries/StratocasterTest.java b/examples/custom-injection/src/test/java/org/superbiz/enventries/StratocasterTest.java
index 562f8c9..03822c6 100644
--- a/examples/custom-injection/src/test/java/org/superbiz/enventries/StratocasterTest.java
+++ b/examples/custom-injection/src/test/java/org/superbiz/enventries/StratocasterTest.java
@@ -1,63 +1,63 @@
-/**
- * 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.enventries;
-
-import junit.framework.TestCase;
-
-import javax.ejb.EJB;
-import javax.ejb.embeddable.EJBContainer;
-import java.io.File;
-import java.text.DateFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.Locale;
-
-import static java.util.Arrays.asList;
-
-/**
- * @version $Rev$ $Date$
- */
-//START SNIPPET: code
-public class StratocasterTest extends TestCase {
-
- @EJB
- private Stratocaster strat;
-
- public void test() throws Exception {
- EJBContainer.createEJBContainer().getContext().bind("inject", this);
-
- Date date = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.US).parse("Mar 1, 1962");
- assertEquals("Strat.getDateCreated()", date, strat.getDateCreated());
-
- List<Pickup> pickups = asList(Pickup.SINGLE_COIL, Pickup.SINGLE_COIL, Pickup.SINGLE_COIL);
- assertEquals("Strat.getPickups()", pickups, strat.getPickups());
-
- assertEquals("Strat.getStyle()", Style.VINTAGE, strat.getStyle());
-
- assertEquals("Strat.getStringGuage(\"E1\")", 0.052F, strat.getStringGuage("E1"), 1e-15);
- assertEquals("Strat.getStringGuage(\"A\")", 0.042F, strat.getStringGuage("A"), 1e-15);
- assertEquals("Strat.getStringGuage(\"D\")", 0.030F, strat.getStringGuage("D"), 1e-15);
- assertEquals("Strat.getStringGuage(\"G\")", 0.017F, strat.getStringGuage("G"), 1e-15);
- assertEquals("Strat.getStringGuage(\"B\")", 0.013F, strat.getStringGuage("B"), 1e-15);
- assertEquals("Strat.getStringGuage(\"E\")", 0.010F, strat.getStringGuage("E"), 1e-15);
-
- File file = new File("/tmp/strat-certificate.txt");
- assertEquals("Strat.getCertificateOfAuthenticity()", file, strat.getCertificateOfAuthenticity());
-
- }
-}
-//END SNIPPET: code
+/**
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.enventries;
+
+import junit.framework.TestCase;
+
+import javax.ejb.EJB;
+import javax.ejb.embeddable.EJBContainer;
+import java.io.File;
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+
+import static java.util.Arrays.asList;
+
+/**
+ * @version $Rev$ $Date$
+ */
+//START SNIPPET: code
+public class StratocasterTest extends TestCase {
+
+ @EJB
+ private Stratocaster strat;
+
+ public void test() throws Exception {
+ EJBContainer.createEJBContainer().getContext().bind("inject", this);
+
+ Date date = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.US).parse("Mar 1, 1962");
+ assertEquals("Strat.getDateCreated()", date, strat.getDateCreated());
+
+ List<Pickup> pickups = asList(Pickup.SINGLE_COIL, Pickup.SINGLE_COIL, Pickup.SINGLE_COIL);
+ assertEquals("Strat.getPickups()", pickups, strat.getPickups());
+
+ assertEquals("Strat.getStyle()", Style.VINTAGE, strat.getStyle());
+
+ assertEquals("Strat.getStringGuage(\"E1\")", 0.052F, strat.getStringGuage("E1"), 1e-15);
+ assertEquals("Strat.getStringGuage(\"A\")", 0.042F, strat.getStringGuage("A"), 1e-15);
+ assertEquals("Strat.getStringGuage(\"D\")", 0.030F, strat.getStringGuage("D"), 1e-15);
+ assertEquals("Strat.getStringGuage(\"G\")", 0.017F, strat.getStringGuage("G"), 1e-15);
+ assertEquals("Strat.getStringGuage(\"B\")", 0.013F, strat.getStringGuage("B"), 1e-15);
+ assertEquals("Strat.getStringGuage(\"E\")", 0.010F, strat.getStringGuage("E"), 1e-15);
+
+ File file = new File("/tmp/strat-certificate.txt");
+ assertEquals("Strat.getCertificateOfAuthenticity()", file, strat.getCertificateOfAuthenticity());
+
+ }
+}
+//END SNIPPET: code
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/datasource-definition/src/main/java/org/superbiz/dsdef/Persister.java
----------------------------------------------------------------------
diff --git a/examples/datasource-definition/src/main/java/org/superbiz/dsdef/Persister.java b/examples/datasource-definition/src/main/java/org/superbiz/dsdef/Persister.java
index 4b70bd3..bd65da8 100644
--- a/examples/datasource-definition/src/main/java/org/superbiz/dsdef/Persister.java
+++ b/examples/datasource-definition/src/main/java/org/superbiz/dsdef/Persister.java
@@ -5,9 +5,9 @@
* 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
- *
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
* 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.
@@ -22,13 +22,13 @@ import javax.inject.Named;
import javax.sql.DataSource;
@DataSourceDefinition(transactional = true,
- url = "jdbc:h2:mem:persister",
- className = "org.h2.jdbcx.JdbcDataSource",
- user = "sa",
- password = "",
- name = "java:app/jdbc/persister",
- initialPoolSize = 1,
- maxPoolSize = 3
+ url = "jdbc:h2:mem:persister",
+ className = "org.h2.jdbcx.JdbcDataSource",
+ user = "sa",
+ password = "",
+ name = "java:app/jdbc/persister",
+ initialPoolSize = 1,
+ maxPoolSize = 3
)
@Named
public class Persister {
http://git-wip-us.apache.org/repos/asf/tomee/blob/f9f1b8ad/examples/datasource-definition/src/test/java/org/superbiz/dsdef/DataSourceDefinitionTest.java
----------------------------------------------------------------------
diff --git a/examples/datasource-definition/src/test/java/org/superbiz/dsdef/DataSourceDefinitionTest.java b/examples/datasource-definition/src/test/java/org/superbiz/dsdef/DataSourceDefinitionTest.java
index ba9c3f2..aedc7ea 100644
--- a/examples/datasource-definition/src/test/java/org/superbiz/dsdef/DataSourceDefinitionTest.java
+++ b/examples/datasource-definition/src/test/java/org/superbiz/dsdef/DataSourceDefinitionTest.java
@@ -5,9 +5,9 @@
* 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
- *
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
* 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.