summaryrefslogtreecommitdiffstats
path: root/tags/java/das/1.0-incubator-M2/rdb/src/main/java/org/apache/tuscany/das/rdb/util
diff options
context:
space:
mode:
Diffstat (limited to 'tags/java/das/1.0-incubator-M2/rdb/src/main/java/org/apache/tuscany/das/rdb/util')
-rw-r--r--tags/java/das/1.0-incubator-M2/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java58
-rw-r--r--tags/java/das/1.0-incubator-M2/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java79
-rw-r--r--tags/java/das/1.0-incubator-M2/rdb/src/main/java/org/apache/tuscany/das/rdb/util/LoggerFactory.java79
-rw-r--r--tags/java/das/1.0-incubator-M2/rdb/src/main/java/org/apache/tuscany/das/rdb/util/LoggerLayout.java56
4 files changed, 0 insertions, 272 deletions
diff --git a/tags/java/das/1.0-incubator-M2/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java b/tags/java/das/1.0-incubator-M2/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java
deleted file mode 100644
index e3ae306485..0000000000
--- a/tags/java/das/1.0-incubator-M2/rdb/src/main/java/org/apache/tuscany/das/rdb/util/ConfigUtil.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.tuscany.das.rdb.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-import org.apache.tuscany.das.rdb.config.Config;
-import org.apache.tuscany.das.rdb.config.ConfigFactory;
-import org.apache.tuscany.sdo.util.SDOUtil;
-
-import commonj.sdo.helper.XMLHelper;
-
-/**
- * Config util provides config-related utilities such as loading a Config
- * instance from an InputStream
- *
- */
-public final class ConfigUtil {
-
- private ConfigUtil() {
-
- }
-
- public static Config loadConfig(InputStream configStream) {
-
- if (configStream == null) {
- throw new RuntimeException("Cannot load configuration from a null InputStream. "
- + "Possibly caused by an incorrect config xml file name");
- }
-
- SDOUtil.registerStaticTypes(ConfigFactory.class);
- XMLHelper helper = XMLHelper.INSTANCE;
-
- try {
- return (Config) helper.load(configStream).getRootObject();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
-}
diff --git a/tags/java/das/1.0-incubator-M2/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java b/tags/java/das/1.0-incubator-M2/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java
deleted file mode 100644
index b9649669e5..0000000000
--- a/tags/java/das/1.0-incubator-M2/rdb/src/main/java/org/apache/tuscany/das/rdb/util/DataObjectUtil.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.tuscany.das.rdb.util;
-
-import java.util.Iterator;
-import java.util.List;
-
-import commonj.sdo.ChangeSummary;
-import commonj.sdo.DataObject;
-import commonj.sdo.Property;
-import commonj.sdo.ChangeSummary.Setting;
-import commonj.sdo.helper.DataFactory;
-
-/**
- */
-public final class DataObjectUtil {
-
- private DataObjectUtil() {
-
- }
-
- // Utilities
- public static DataObject getRestoredCopy(DataObject changedDO) {
- DataObject changedCopy = getCopy(changedDO);
- restoreAttributeValues(changedCopy, changedDO);
- return changedCopy;
- }
-
- public static DataObject getCopy(DataObject original) {
-
- DataObject copy = DataFactory.INSTANCE.create(original.getType());
-
- // Fill in values
- Iterator i = original.getType().getProperties().iterator();
- while (i.hasNext()) {
- Property feature = (Property) i.next();
- copy.set(feature, original.get(feature));
- }
- return copy;
- }
-
- /**
- * @param changedCopy
- * @return
- */
- private static void restoreAttributeValues(DataObject changedCopy, DataObject changedDO) {
-
- ChangeSummary changeSummary = changedDO.getDataGraph().getChangeSummary();
- List changes = changeSummary.getOldValues(changedDO);
- if (changes == null) {
- return;
- }
-
- Iterator i = changes.iterator();
- while (i.hasNext()) {
- Setting s = (Setting) i.next();
- if (s.getProperty().getType().isDataType()) {
- changedCopy.set(s.getProperty(), s.getValue());
- }
- }
- }
-
-}
diff --git a/tags/java/das/1.0-incubator-M2/rdb/src/main/java/org/apache/tuscany/das/rdb/util/LoggerFactory.java b/tags/java/das/1.0-incubator-M2/rdb/src/main/java/org/apache/tuscany/das/rdb/util/LoggerFactory.java
deleted file mode 100644
index bcd4386415..0000000000
--- a/tags/java/das/1.0-incubator-M2/rdb/src/main/java/org/apache/tuscany/das/rdb/util/LoggerFactory.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.tuscany.das.rdb.util;
-
-/* Import necessary log4j API classes */
-import org.apache.log4j.Appender;
-import org.apache.log4j.ConsoleAppender;
-import org.apache.log4j.Layout;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.log4j.PatternLayout;
-
-/**
- * Helper class for logging using external log utility : log4j
- * This will use log4j and to configure it, please add/update log4j.properties
- *
- * @author lresende
- */
-
-public final class LoggerFactory {
- public static final LoggerFactory INSTANCE = new LoggerFactory();
-
- private static Layout defaultLayout;
-
- private static Appender defaultAppender;
-
- static {
- synchronized (LoggerFactory.class) {
- defaultLayout = new PatternLayout(LoggerLayout.layout());
- defaultAppender = new ConsoleAppender(defaultLayout);
- }
- }
-
- private LoggerFactory() {
-
- }
-
- public Logger getLogger(Class loggingClass) {
- Logger logger = Logger.getLogger(loggingClass);
- logger.setLevel(Level.OFF);
- logger.addAppender(defaultAppender);
-
- return logger;
- }
-
- public Logger getLogger(Class loggingClass, Level logLevel) {
- Logger logger = Logger.getLogger(loggingClass);
- logger.setLevel(logLevel);
- logger.addAppender(defaultAppender);
-
- return logger;
- }
-
- public static void main(String[] args) {
-
- Logger log = LoggerFactory.INSTANCE.getLogger(LoggerFactory.class);
- if (log.isDebugEnabled()) {
- log.debug("something");
- }
-
- }
-}
diff --git a/tags/java/das/1.0-incubator-M2/rdb/src/main/java/org/apache/tuscany/das/rdb/util/LoggerLayout.java b/tags/java/das/1.0-incubator-M2/rdb/src/main/java/org/apache/tuscany/das/rdb/util/LoggerLayout.java
deleted file mode 100644
index f34330be48..0000000000
--- a/tags/java/das/1.0-incubator-M2/rdb/src/main/java/org/apache/tuscany/das/rdb/util/LoggerLayout.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.tuscany.das.rdb.util;
-
-/**
- * Log4J layout helper for Tuscany DAS
- * @author lresende
- */
-public final class LoggerLayout {
-
- private LoggerLayout() {
-
- }
-
- public static String layout() {
-
- /*
- * Substitute symbols
- * %c Logger, %c{2 } last 2 partial names
- * %C Class name (full agony), %C{2 } last 2 partial names
- * %d{dd MMM yyyy HH:MM:ss } Date, format see java.text.SimpleDateFormat
- * %F File name
- * %l Location (caution: compiler-option-dependently)
- * %L Line number
- * %m user-defined message
- * %M Method name
- * %p Level
- * %r Milliseconds since program start
- * %t Threadname
- * %x, %X see Doku
- * %% individual percentage sign
- *
- * Caution: %C, %F, %l, %L, %M slow down program run!
- * Note, %n is newline
- */
-
- return "[DAS RDB] - %c{1}.%M (%L) : %m %n";
- }
-
-}