You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by mi...@apache.org on 2009/03/23 00:45:35 UTC
svn commit: r757280 [7/23] - in /openjpa/branches/1.0.x:
openjpa-examples/src/main/java/hellojpa/
openjpa-examples/src/main/java/relations/
openjpa-jdbc-5/src/main/java/org/apache/openjpa/jdbc/meta/strats/
openjpa-jdbc/src/main/java/org/apache/openjpa/...
Modified: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/NonPersistentMetaData.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/NonPersistentMetaData.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/NonPersistentMetaData.java (original)
+++ openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/NonPersistentMetaData.java Sun Mar 22 23:45:15 2009
@@ -1,130 +1,130 @@
-/*
- * 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.openjpa.meta;
-
-import java.io.File;
-import java.io.Serializable;
-
-import org.apache.openjpa.lib.meta.SourceTracker;
-import org.apache.openjpa.lib.xml.Commentable;
-
-/**
- * Metadata about a persistence-aware type.
- *
- * @author Pinaki Poddar
- */
-public class NonPersistentMetaData
- implements Comparable, SourceTracker, Commentable, MetaDataContext,
- Serializable {
- public static final int TYPE_PERSISTENCE_AWARE = 1;
- public static final int TYPE_NON_MAPPED_INTERFACE = 2;
-
- private final MetaDataRepository _repos;
- private final Class _class;
- private final int _type;
-
- private File _srcFile = null;
- private int _srcType = SRC_OTHER;
- private String[] _comments = null;
- private int _listIndex = -1;
-
- protected NonPersistentMetaData(Class cls, MetaDataRepository repos,
- int type) {
- _repos = repos;
- _class = cls;
- _type = type;
- }
-
- /**
- * Owning repository.
- */
- public MetaDataRepository getRepository() {
- return _repos;
- }
-
- /**
- * Persistence-aware type.
- */
- public Class getDescribedType() {
- return _class;
- }
-
- /**
- * The type of metadata.
- */
- public int getType() {
- return _type;
- }
-
- /**
- * The index in which this class was listed in the metadata. Defaults to
- * <code>-1</code> if this class was not listed in the metadata.
- */
- public int getListingIndex() {
- return _listIndex;
- }
-
- /**
- * The index in which this field was listed in the metadata. Defaults to
- * <code>-1</code> if this class was not listed in the metadata.
- */
- public void setListingIndex(int index) {
- _listIndex = index;
- }
-
- public File getSourceFile() {
- return _srcFile;
- }
-
- public Object getSourceScope() {
- return null;
- }
-
- public int getSourceType() {
- return _srcType;
- }
-
- public void setSource(File file, int srcType) {
- _srcFile = file;
- _srcType = srcType;
- }
-
- public String getResourceName() {
- return _class.getName();
- }
-
- public String[] getComments() {
- return (_comments == null) ? ClassMetaData.EMPTY_COMMENTS : _comments;
- }
-
- public void setComments(String[] comments) {
- _comments = comments;
- }
-
- public int compareTo(Object o) {
- if (o == this)
- return 0;
- if (!(o instanceof NonPersistentMetaData))
- return 1;
- NonPersistentMetaData other = (NonPersistentMetaData) o;
- if (_type != other.getType())
- return _type - other.getType();
- return _class.getName().compareTo(other.getDescribedType().getName());
- }
-}
+/*
+ * 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.openjpa.meta;
+
+import java.io.File;
+import java.io.Serializable;
+
+import org.apache.openjpa.lib.meta.SourceTracker;
+import org.apache.openjpa.lib.xml.Commentable;
+
+/**
+ * Metadata about a persistence-aware type.
+ *
+ * @author Pinaki Poddar
+ */
+public class NonPersistentMetaData
+ implements Comparable, SourceTracker, Commentable, MetaDataContext,
+ Serializable {
+ public static final int TYPE_PERSISTENCE_AWARE = 1;
+ public static final int TYPE_NON_MAPPED_INTERFACE = 2;
+
+ private final MetaDataRepository _repos;
+ private final Class _class;
+ private final int _type;
+
+ private File _srcFile = null;
+ private int _srcType = SRC_OTHER;
+ private String[] _comments = null;
+ private int _listIndex = -1;
+
+ protected NonPersistentMetaData(Class cls, MetaDataRepository repos,
+ int type) {
+ _repos = repos;
+ _class = cls;
+ _type = type;
+ }
+
+ /**
+ * Owning repository.
+ */
+ public MetaDataRepository getRepository() {
+ return _repos;
+ }
+
+ /**
+ * Persistence-aware type.
+ */
+ public Class getDescribedType() {
+ return _class;
+ }
+
+ /**
+ * The type of metadata.
+ */
+ public int getType() {
+ return _type;
+ }
+
+ /**
+ * The index in which this class was listed in the metadata. Defaults to
+ * <code>-1</code> if this class was not listed in the metadata.
+ */
+ public int getListingIndex() {
+ return _listIndex;
+ }
+
+ /**
+ * The index in which this field was listed in the metadata. Defaults to
+ * <code>-1</code> if this class was not listed in the metadata.
+ */
+ public void setListingIndex(int index) {
+ _listIndex = index;
+ }
+
+ public File getSourceFile() {
+ return _srcFile;
+ }
+
+ public Object getSourceScope() {
+ return null;
+ }
+
+ public int getSourceType() {
+ return _srcType;
+ }
+
+ public void setSource(File file, int srcType) {
+ _srcFile = file;
+ _srcType = srcType;
+ }
+
+ public String getResourceName() {
+ return _class.getName();
+ }
+
+ public String[] getComments() {
+ return (_comments == null) ? ClassMetaData.EMPTY_COMMENTS : _comments;
+ }
+
+ public void setComments(String[] comments) {
+ _comments = comments;
+ }
+
+ public int compareTo(Object o) {
+ if (o == this)
+ return 0;
+ if (!(o instanceof NonPersistentMetaData))
+ return 1;
+ NonPersistentMetaData other = (NonPersistentMetaData) o;
+ if (_type != other.getType())
+ return _type - other.getType();
+ return _class.getName().compareTo(other.getDescribedType().getName());
+ }
+}
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/NonPersistentMetaData.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/NoneMetaDataFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/Order.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ProxySetupStateManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/QueryMetaData.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/SequenceMetaData.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/UpdateStrategies.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ValueMetaData.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ValueMetaDataImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/ValueStrategies.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/XMLClassMetaData.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/XMLFieldMetaData.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/meta/XMLMetaData.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/AbstractChangeTracker.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/AbstractLRSProxyCollection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/AbstractLRSProxyMap.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ApplicationIds.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ArrayStateImage.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/BigDecimalId.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/BigDecimalId.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/BigDecimalId.java (original)
+++ openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/BigDecimalId.java Sun Mar 22 23:45:15 2009
@@ -1,74 +1,74 @@
-/*
- * 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.openjpa.util;
-
-import java.math.BigDecimal;
-
-/**
- * @author <a href="mailto:mnachev@gmail.com">Miroslav Nachev</a>
- * @since 1.1.0
- */
-public class BigDecimalId
- extends OpenJPAId {
-
- private final BigDecimal key;
-
- public BigDecimalId(Class cls, String key) {
- this(cls, (key == null) ? null : new BigDecimal(key));
- }
-
- public BigDecimalId(Class cls, BigDecimal key) {
- super(cls);
- this.key = key;
- }
-
- public BigDecimalId(Class cls, BigDecimal key, boolean subs) {
- super(cls, subs);
- this.key = key;
- }
-
- public BigDecimal getId() {
- return key;
- }
-
- public Object getIdObject() {
- return key;
- }
-
- public String toString() {
- if (key == null)
- return "NULL";
-
- return key.toString();
- }
-
- protected int idHash() {
- if (key != null)
- return key.hashCode();
-
- return 0;
- }
-
- protected boolean idEquals(OpenJPAId other) {
- if(key == null)
- return false;
-
- return key.equals(other);
- }
-}
+/*
+ * 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.openjpa.util;
+
+import java.math.BigDecimal;
+
+/**
+ * @author <a href="mailto:mnachev@gmail.com">Miroslav Nachev</a>
+ * @since 1.1.0
+ */
+public class BigDecimalId
+ extends OpenJPAId {
+
+ private final BigDecimal key;
+
+ public BigDecimalId(Class cls, String key) {
+ this(cls, (key == null) ? null : new BigDecimal(key));
+ }
+
+ public BigDecimalId(Class cls, BigDecimal key) {
+ super(cls);
+ this.key = key;
+ }
+
+ public BigDecimalId(Class cls, BigDecimal key, boolean subs) {
+ super(cls, subs);
+ this.key = key;
+ }
+
+ public BigDecimal getId() {
+ return key;
+ }
+
+ public Object getIdObject() {
+ return key;
+ }
+
+ public String toString() {
+ if (key == null)
+ return "NULL";
+
+ return key.toString();
+ }
+
+ protected int idHash() {
+ if (key != null)
+ return key.hashCode();
+
+ return 0;
+ }
+
+ protected boolean idEquals(OpenJPAId other) {
+ if(key == null)
+ return false;
+
+ return key.equals(other);
+ }
+}
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/BigDecimalId.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/BigIntegerId.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/BigIntegerId.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/BigIntegerId.java (original)
+++ openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/BigIntegerId.java Sun Mar 22 23:45:15 2009
@@ -1,75 +1,75 @@
-/*
- * 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.openjpa.util;
-
-import java.math.BigInteger;
-
-/**
- * @author <a href="mailto:mnachev@gmail.com">Miroslav Nachev</a>
- * @since 1.1.0
- */
-public class BigIntegerId
- extends OpenJPAId {
-
- private final BigInteger key;
-
- public BigIntegerId(Class cls, String key) {
- this(cls, (key == null) ? null : new BigInteger(key));
- }
-
- public BigIntegerId(Class cls, BigInteger key) {
- super(cls);
- this.key = key;
- }
-
- public BigIntegerId(Class cls, BigInteger key, boolean subs) {
- super(cls, subs);
- this.key = key;
- }
-
- public BigInteger getId() {
- return key;
- }
-
- public Object getIdObject() {
- return key;
- }
-
- public String toString() {
- if (key == null)
- return "NULL";
-
- return key.toString();
- }
-
- protected int idHash() {
- if (key != null)
- return key.hashCode();
-
- return 0;
- }
-
- protected boolean idEquals(OpenJPAId other) {
- if (key == null)
- return false;
-
- return key.equals(other);
- }
-
-}
+/*
+ * 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.openjpa.util;
+
+import java.math.BigInteger;
+
+/**
+ * @author <a href="mailto:mnachev@gmail.com">Miroslav Nachev</a>
+ * @since 1.1.0
+ */
+public class BigIntegerId
+ extends OpenJPAId {
+
+ private final BigInteger key;
+
+ public BigIntegerId(Class cls, String key) {
+ this(cls, (key == null) ? null : new BigInteger(key));
+ }
+
+ public BigIntegerId(Class cls, BigInteger key) {
+ super(cls);
+ this.key = key;
+ }
+
+ public BigIntegerId(Class cls, BigInteger key, boolean subs) {
+ super(cls, subs);
+ this.key = key;
+ }
+
+ public BigInteger getId() {
+ return key;
+ }
+
+ public Object getIdObject() {
+ return key;
+ }
+
+ public String toString() {
+ if (key == null)
+ return "NULL";
+
+ return key.toString();
+ }
+
+ protected int idHash() {
+ if (key != null)
+ return key.hashCode();
+
+ return 0;
+ }
+
+ protected boolean idEquals(OpenJPAId other) {
+ if (key == null)
+ return false;
+
+ return key.equals(other);
+ }
+
+}
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/BigIntegerId.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ByteId.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/CacheMap.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/CallbackException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ChangeTracker.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/CharId.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ClassResolver.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ClassResolverImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/CollectionChangeTracker.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/CollectionChangeTrackerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/DateId.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ExceptionInfo.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/Exceptions.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/GeneralException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/GeneratedClasses.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/GeneratedClasses.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/GeneratedClasses.java (original)
+++ openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/GeneratedClasses.java Sun Mar 22 23:45:15 2009
@@ -1,92 +1,92 @@
-/*
- * 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.openjpa.util;
-
-import java.security.AccessController;
-import java.security.PrivilegedActionException;
-import java.lang.reflect.Constructor;
-
-import org.apache.openjpa.lib.util.J2DoPrivHelper;
-import org.apache.openjpa.lib.util.Localizer;
-import serp.bytecode.BCClass;
-import serp.bytecode.BCClassLoader;
-
-/**
- * Utility methods when generating classes, including at runtime.
- *
- * @since 1.0.0
- */
-public class GeneratedClasses {
-
- /**
- * Return the more derived loader of the class laoders for the given
- * classes.
- */
- public static ClassLoader getMostDerivedLoader(Class c1, Class c2) {
- ClassLoader l1 = (ClassLoader) AccessController.doPrivileged(
- J2DoPrivHelper.getClassLoaderAction(c1));
- ClassLoader l2 = (ClassLoader) AccessController.doPrivileged(
- J2DoPrivHelper.getClassLoaderAction(c2));
- if (l1 == l2)
- return l1;
- if (l1 == null)
- return l2;
- if (l2 == null)
- return l1;
-
- if(canLoad(l1, c2)) {
- return l1;
- }
- return l2;
- }
-
- /**
- * Load the class represented by the given bytecode.
- */
- public static Class loadBCClass(BCClass bc, ClassLoader loader) {
- BCClassLoader bcloader = (BCClassLoader) AccessController
- .doPrivileged(J2DoPrivHelper.newBCClassLoaderAction(bc
- .getProject(), loader));
- try {
- Class c = Class.forName(bc.getName(), true, bcloader);
- bc.getProject().clear();
- return c;
- } catch (Throwable t) {
- throw new GeneralException(bc.getName()).setCause(t);
- }
- }
-
- /**
- * Return true if the given loader will load the same version of a given
- * class.
- *
- * @param loader Classloader to use.
- * @param clazz Expected class.
- * @return true if loader.load(clazz.getName()) == clazz. Otherwise false.
- */
- private static boolean canLoad(ClassLoader loader, Class clazz) {
- Class loaded = null;
- try {
- loaded = loader.loadClass(clazz.getName());
- } catch (ClassNotFoundException e) {
- // Rely on caller to handle return value = false.
- }
- return clazz == loaded;
- }
-}
+/*
+ * 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.openjpa.util;
+
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.lang.reflect.Constructor;
+
+import org.apache.openjpa.lib.util.J2DoPrivHelper;
+import org.apache.openjpa.lib.util.Localizer;
+import serp.bytecode.BCClass;
+import serp.bytecode.BCClassLoader;
+
+/**
+ * Utility methods when generating classes, including at runtime.
+ *
+ * @since 1.0.0
+ */
+public class GeneratedClasses {
+
+ /**
+ * Return the more derived loader of the class laoders for the given
+ * classes.
+ */
+ public static ClassLoader getMostDerivedLoader(Class c1, Class c2) {
+ ClassLoader l1 = (ClassLoader) AccessController.doPrivileged(
+ J2DoPrivHelper.getClassLoaderAction(c1));
+ ClassLoader l2 = (ClassLoader) AccessController.doPrivileged(
+ J2DoPrivHelper.getClassLoaderAction(c2));
+ if (l1 == l2)
+ return l1;
+ if (l1 == null)
+ return l2;
+ if (l2 == null)
+ return l1;
+
+ if(canLoad(l1, c2)) {
+ return l1;
+ }
+ return l2;
+ }
+
+ /**
+ * Load the class represented by the given bytecode.
+ */
+ public static Class loadBCClass(BCClass bc, ClassLoader loader) {
+ BCClassLoader bcloader = (BCClassLoader) AccessController
+ .doPrivileged(J2DoPrivHelper.newBCClassLoaderAction(bc
+ .getProject(), loader));
+ try {
+ Class c = Class.forName(bc.getName(), true, bcloader);
+ bc.getProject().clear();
+ return c;
+ } catch (Throwable t) {
+ throw new GeneralException(bc.getName()).setCause(t);
+ }
+ }
+
+ /**
+ * Return true if the given loader will load the same version of a given
+ * class.
+ *
+ * @param loader Classloader to use.
+ * @param clazz Expected class.
+ * @return true if loader.load(clazz.getName()) == clazz. Otherwise false.
+ */
+ private static boolean canLoad(ClassLoader loader, Class clazz) {
+ Class loaded = null;
+ try {
+ loaded = loader.loadClass(clazz.getName());
+ } catch (ClassNotFoundException e) {
+ // Rely on caller to handle return value = false.
+ }
+ return clazz == loaded;
+ }
+}
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/GeneratedClasses.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/Id.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ImplHelper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/IntId.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/InternalException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/InvalidStateException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/LRSProxy.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/LockException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/LongId.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/MapChangeTracker.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/MapChangeTrackerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/MetaDataException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/MultiLoaderClassResolver.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/NoTransactionException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ObjectExistsException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ObjectId.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ObjectNotFoundException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/OpenJPAException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/OpenJPAId.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/OptimisticException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/Proxies.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/Proxy.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyBean.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyCalendar.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyCollection.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyCollections.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyDate.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyManagerImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyMap.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ProxyMaps.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ReferentialIntegrityException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/RuntimeExceptionTranslator.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/Serialization.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/ShortId.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/StoreException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/StoreFacadeTypeRegistry.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/StoreFacadeTypeRegistry.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/StoreFacadeTypeRegistry.java (original)
+++ openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/StoreFacadeTypeRegistry.java Sun Mar 22 23:45:15 2009
@@ -1,115 +1,115 @@
-/*
- * 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.openjpa.util;
-
-import java.util.Map;
-
-import org.apache.openjpa.kernel.StoreManager;
-import org.apache.openjpa.lib.util.concurrent.ConcurrentHashMap;
-
-/**
- * Repository of store-specific facade classes. This is used by facade
- * implementations to wrap store-specific components without knowing
- * about all possible back-ends.
- */
-public class StoreFacadeTypeRegistry {
-
- private Map _impls = new ConcurrentHashMap();
-
- /**
- * Register a facade implementation.
- *
- * @param facadeType the facade interface
- * @param storeType the store's
- * {@link org.apache.openjpa.kernel.StoreManager} type, or null for generic
- * @param implType the class implementing the facade
- */
- public void registerImplementation(Class facadeType, Class storeType,
- Class implType) {
- Object key = (storeType == null) ? (Object) facadeType
- : new Key(facadeType, storeType);
- _impls.put(key, implType);
- }
-
- /**
- * Return the implementation for the given facade and store.
- *
- * @param facadeType the facade interface
- * @param storeType the store's
- * {@link org.apache.openjpa.kernel.StoreManager} type, or null for generic
- * @param implType the registered implementor
- */
- public Class getImplementation(Class facadeType, Class storeType) {
- // traverse store type hierarchy to store manager to find most specific
- // store avaialble
- Class impl;
- for (; storeType != null && storeType != StoreManager.class;
- storeType = storeType.getSuperclass()) {
- impl = (Class) _impls.get(new Key(facadeType, storeType));
- if (impl != null)
- return impl;
- }
- return (Class) _impls.get(facadeType);
- }
-
- /**
- * Return the implementation for the given facade and store. If no
- * registered implementation is found then returns the given default type
- * provided it the facade type is assignable from the deafult type.
- *
- * @param facadeType the facade interface
- * @param storeType the store's
- * {@link org.apache.openjpa.kernel.StoreManager} type, or null for generic
- * @param implType the registered implementor
- * @param defaultType class if no registered implementation is available.
- */
- public Class getImplementation(Class facadeType, Class storeType,
- Class defaultType) {
- Class result = getImplementation(facadeType, storeType);
- if (result == null)
- result = defaultType;
- if (facadeType == null || !facadeType.isAssignableFrom(result))
- throw new InternalException();
- return result;
- }
-
- /**
- * Lookup key for facade+store hash.
- */
- private static class Key {
- public final Class _facadeType;
- public final Class _storeType;
-
- public Key(Class facadeType, Class storeType) {
- _facadeType = facadeType;
- _storeType = storeType;
- }
-
- public int hashCode() {
- return _facadeType.hashCode() ^ _storeType.hashCode();
- }
-
- public boolean equals(Object other) {
- if (other == this)
- return true;
- Key k = (Key) other;
- return _facadeType == k._facadeType && _storeType == k._storeType;
- }
- }
-}
+/*
+ * 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.openjpa.util;
+
+import java.util.Map;
+
+import org.apache.openjpa.kernel.StoreManager;
+import org.apache.openjpa.lib.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Repository of store-specific facade classes. This is used by facade
+ * implementations to wrap store-specific components without knowing
+ * about all possible back-ends.
+ */
+public class StoreFacadeTypeRegistry {
+
+ private Map _impls = new ConcurrentHashMap();
+
+ /**
+ * Register a facade implementation.
+ *
+ * @param facadeType the facade interface
+ * @param storeType the store's
+ * {@link org.apache.openjpa.kernel.StoreManager} type, or null for generic
+ * @param implType the class implementing the facade
+ */
+ public void registerImplementation(Class facadeType, Class storeType,
+ Class implType) {
+ Object key = (storeType == null) ? (Object) facadeType
+ : new Key(facadeType, storeType);
+ _impls.put(key, implType);
+ }
+
+ /**
+ * Return the implementation for the given facade and store.
+ *
+ * @param facadeType the facade interface
+ * @param storeType the store's
+ * {@link org.apache.openjpa.kernel.StoreManager} type, or null for generic
+ * @param implType the registered implementor
+ */
+ public Class getImplementation(Class facadeType, Class storeType) {
+ // traverse store type hierarchy to store manager to find most specific
+ // store avaialble
+ Class impl;
+ for (; storeType != null && storeType != StoreManager.class;
+ storeType = storeType.getSuperclass()) {
+ impl = (Class) _impls.get(new Key(facadeType, storeType));
+ if (impl != null)
+ return impl;
+ }
+ return (Class) _impls.get(facadeType);
+ }
+
+ /**
+ * Return the implementation for the given facade and store. If no
+ * registered implementation is found then returns the given default type
+ * provided it the facade type is assignable from the deafult type.
+ *
+ * @param facadeType the facade interface
+ * @param storeType the store's
+ * {@link org.apache.openjpa.kernel.StoreManager} type, or null for generic
+ * @param implType the registered implementor
+ * @param defaultType class if no registered implementation is available.
+ */
+ public Class getImplementation(Class facadeType, Class storeType,
+ Class defaultType) {
+ Class result = getImplementation(facadeType, storeType);
+ if (result == null)
+ result = defaultType;
+ if (facadeType == null || !facadeType.isAssignableFrom(result))
+ throw new InternalException();
+ return result;
+ }
+
+ /**
+ * Lookup key for facade+store hash.
+ */
+ private static class Key {
+ public final Class _facadeType;
+ public final Class _storeType;
+
+ public Key(Class facadeType, Class storeType) {
+ _facadeType = facadeType;
+ _storeType = storeType;
+ }
+
+ public int hashCode() {
+ return _facadeType.hashCode() ^ _storeType.hashCode();
+ }
+
+ public boolean equals(Object other) {
+ if (other == this)
+ return true;
+ Key k = (Key) other;
+ return _facadeType == k._facadeType && _storeType == k._storeType;
+ }
+ }
+}
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/StoreFacadeTypeRegistry.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/StringId.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/UnsupportedException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/util/UserException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: openjpa/branches/1.0.x/openjpa-kernel/src/test/java/org/apache/openjpa/ee/TestWASManagedRuntime.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-kernel/src/test/java/org/apache/openjpa/ee/TestWASManagedRuntime.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-kernel/src/test/java/org/apache/openjpa/ee/TestWASManagedRuntime.java (original)
+++ openjpa/branches/1.0.x/openjpa-kernel/src/test/java/org/apache/openjpa/ee/TestWASManagedRuntime.java Sun Mar 22 23:45:15 2009
@@ -1,57 +1,57 @@
-/*
- * 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.openjpa.ee;
-
-import junit.framework.TestCase;
-
-import serp.util.Strings;
-
-/**
- * Test class for build transformation performed by WASManagedRuntime.
- *
- */
-public class TestWASManagedRuntime extends TestCase {
-
- /**
- * This test will verify that the WASManagedRuntime$WASSynchronization
- * class was properly modified by the maven build process (reference
- * the top level pom.xml). This testcase will not execute properly
- * within Eclipse since the Eclipse target directory (probably) hasn't
- * been modified via the maven build.
- *
- * @throws ClassNotFoundException
- * @author Michael Dick
- */
- public void testInterfaceAdded() throws ClassNotFoundException {
-
- String msg = null;
-
- try {
- Class.forName(WASManagedRuntime.CLASS);
- fail("expected an exception to be thrown");
- } catch (NoClassDefFoundError e) {
- msg = e.getMessage();
- }
- String interfaceName = Strings.
- getClassName(WASManagedRuntime.INTERFACE);
- assertTrue("message should have contained "
- + interfaceName + ", but was '" + msg + "'",
- msg.indexOf(interfaceName) != -1);
- }
-}
+/*
+ * 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.openjpa.ee;
+
+import junit.framework.TestCase;
+
+import serp.util.Strings;
+
+/**
+ * Test class for build transformation performed by WASManagedRuntime.
+ *
+ */
+public class TestWASManagedRuntime extends TestCase {
+
+ /**
+ * This test will verify that the WASManagedRuntime$WASSynchronization
+ * class was properly modified by the maven build process (reference
+ * the top level pom.xml). This testcase will not execute properly
+ * within Eclipse since the Eclipse target directory (probably) hasn't
+ * been modified via the maven build.
+ *
+ * @throws ClassNotFoundException
+ * @author Michael Dick
+ */
+ public void testInterfaceAdded() throws ClassNotFoundException {
+
+ String msg = null;
+
+ try {
+ Class.forName(WASManagedRuntime.CLASS);
+ fail("expected an exception to be thrown");
+ } catch (NoClassDefFoundError e) {
+ msg = e.getMessage();
+ }
+ String interfaceName = Strings.
+ getClassName(WASManagedRuntime.INTERFACE);
+ assertTrue("message should have contained "
+ + interfaceName + ", but was '" + msg + "'",
+ msg.indexOf(interfaceName) != -1);
+ }
+}
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/test/java/org/apache/openjpa/ee/TestWASManagedRuntime.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-kernel/src/test/java/org/apache/openjpa/util/TestProxyManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: openjpa/branches/1.0.x/openjpa-lib-5/src/main/java/org/apache/openjpa/lib/util/J2DoPriv5Helper.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-lib-5/src/main/java/org/apache/openjpa/lib/util/J2DoPriv5Helper.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-lib-5/src/main/java/org/apache/openjpa/lib/util/J2DoPriv5Helper.java (original)
+++ openjpa/branches/1.0.x/openjpa-lib-5/src/main/java/org/apache/openjpa/lib/util/J2DoPriv5Helper.java Sun Mar 22 23:45:15 2009
@@ -1,92 +1,92 @@
-/*
- * 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.openjpa.lib.util;
-
-import java.lang.reflect.AnnotatedElement;
-import java.security.PrivilegedAction;
-
-/**
- * Helper class to obtain the Privilege(Exception)Action object to perform
- * Java 2 doPrivilege security sensitive function call in the following
- * methods:
- * <ul>
- * <li>AnnotatedElement.getAnnotations
- * <li>AnnotatedElement.getDeclaredAnnotations
- * <li>AnnotatedElement.isAnnotationPresent
- * </ul>
- *
- * @author Albert Lee
- */
-
-public abstract class J2DoPriv5Helper extends J2DoPrivHelper {
-
- /**
- * Return a PrivilegeAction object for AnnotatedElement.getAnnotations().
- *
- * Requires security policy:
- * 'permission java.lang.RuntimePermission "accessDeclaredMembers";'
- *
- * @return Annotation[]
- */
- public static final PrivilegedAction getAnnotationsAction(
- final AnnotatedElement element) {
- return new PrivilegedAction() {
- public Object run() {
- return element.getAnnotations();
- }
- };
- }
-
- /**
- * Return a PrivilegeAction object for
- * AnnotatedElement.getDeclaredAnnotations().
- *
- * Requires security policy:
- * 'permission java.lang.RuntimePermission "accessDeclaredMembers";'
- *
- * @return Annotation[]
- */
- public static final PrivilegedAction getDeclaredAnnotationsAction(
- final AnnotatedElement element) {
- return new PrivilegedAction() {
- public Object run() {
- return element.getDeclaredAnnotations();
- }
- };
- }
-
- /**
- * Return a PrivilegeAction object for
- * AnnotatedElement.isAnnotationPresent().
- *
- * Requires security policy:
- * 'permission java.lang.RuntimePermission "accessDeclaredMembers";'
- *
- * @return Boolean
- */
- public static final PrivilegedAction isAnnotationPresentAction(
- final AnnotatedElement element, final Class annotationClazz) {
- return new PrivilegedAction() {
- public Object run() {
- return element.isAnnotationPresent(annotationClazz)
- ? Boolean.TRUE : Boolean.FALSE;
- }
- };
- }
-}
+/*
+ * 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.openjpa.lib.util;
+
+import java.lang.reflect.AnnotatedElement;
+import java.security.PrivilegedAction;
+
+/**
+ * Helper class to obtain the Privilege(Exception)Action object to perform
+ * Java 2 doPrivilege security sensitive function call in the following
+ * methods:
+ * <ul>
+ * <li>AnnotatedElement.getAnnotations
+ * <li>AnnotatedElement.getDeclaredAnnotations
+ * <li>AnnotatedElement.isAnnotationPresent
+ * </ul>
+ *
+ * @author Albert Lee
+ */
+
+public abstract class J2DoPriv5Helper extends J2DoPrivHelper {
+
+ /**
+ * Return a PrivilegeAction object for AnnotatedElement.getAnnotations().
+ *
+ * Requires security policy:
+ * 'permission java.lang.RuntimePermission "accessDeclaredMembers";'
+ *
+ * @return Annotation[]
+ */
+ public static final PrivilegedAction getAnnotationsAction(
+ final AnnotatedElement element) {
+ return new PrivilegedAction() {
+ public Object run() {
+ return element.getAnnotations();
+ }
+ };
+ }
+
+ /**
+ * Return a PrivilegeAction object for
+ * AnnotatedElement.getDeclaredAnnotations().
+ *
+ * Requires security policy:
+ * 'permission java.lang.RuntimePermission "accessDeclaredMembers";'
+ *
+ * @return Annotation[]
+ */
+ public static final PrivilegedAction getDeclaredAnnotationsAction(
+ final AnnotatedElement element) {
+ return new PrivilegedAction() {
+ public Object run() {
+ return element.getDeclaredAnnotations();
+ }
+ };
+ }
+
+ /**
+ * Return a PrivilegeAction object for
+ * AnnotatedElement.isAnnotationPresent().
+ *
+ * Requires security policy:
+ * 'permission java.lang.RuntimePermission "accessDeclaredMembers";'
+ *
+ * @return Boolean
+ */
+ public static final PrivilegedAction isAnnotationPresentAction(
+ final AnnotatedElement element, final Class annotationClazz) {
+ return new PrivilegedAction() {
+ public Object run() {
+ return element.isAnnotationPresent(annotationClazz)
+ ? Boolean.TRUE : Boolean.FALSE;
+ }
+ };
+ }
+}
Propchange: openjpa/branches/1.0.x/openjpa-lib-5/src/main/java/org/apache/openjpa/lib/util/J2DoPriv5Helper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/ant/AbstractTask.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/AbstractProductDerivation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/BooleanValue.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/BootstrapException.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/BootstrapException.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/BootstrapException.java (original)
+++ openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/BootstrapException.java Sun Mar 22 23:45:15 2009
@@ -1,55 +1,55 @@
-/*
- * 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.openjpa.lib.conf;
-/**
- * Exception recognized by {@link ProductDerivations bootstrap} framework.
- *
- * @author Pinaki Poddar
- * @since 0.4.1.4
- *
- */
-public class BootstrapException extends RuntimeException {
-
- private boolean _fatal = false;
-
- public BootstrapException() {
- super();
- }
-
- public BootstrapException(String message) {
- super(message);
- }
-
- public BootstrapException(Throwable cause) {
- super(cause);
- }
-
- public BootstrapException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public BootstrapException setFatal(boolean fatal) {
- _fatal = fatal;
- return this;
- }
-
- public boolean isFatal() {
- return _fatal;
- }
-}
+/*
+ * 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.openjpa.lib.conf;
+/**
+ * Exception recognized by {@link ProductDerivations bootstrap} framework.
+ *
+ * @author Pinaki Poddar
+ * @since 0.4.1.4
+ *
+ */
+public class BootstrapException extends RuntimeException {
+
+ private boolean _fatal = false;
+
+ public BootstrapException() {
+ super();
+ }
+
+ public BootstrapException(String message) {
+ super(message);
+ }
+
+ public BootstrapException(Throwable cause) {
+ super(cause);
+ }
+
+ public BootstrapException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public BootstrapException setFatal(boolean fatal) {
+ _fatal = fatal;
+ return this;
+ }
+
+ public boolean isFatal() {
+ return _fatal;
+ }
+}
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/BootstrapException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurable.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configuration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ConfigurationProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Configurations.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/DoubleValue.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/FileValue.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/GenericConfigurable.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/IntValue.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/MapConfigurationProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ObjectValue.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/PluginListValue.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/PluginValue.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivation.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ProductDerivations.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/StringListValue.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/StringValue.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/Value.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/conf/ValueListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/graph/BreadthFirstWalk.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/graph/BreadthFirstWalk.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/graph/BreadthFirstWalk.java (original)
+++ openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/graph/BreadthFirstWalk.java Sun Mar 22 23:45:15 2009
@@ -1,145 +1,145 @@
-/*
- * 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.openjpa.lib.graph;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * <p>Performs a breadth-first walk of a given {@link Graph},
- * notifying visitors as it sees each node. See the BFS algorithm
- * in the book 'Introduction to Algorithms' by Cormen, Leiserson, and
- * Rivest.</p>
- * <p/>
- * <p>Each {@link GraphVisitor} will be notified when a node
- * is colored black (nodeVisited), edge seen (edgeVisited),
- * and a node is seen for the first time, i.e. colored gray (nodeSeen).</p>
- *
- * @author Steve Kim
- * @since 1.0.0
- * @nojavadoc
- */
-public class BreadthFirstWalk {
-
- private final Graph _graph;
- private final Set _visitors = new HashSet();
- private final List _queue = new LinkedList();
- private final Map _nodeInfo = new HashMap();
-
- public BreadthFirstWalk(Graph graph) {
- _graph = graph;
- }
-
- /**
- * Begins the breadth first traversal.
- */
- public void walk() {
- _queue.clear();
- _nodeInfo.clear();
-
- Collection nodes = _graph.getNodes();
- for (Iterator itr = nodes.iterator(); itr.hasNext();)
- _nodeInfo.put(itr.next(), new NodeInfo());
-
- Object node;
- NodeInfo info;
- for (Iterator itr = nodes.iterator(); itr.hasNext();) {
- node = itr.next();
- info = (NodeInfo) _nodeInfo.get(node);
- if (info.color == NodeInfo.COLOR_WHITE)
- enqueue(node, info);
- processQueue();
- }
- }
-
- /**
- * Process the queue to see what data needs to be obtained.
- */
- private void processQueue() {
- Object node;
- Object other;
- NodeInfo info;
- NodeInfo otherInfo;
- Collection edges;
- Edge edge;
- while (_queue.size() > 0) {
- node = _queue.remove(0);
- info = (NodeInfo) _nodeInfo.get(node);
- visit(node, info);
-
- edges = _graph.getEdgesFrom(node);
- for (Iterator itr = edges.iterator(); itr.hasNext();) {
- edge = (Edge) itr.next();
- edgeVisited(edge);
- other = edge.getOther(node);
- otherInfo = (NodeInfo) _nodeInfo.get(other);
- if (otherInfo.color == NodeInfo.COLOR_WHITE)
- enqueue(other, otherInfo);
- }
- }
- }
-
- /**
- * Push the given node onto the queue to be processed.
- * Notify visitors.
- */
- protected void enqueue(Object node, NodeInfo info) {
- _queue.add(node);
- info.color = NodeInfo.COLOR_GRAY;
- for (Iterator i = _visitors.iterator(); i.hasNext();)
- ((GraphVisitor) i.next()).nodeSeen(node);
- }
-
- /**
- * Visit the node. Mark the node black and notify visitors.
- */
- protected void visit(Object node, NodeInfo info) {
- info.color = NodeInfo.COLOR_BLACK;
- for (Iterator i = _visitors.iterator(); i.hasNext();)
- ((GraphVisitor) i.next()).nodeVisited(node);
- }
-
- /**
- * An edge is seen. Notify visitors.
- */
- protected void edgeVisited(Edge edge) {
- for (Iterator i = _visitors.iterator(); i.hasNext();)
- ((GraphVisitor) i.next()).edgeVisited(edge);
- }
-
- /**
- * add a {@link GraphVisitor} to be notified during breadth first search.
- */
- public void addGraphVisitor(GraphVisitor visitor) {
- _visitors.add(visitor);
- }
-
- /**
- * remove a given {@link GraphVisitor} from the listener set.
- */
- public void removeGraphVisitor(GraphVisitor visitor) {
- _visitors.remove(visitor);
- }
-}
+/*
+ * 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.openjpa.lib.graph;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * <p>Performs a breadth-first walk of a given {@link Graph},
+ * notifying visitors as it sees each node. See the BFS algorithm
+ * in the book 'Introduction to Algorithms' by Cormen, Leiserson, and
+ * Rivest.</p>
+ * <p/>
+ * <p>Each {@link GraphVisitor} will be notified when a node
+ * is colored black (nodeVisited), edge seen (edgeVisited),
+ * and a node is seen for the first time, i.e. colored gray (nodeSeen).</p>
+ *
+ * @author Steve Kim
+ * @since 1.0.0
+ * @nojavadoc
+ */
+public class BreadthFirstWalk {
+
+ private final Graph _graph;
+ private final Set _visitors = new HashSet();
+ private final List _queue = new LinkedList();
+ private final Map _nodeInfo = new HashMap();
+
+ public BreadthFirstWalk(Graph graph) {
+ _graph = graph;
+ }
+
+ /**
+ * Begins the breadth first traversal.
+ */
+ public void walk() {
+ _queue.clear();
+ _nodeInfo.clear();
+
+ Collection nodes = _graph.getNodes();
+ for (Iterator itr = nodes.iterator(); itr.hasNext();)
+ _nodeInfo.put(itr.next(), new NodeInfo());
+
+ Object node;
+ NodeInfo info;
+ for (Iterator itr = nodes.iterator(); itr.hasNext();) {
+ node = itr.next();
+ info = (NodeInfo) _nodeInfo.get(node);
+ if (info.color == NodeInfo.COLOR_WHITE)
+ enqueue(node, info);
+ processQueue();
+ }
+ }
+
+ /**
+ * Process the queue to see what data needs to be obtained.
+ */
+ private void processQueue() {
+ Object node;
+ Object other;
+ NodeInfo info;
+ NodeInfo otherInfo;
+ Collection edges;
+ Edge edge;
+ while (_queue.size() > 0) {
+ node = _queue.remove(0);
+ info = (NodeInfo) _nodeInfo.get(node);
+ visit(node, info);
+
+ edges = _graph.getEdgesFrom(node);
+ for (Iterator itr = edges.iterator(); itr.hasNext();) {
+ edge = (Edge) itr.next();
+ edgeVisited(edge);
+ other = edge.getOther(node);
+ otherInfo = (NodeInfo) _nodeInfo.get(other);
+ if (otherInfo.color == NodeInfo.COLOR_WHITE)
+ enqueue(other, otherInfo);
+ }
+ }
+ }
+
+ /**
+ * Push the given node onto the queue to be processed.
+ * Notify visitors.
+ */
+ protected void enqueue(Object node, NodeInfo info) {
+ _queue.add(node);
+ info.color = NodeInfo.COLOR_GRAY;
+ for (Iterator i = _visitors.iterator(); i.hasNext();)
+ ((GraphVisitor) i.next()).nodeSeen(node);
+ }
+
+ /**
+ * Visit the node. Mark the node black and notify visitors.
+ */
+ protected void visit(Object node, NodeInfo info) {
+ info.color = NodeInfo.COLOR_BLACK;
+ for (Iterator i = _visitors.iterator(); i.hasNext();)
+ ((GraphVisitor) i.next()).nodeVisited(node);
+ }
+
+ /**
+ * An edge is seen. Notify visitors.
+ */
+ protected void edgeVisited(Edge edge) {
+ for (Iterator i = _visitors.iterator(); i.hasNext();)
+ ((GraphVisitor) i.next()).edgeVisited(edge);
+ }
+
+ /**
+ * add a {@link GraphVisitor} to be notified during breadth first search.
+ */
+ public void addGraphVisitor(GraphVisitor visitor) {
+ _visitors.add(visitor);
+ }
+
+ /**
+ * remove a given {@link GraphVisitor} from the listener set.
+ */
+ public void removeGraphVisitor(GraphVisitor visitor) {
+ _visitors.remove(visitor);
+ }
+}
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/graph/BreadthFirstWalk.java
------------------------------------------------------------------------------
svn:eol-style = native