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/12/04 17:15:06 UTC
[02/39] tomee git commit: EOL
http://git-wip-us.apache.org/repos/asf/tomee/blob/52567075/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/FileHandler.java
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/FileHandler.java b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/FileHandler.java
index 5930293..a2c2e27 100644
--- a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/FileHandler.java
+++ b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/FileHandler.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.cdi.produces.field;
-
-public class FileHandler implements LogHandler {
-
- private String name;
-
- public FileHandler(String name) {
- this.name = name;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public void writeLog(String s) {
- System.out.printf("##### Handler: %s, Writing to the file!\n", getName());
- // Write to log file
- }
-
-}
+/**
+ * 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.cdi.produces.field;
+
+public class FileHandler implements LogHandler {
+
+ private String name;
+
+ public FileHandler(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ public void writeLog(String s) {
+ System.out.printf("##### Handler: %s, Writing to the file!\n", getName());
+ // Write to log file
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/52567075/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LogFactory.java
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LogFactory.java b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LogFactory.java
index 5926392..29ee599 100644
--- a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LogFactory.java
+++ b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LogFactory.java
@@ -1,44 +1,44 @@
-/**
- * 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.cdi.produces.field;
-
-import javax.enterprise.inject.Produces;
-
-public class LogFactory {
-
- private int type = 2;
-
- @Produces
- LogHandler handler;
-
- public LogFactory() {
- handler = getLogHandler();
- }
-
- public LogHandler getLogHandler() {
- switch (type) {
- case 1:
- return new FileHandler("@Produces created FileHandler!");
- case 2:
- return new DatabaseHandler("@Produces created DatabaseHandler!");
- case 3:
- default:
- return new ConsoleHandler("@Produces created ConsoleHandler!");
- }
-
- }
-}
+/**
+ * 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.cdi.produces.field;
+
+import javax.enterprise.inject.Produces;
+
+public class LogFactory {
+
+ private int type = 2;
+
+ @Produces
+ LogHandler handler;
+
+ public LogFactory() {
+ handler = getLogHandler();
+ }
+
+ public LogHandler getLogHandler() {
+ switch (type) {
+ case 1:
+ return new FileHandler("@Produces created FileHandler!");
+ case 2:
+ return new DatabaseHandler("@Produces created DatabaseHandler!");
+ case 3:
+ default:
+ return new ConsoleHandler("@Produces created ConsoleHandler!");
+ }
+
+ }
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/52567075/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LogHandler.java
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LogHandler.java b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LogHandler.java
index a72b7f2..be6088c 100644
--- a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LogHandler.java
+++ b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LogHandler.java
@@ -1,25 +1,25 @@
-/**
- * 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.cdi.produces.field;
-
-public interface LogHandler {
-
- public String getName();
-
- public void writeLog(String s);
-
-}
+/**
+ * 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.cdi.produces.field;
+
+public interface LogHandler {
+
+ public String getName();
+
+ public void writeLog(String s);
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/52567075/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/Logger.java
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/Logger.java b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/Logger.java
index 85e625c..838ce1c 100644
--- a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/Logger.java
+++ b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/Logger.java
@@ -1,25 +1,25 @@
-/**
- * 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.cdi.produces.field;
-
-public interface Logger {
-
- public void log(String s);
-
- public LogHandler getHandler();
-
-}
+/**
+ * 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.cdi.produces.field;
+
+public interface Logger {
+
+ public void log(String s);
+
+ public LogHandler getHandler();
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/52567075/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LoggerImpl.java
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LoggerImpl.java b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LoggerImpl.java
index 073b93f..df6cca2 100644
--- a/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LoggerImpl.java
+++ b/examples/cdi-produces-field/src/main/java/org/superbiz/cdi/produces/field/LoggerImpl.java
@@ -1,37 +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.cdi.produces.field;
-
-import javax.inject.Inject;
-import javax.inject.Named;
-
-@Named("logger")
-public class LoggerImpl implements Logger {
-
- @Inject
- private LogHandler handler;
-
- @Override
- public void log(String s) {
- getHandler().writeLog(s);
- }
-
- public LogHandler getHandler() {
- return handler;
- }
-
-}
+/**
+ * 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.cdi.produces.field;
+
+import javax.inject.Inject;
+import javax.inject.Named;
+
+@Named("logger")
+public class LoggerImpl implements Logger {
+
+ @Inject
+ private LogHandler handler;
+
+ @Override
+ public void log(String s) {
+ getHandler().writeLog(s);
+ }
+
+ public LogHandler getHandler() {
+ return handler;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/tomee/blob/52567075/examples/cdi-produces-field/src/main/resources/META-INF/beans.xml
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-field/src/main/resources/META-INF/beans.xml b/examples/cdi-produces-field/src/main/resources/META-INF/beans.xml
index 04392fd..c33918a 100644
--- a/examples/cdi-produces-field/src/main/resources/META-INF/beans.xml
+++ b/examples/cdi-produces-field/src/main/resources/META-INF/beans.xml
@@ -1,24 +1,24 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
- http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
-
-</beans>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+
+</beans>
http://git-wip-us.apache.org/repos/asf/tomee/blob/52567075/examples/cdi-produces-field/src/test/java/org/superbiz/cdi/produces/field/LoggerTest.java
----------------------------------------------------------------------
diff --git a/examples/cdi-produces-field/src/test/java/org/superbiz/cdi/produces/field/LoggerTest.java b/examples/cdi-produces-field/src/test/java/org/superbiz/cdi/produces/field/LoggerTest.java
index 8d1fc21..80c57a3 100644
--- a/examples/cdi-produces-field/src/test/java/org/superbiz/cdi/produces/field/LoggerTest.java
+++ b/examples/cdi-produces-field/src/test/java/org/superbiz/cdi/produces/field/LoggerTest.java
@@ -1,67 +1,67 @@
-/**
- * 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.cdi.produces.field;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import javax.ejb.embeddable.EJBContainer;
-import javax.inject.Inject;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-public class LoggerTest {
-
- @Inject
- Logger logger;
-
- private EJBContainer container;
-
- @Before
- public void setUp() {
- try {
- container = EJBContainer.createEJBContainer();
- container.getContext().bind("inject", this);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @After
- public void cleanUp() {
- try {
- container.getContext().unbind("inject");
- container.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Test
- public void testLogHandler() {
- assertNotNull(logger);
- assertFalse("Handler should not be a ConsoleHandler", logger.getHandler() instanceof ConsoleHandler);
- assertFalse("Handler should not be a FileHandler", logger.getHandler() instanceof FileHandler);
- assertTrue("Handler should be a DatabaseHandler", logger.getHandler() instanceof DatabaseHandler);
- logger.log("##### Testing write\n");
- logger = null;
- }
-
-}
+/**
+ * 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.cdi.produces.field;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.ejb.embeddable.EJBContainer;
+import javax.inject.Inject;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+public class LoggerTest {
+
+ @Inject
+ Logger logger;
+
+ private EJBContainer container;
+
+ @Before
+ public void setUp() {
+ try {
+ container = EJBContainer.createEJBContainer();
+ container.getContext().bind("inject", this);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @After
+ public void cleanUp() {
+ try {
+ container.getContext().unbind("inject");
+ container.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Test
+ public void testLogHandler() {
+ assertNotNull(logger);
+ assertFalse("Handler should not be a ConsoleHandler", logger.getHandler() instanceof ConsoleHandler);
+ assertFalse("Handler should not be a FileHandler", logger.getHandler() instanceof FileHandler);
+ assertTrue("Handler should be a DatabaseHandler", logger.getHandler() instanceof DatabaseHandler);
+ logger.log("##### Testing write\n");
+ logger = null;
+ }
+
+}