You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2019/01/02 13:20:38 UTC
[myfaces-tobago] 02/02: cleanup
This is an automated email from the ASF dual-hosted git repository.
lofwyr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/myfaces-tobago.git
commit db449d1e3a5b2c30d0fdb7f4b0a9b04b8441f81d
Author: Udo Schnurpfeil <lo...@apache.org>
AuthorDate: Wed Jan 2 14:20:07 2019 +0100
cleanup
---
.../myfaces/tobago/internal/util/JndiUtils.java | 78 ----------------------
.../apache/myfaces/tobago/layout/PixelMeasure.java | 77 ---------------------
2 files changed, 155 deletions(-)
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/JndiUtils.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/JndiUtils.java
deleted file mode 100644
index ed83473..0000000
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/util/JndiUtils.java
+++ /dev/null
@@ -1,78 +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.myfaces.tobago.internal.util;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.naming.Binding;
-import javax.naming.Context;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-
-public final class JndiUtils {
-
- private static final Logger LOG = LoggerFactory.getLogger(JndiUtils.class);
-
- private JndiUtils() {
- }
-
- public static Object getJndiProperty(final Context ctx, final String... path) throws NamingException {
- return getJndiProperty(ctx, null, path);
- }
-
- public static Object getJndiProperty(final Context ctx, final Object defaultValue, final String... path)
- throws NamingException {
- String name = "java:comp/env";
- // avoid error messages from websphere
- for (int i = 0; i < path.length; i++) {
- final Binding b = getBinding(ctx, name, path[i]);
- if (b == null) {
- break;
- }
- if (i == path.length - 1) {
- final Object obj = b.getObject();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Value: " + obj);
- }
- return obj;
- } else {
- name = name + "/" + path[i];
- }
- }
- return defaultValue;
- }
-
- private static Binding getBinding(final Context ctx, final String name, final String path)
- throws NamingException {
- final NamingEnumeration<Binding> ne = ctx.listBindings(name);
- while (ne.hasMore()) {
- final Binding b = ne.next();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Property: " + b.getName());
- }
- if (path.equals(b.getName())) {
- return b;
- }
- }
- return null;
- }
-
-}
diff --git a/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/PixelMeasure.java b/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/PixelMeasure.java
deleted file mode 100644
index 6c2b8e9..0000000
--- a/tobago-core/src/main/java/org/apache/myfaces/tobago/layout/PixelMeasure.java
+++ /dev/null
@@ -1,77 +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.myfaces.tobago.layout;
-
-/**
- * @deprecated since 4.1.0, please use {@link Measure}
- */
-@Deprecated
-public final class PixelMeasure /*extends Measure*/ {
-
- static final PixelMeasure[] PIXEL_CACHE;
- static final int PIXEL_CACHE_MAX = 4000;
-
- static {
- PIXEL_CACHE = new PixelMeasure[PIXEL_CACHE_MAX + 1];
- for (int i = 0; i < PIXEL_CACHE.length; i++) {
- PIXEL_CACHE[i] = new PixelMeasure(i);
- }
- }
-
- private final int pixel;
-
- private PixelMeasure(final int pixel) {
- this.pixel = pixel;
- }
-
- static PixelMeasure pixelValueOf(final int value) {
- if (value >= 0 && value <= PixelMeasure.PIXEL_CACHE_MAX) {
- return PixelMeasure.PIXEL_CACHE[value];
- }
- return new PixelMeasure(value);
- }
-
- public int getPixel() {
- return pixel;
- }
-
- @Override
- public boolean equals(final Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
-
- final PixelMeasure that = (PixelMeasure) o;
-
- if (pixel != that.pixel) {
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- return pixel;
- }
-}