-/**
- * ============LICENSE_START====================================================
- * org.onap.aaf
- * ===========================================================================
- * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
- * ===========================================================================
- * Licensed 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.
- * ============LICENSE_END====================================================
- *
- */
-
-package org.onap.aaf.misc.env.jaxb;
-
-import java.io.InputStream;
-import java.io.Reader;
-
-import javax.xml.bind.JAXBException;
-import javax.xml.validation.Schema;
-
-import org.onap.aaf.misc.env.APIException;
-import org.onap.aaf.misc.env.Env;
-import org.onap.aaf.misc.env.TimeTaken;
-import org.onap.aaf.misc.env.old.IOObjectifier;
-
-/**
- * Allow Extended IO interface usage without muddying up the Stringifier Interface
- */
-public class JAXBObjectifier<T> implements IOObjectifier<T> {
- private JAXBumar jumar;
-
- public JAXBObjectifier(Schema schema, Class<?>... classes) throws APIException {
- try {
- jumar = new JAXBumar(schema, classes);
- } catch (JAXBException e) {
- throw new APIException(e);
- }
- }
-
- public JAXBObjectifier(Class<?>... classes) throws APIException {
- try {
- jumar = new JAXBumar(classes);
- } catch (JAXBException e) {
- throw new APIException(e);
- }
- }
-
- // package on purpose
- JAXBObjectifier(JAXBumar jumar) {
- this.jumar = jumar;
- }
-
- @SuppressWarnings("unchecked")
- // @Override
- public T objectify(Env env, String input) throws APIException {
- TimeTaken tt = env.start("JAXB Unmarshal", Env.XML);
- try {
- tt.size(input.length());
- return (T)jumar.unmarshal(env.debug(), input);
- } catch (JAXBException e) {
- throw new APIException(e);
- } finally {
- tt.done();
- }
- }
-
- @SuppressWarnings("unchecked")
- // @Override
- public T objectify(Env env, Reader rdr) throws APIException {
- //TODO create a Reader that Counts?
- TimeTaken tt = env.start("JAXB Unmarshal", Env.XML);
- try {
- return (T)jumar.unmarshal(env.debug(), rdr);
- } catch (JAXBException e) {
- throw new APIException(e);
- } finally {
- tt.done();
- }
- }
-
-
- @SuppressWarnings("unchecked")
- // @Override
- public T objectify(Env env, InputStream is) throws APIException {
- //TODO create a Reader that Counts?
- TimeTaken tt = env.start("JAXB Unmarshal", Env.XML);
- try {
- return (T)jumar.unmarshal(env.debug(), is);
- } catch (JAXBException e) {
- throw new APIException(e);
- } finally {
- tt.done();
- }
- }
-
-
- public void servicePrestart(Env env) throws APIException {
- }
-
- public void threadPrestart(Env env) throws APIException {
- }
-
- // // @Override
- public void refresh(Env env) throws APIException {
- }
-
- // // @Override
- public void threadDestroy(Env env) throws APIException {
- }
-
- // // @Override
- public void serviceDestroy(Env env) throws APIException {
- }
-
-
- @SuppressWarnings("unchecked")
- public T newInstance() throws APIException {
- try {
- return (T)jumar.newInstance();
- } catch (Exception e) {
- throw new APIException(e);
- }
- }
-
-}
-
+/**\r
+ * ============LICENSE_START====================================================\r
+ * org.onap.aaf\r
+ * ===========================================================================\r
+ * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.\r
+ * ===========================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ * \r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ * \r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END====================================================\r
+ *\r
+ */\r
+\r
+package org.onap.aaf.misc.env.jaxb;\r
+\r
+import java.io.InputStream;\r
+import java.io.Reader;\r
+\r
+import javax.xml.bind.JAXBException;\r
+import javax.xml.validation.Schema;\r
+\r
+import org.onap.aaf.misc.env.APIException;\r
+import org.onap.aaf.misc.env.Env;\r
+import org.onap.aaf.misc.env.TimeTaken;\r
+import org.onap.aaf.misc.env.old.IOObjectifier;\r
+\r
+/**\r
+ * Allow Extended IO interface usage without muddying up the Stringifier Interface\r
+ */\r
+public class JAXBObjectifier<T> implements IOObjectifier<T> {\r
+ private JAXBumar jumar;\r
+\r
+ public JAXBObjectifier(Schema schema, Class<?>... classes) throws APIException {\r
+ try {\r
+ jumar = new JAXBumar(schema, classes);\r
+ } catch (JAXBException e) {\r
+ throw new APIException(e);\r
+ }\r
+ }\r
+\r
+ public JAXBObjectifier(Class<?>... classes) throws APIException {\r
+ try {\r
+ jumar = new JAXBumar(classes);\r
+ } catch (JAXBException e) {\r
+ throw new APIException(e);\r
+ }\r
+ }\r
+ \r
+ // package on purpose\r
+ JAXBObjectifier(JAXBumar jumar) {\r
+ this.jumar = jumar;\r
+ }\r
+\r
+ @SuppressWarnings("unchecked")\r
+ // @Override\r
+ public T objectify(Env env, String input) throws APIException {\r
+ TimeTaken tt = env.start("JAXB Unmarshal", Env.XML);\r
+ try {\r
+ tt.size(input.length());\r
+ return (T)jumar.unmarshal(env.debug(), input);\r
+ } catch (JAXBException e) {\r
+ throw new APIException(e);\r
+ } finally {\r
+ tt.done();\r
+ }\r
+ }\r
+\r
+ @SuppressWarnings("unchecked")\r
+ // @Override\r
+ public T objectify(Env env, Reader rdr) throws APIException {\r
+ //TODO create a Reader that Counts?\r
+ TimeTaken tt = env.start("JAXB Unmarshal", Env.XML);\r
+ try {\r
+ return (T)jumar.unmarshal(env.debug(), rdr);\r
+ } catch (JAXBException e) {\r
+ throw new APIException(e);\r
+ } finally {\r
+ tt.done();\r
+ }\r
+ }\r
+\r
+\r
+ @SuppressWarnings("unchecked")\r
+ // @Override\r
+ public T objectify(Env env, InputStream is) throws APIException {\r
+ //TODO create a Reader that Counts?\r
+ TimeTaken tt = env.start("JAXB Unmarshal", Env.XML);\r
+ try {\r
+ return (T)jumar.unmarshal(env.debug(), is);\r
+ } catch (JAXBException e) {\r
+ throw new APIException(e);\r
+ } finally {\r
+ tt.done();\r
+ }\r
+ }\r
+\r
+\r
+ public void servicePrestart(Env env) throws APIException {\r
+ }\r
+\r
+ public void threadPrestart(Env env) throws APIException {\r
+ }\r
+\r
+ // // @Override\r
+ public void refresh(Env env) throws APIException {\r
+ }\r
+\r
+ // // @Override\r
+ public void threadDestroy(Env env) throws APIException {\r
+ }\r
+\r
+ // // @Override\r
+ public void serviceDestroy(Env env) throws APIException {\r
+ }\r
+\r
+\r
+ @SuppressWarnings("unchecked")\r
+ public T newInstance() throws APIException {\r
+ try {\r
+ return (T)jumar.newInstance();\r
+ } catch (Exception e) {\r
+ throw new APIException(e);\r
+ }\r
+ }\r
+\r
+}\r
+\r