[teiid-commits] teiid SVN: r1065 - in trunk: common-internal/src/main/java/com/metamatrix/common/transaction and 4 other directories.
teiid-commits at lists.jboss.org
teiid-commits at lists.jboss.org
Thu Jun 18 11:00:40 EDT 2009
Author: shawkins
Date: 2009-06-18 11:00:39 -0400 (Thu, 18 Jun 2009)
New Revision: 1065
Removed:
trunk/common-internal/src/main/java/com/metamatrix/common/transaction/TransactionException.java
trunk/common-internal/src/main/java/com/metamatrix/common/transaction/TransactionNotSupportedException.java
trunk/common-internal/src/main/java/com/metamatrix/common/transaction/TransactionStatus.java
trunk/common-internal/src/main/java/com/metamatrix/common/transaction/UserTransaction.java
trunk/common-internal/src/main/java/com/metamatrix/common/transaction/UserTransactionFactory.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/AbstractTreeView.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/ChildRules.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/DefaultChildRules.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/RuledTreeViewImpl.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeIteratorWithStack.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/FolderOnlyFilter.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/PlatformAwareFilePermission.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/PreviewableDirectoryEntry.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/RuledDirectoryEntryViewImpl.java
Modified:
trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertiedObjectEditor.java
trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertiedObjectEditorImpl.java
trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertiedObjectView.java
trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertiedObjectsEditorImpl.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/basic/BasicTreeNodeEditor.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/basic/BasicTreeNodeSource.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/basic/BasicTreeView.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/FileSystemEntryEditor.java
trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/FileSystemView.java
trunk/server/src/main/java/com/metamatrix/platform/config/util/CurrentConfigHelper.java
Log:
TEIID-682 removing the old transactionmanager
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertiedObjectEditor.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertiedObjectEditor.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertiedObjectEditor.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -24,14 +24,12 @@
import java.util.List;
-import com.metamatrix.common.transaction.UserTransactionFactory;
-
/**
* This interface represents an object that can view and edit properties for
* a PropertiedObject. It is conceptually a stateless object that requires
* in all methods the reference to the PropertiedObject.
*/
-public interface PropertiedObjectEditor extends PropertyAccessPolicy, UserTransactionFactory {
+public interface PropertiedObjectEditor extends PropertyAccessPolicy {
/**
* The value object that is returned by this interface's methods when
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertiedObjectEditorImpl.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertiedObjectEditorImpl.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertiedObjectEditorImpl.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -24,38 +24,24 @@
import java.util.List;
-import com.metamatrix.common.transaction.UserTransaction;
-import com.metamatrix.common.transaction.UserTransactionFactory;
-import com.metamatrix.common.transaction.manager.SimpleUserTransactionFactory;
import com.metamatrix.core.util.ArgCheck;
public class PropertiedObjectEditorImpl implements PropertiedObjectEditor {
private PropertyAccessPolicy policy;
- private UserTransactionFactory txnFactory;
- public PropertiedObjectEditorImpl( PropertyAccessPolicy policy, UserTransactionFactory txnFactory ) {
+ public PropertiedObjectEditorImpl( PropertyAccessPolicy policy ) {
ArgCheck.isNotNull(policy);
- ArgCheck.isNotNull(txnFactory);
this.policy = policy;
- this.txnFactory = txnFactory;
}
/**
* Create an empty property definition object with all defaults.
*/
public PropertiedObjectEditorImpl() {
- this( new DefaultPropertyAccessPolicy(), new SimpleUserTransactionFactory() );
+ this( new DefaultPropertyAccessPolicy() );
}
- public PropertiedObjectEditorImpl( PropertyAccessPolicy policy ) {
- this( policy, new SimpleUserTransactionFactory() );
- }
-
- public PropertiedObjectEditorImpl( UserTransactionFactory txnFactory ) {
- this( new DefaultPropertyAccessPolicy(), txnFactory );
- }
-
protected PropertiedObjectImpl assertPropertiedObject( PropertiedObject obj ) {
ArgCheck.isInstanceOf(PropertiedObjectImpl.class, obj);
return (PropertiedObjectImpl) obj;
@@ -202,41 +188,5 @@
this.policy.reset(obj);
}
-
-
- // ########################## UserTransactionFactory Methods ###################################
-
- /**
- * Create a new instance of a UserTransaction that may be used to
- * read information. Read transactions do not have a source object
- * associated with them (since they never directly modify data).
- * @return the new transaction object
- */
- public UserTransaction createReadTransaction() {
- return this.txnFactory.createReadTransaction();
- }
-
- /**
- * Create a new instance of a UserTransaction that may be used to
- * write and/or update information. The transaction will <i>not</i> have a source object
- * associated with it.
- * @return the new transaction object
- */
- public UserTransaction createWriteTransaction() {
- return this.txnFactory.createWriteTransaction();
- }
-
- /**
- * Create a new instance of a UserTransaction that may be used to
- * write and/or update information. The source object will be used for all events that are
- * fired as a result of or as a product of this transaction.
- * @param source the object that is considered to be the source of the transaction;
- * may be null
- * @return the new transaction object
- */
- public UserTransaction createWriteTransaction(Object source) {
- return this.txnFactory.createWriteTransaction(source);
- }
-
}
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertiedObjectView.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertiedObjectView.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertiedObjectView.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -22,10 +22,8 @@
package com.metamatrix.common.object;
-import com.metamatrix.common.transaction.UserTransactionFactory;
+public interface PropertiedObjectView {
-public interface PropertiedObjectView extends UserTransactionFactory {
-
/**
* Return the propertied object editor for this view.
* @return the PropertiedObjectEditor instance
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertiedObjectsEditorImpl.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertiedObjectsEditorImpl.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/object/PropertiedObjectsEditorImpl.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -28,7 +28,6 @@
import java.util.LinkedList;
import java.util.List;
-import com.metamatrix.common.transaction.UserTransactionFactory;
import com.metamatrix.core.util.ArgCheck;
import com.metamatrix.core.util.Assertion;
@@ -36,23 +35,14 @@
private List objects = new LinkedList();
- public PropertiedObjectsEditorImpl( PropertyAccessPolicy policy, UserTransactionFactory txnFactory ) {
- super(policy,txnFactory);
+ public PropertiedObjectsEditorImpl( PropertyAccessPolicy policy ) {
+ super(policy);
}
public PropertiedObjectsEditorImpl() {
super();
}
- public PropertiedObjectsEditorImpl( PropertyAccessPolicy policy ) {
- super(policy);
- }
-
- public PropertiedObjectsEditorImpl( UserTransactionFactory txnFactory ) {
- super(txnFactory);
- }
-
-
public List getObjects() {
return objects;
}
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/transaction/TransactionException.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/transaction/TransactionException.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/transaction/TransactionException.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -1,81 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.transaction;
-
-import com.metamatrix.api.exception.MetaMatrixException;
-
-/**
- * TransactionException exception indicates that the request cannot be
- * executed because of an error with the transaction.
- */
-public class TransactionException extends MetaMatrixException {
-
- /**
- * No-Arg Constructor
- */
- public TransactionException( ) {
- super( );
- }
- /**
- * Construct an instance with the message specified.
- *
- * @param message A message describing the exception
- */
- public TransactionException( String message ) {
- super( message );
- }
-
- /**
- * Construct an instance with the message and error code specified.
- *
- * @param message A message describing the exception
- * @param code The error code
- */
- public TransactionException( String code, String message ) {
- super( code, message );
- }
-
- /**
- * Construct an instance from a message and an exception to chain to this one.
- *
- * @param code A code denoting the exception
- * @param e An exception to nest within this one
- */
- public TransactionException( Exception e, String message ) {
- super( e, message );
- }
-
- /**
- * Construct an instance from a message and a code and an exception to
- * chain to this one.
- *
- * @param e An exception to nest within this one
- * @param message A message describing the exception
- * @param code A code denoting the exception
- */
- public TransactionException( Exception e, String code, String message ) {
- super( e, code, message );
- }
-
-} // END CLASS
-
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/transaction/TransactionNotSupportedException.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/transaction/TransactionNotSupportedException.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/transaction/TransactionNotSupportedException.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.transaction;
-
-/**
- * TransactionNotSupportedException exception indicates that the request cannot be
- * executed because the transaction operation is not a supported feature. For example,
- * the Transaction Manager throws this exception when a calling thread attempts
- * to start a new transaction when the thread is already associated with a
- * transaction because nested transaction is not supported.
- */
-public class TransactionNotSupportedException extends TransactionException {
-
-
- /**
- * No-Arg Constructor
- */
- public TransactionNotSupportedException( ) {
- super( );
- }
- /**
- * Construct an instance with the message specified.
- *
- * @param message A message describing the exception
- */
- public TransactionNotSupportedException( String message ) {
- super( message );
- }
-
- /**
- * Construct an instance with the message and error code specified.
- *
- * @param message A message describing the exception
- * @param code The error code
- */
- public TransactionNotSupportedException( String code, String message ) {
- super( code, message );
- }
-
- /**
- * Construct an instance from a message and an exception to chain to this one.
- *
- * @param code A code denoting the exception
- * @param e An exception to nest within this one
- */
- public TransactionNotSupportedException( Exception e, String message ) {
- super( e, message );
- }
-
- /**
- * Construct an instance from a message and a code and an exception to
- * chain to this one.
- *
- * @param e An exception to nest within this one
- * @param message A message describing the exception
- * @param code A code denoting the exception
- */
- public TransactionNotSupportedException( Exception e, String code, String message ) {
- super( e, code, message );
- }
-
-} // END CLASS
-
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/transaction/TransactionStatus.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/transaction/TransactionStatus.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/transaction/TransactionStatus.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -1,102 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.transaction;
-
-public interface TransactionStatus {
-
- /**
- * A transaction is associated with the target object but its current
- * status cannot be determined. This is a transient condition and a subsequent
- * invocation will ultimately return a different status.
- */
- int STATUS_UNKNOWN = 5;
-
- /**
- * A transaction is associated with the target object and it is in the
- * active state. An implementation returns this status after a
- * transaction has been started and prior to a Coordinator issuing
- * any prepares unless the transaction has been marked for rollback.
- */
- int STATUS_ACTIVE = 0;
-
- /**
- * A transaction is associated with the target object and it is in
- * the process of committing. An implementation returns this status
- * if it has decided to commit, but has not yet completed the process,
- * probably because it is waiting for responses from one or more Resources.
- */
- int STATUS_COMMITTING = 8;
-
- /**
- * A transaction is associated with the target object and it has been
- * committed. It is likely that heuristics exists, otherwise the
- * transaction would have been destroyed and NoTransaction returned.
- */
- int STATUS_COMMITTED = 3;
-
- /**
- * A transaction is associated with the target object and it has been
- * marked for rollback, perhaps as a result of a setRollbackOnly operation
- */
- int STATUS_MARKED_ROLLBACK = 1;
-
- /**
- * A transaction is associated with the target object and it is in
- * the process of preparing. An implementation returns this status
- * if it has started preparing, but has not yet completed the process,
- * probably because it is waiting for responses to prepare from one or
- * more Resources
- */
- int STATUS_PREPARING = 7;
-
- /**
- * A transaction is associated with the target object and it has
- * been prepared, i.e. all subordinates have responded Vote.Commit.
- * The target object may be waiting for a superior's instruction as
- * how to proceed.
- */
- int STATUS_PREPARED = 2;
-
- /**
- * A transaction is associated with the target object and it is
- * in the process of rolling back. An implementation returns this
- * status if it has decided to rollback, but has not yet completed the
- * process, probably because it is waiting for responses from one or more Resources.
- */
- int STATUS_ROLLING_BACK = 9;
-
- /**
- * A transaction is associated with the target object and the outcome
- * has been determined as rollback. It is likely that heuristics exist,
- * otherwise the transaction would have been destroyed and NoTransaction
- * returned.
- */
- int STATUS_ROLLEDBACK = 4;
-
- /**
- * No transaction is currently associated with the target object.
- * This will occur after a transaction has completed.
- */
- int STATUS_NO_TRANSACTION = 6;
-
-}
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/transaction/UserTransaction.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/transaction/UserTransaction.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/transaction/UserTransaction.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -1,87 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.transaction;
-
-public interface UserTransaction {
-
- /**
- * Obtain the status of the transaction represented by this object.
- * @return The transaction status.
- */
- int getStatus() throws TransactionException;
-
- /**
- * Create a new transaction and associate it with this object.
- * @throws TransactionNotSupportedException if the current thread is already
- * associated with a transaction and the manager does not support
- * nested system transactions.
- */
- void begin() throws TransactionException;
-
- /**
- * Modify the value of the timeout value that is associated with the
- * transactions represented by this object.
- * If an application has not called this method, the transaction service
- * uses some default value for the transaction timeout.
- * @param seconds The value of the timeout in seconds. If the value is
- * zero, the transaction service restores the default value.
- * @throws IllegalStateException Thrown if this object is not associated with a transaction
- */
- void setTransactionTimeout(int seconds) throws TransactionException;
-
- /**
- * Modify the transaction associated with this object such that
- * the only possible outcome of the transaction is to roll back the transaction.
- * @throws IllegalStateException Thrown if this object is not
- * associated with a transaction.
- */
- void setRollbackOnly() throws TransactionException;
-
- /**
- * Complete the transaction associated with this object.
- * When this method completes, the thread becomes associated with no transaction.
- * @throws IllegalStateException Thrown if this object is not
- * associated with a transaction.
- */
- void commit() throws TransactionException;
-
- /**
- * Roll back the transaction associated with this object.
- * When this method completes, the thread becomes associated with no
- * transaction.
- * @throws IllegalStateException Thrown if this object is not
- * associated with a transaction.
- */
- void rollback() throws TransactionException;
-
- /**
- * Return the (optional) reference to the object that is considered
- * the source of the transaction represented by this object.
- * This is used, for example, to set the source of all events occuring within this
- * transaction.
- * @return the source object, which may be null
- */
- Object getSource() throws TransactionException;
-
-}
-
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/transaction/UserTransactionFactory.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/transaction/UserTransactionFactory.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/transaction/UserTransactionFactory.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -1,65 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.transaction;
-
-public interface UserTransactionFactory {
-
- /**
- * Create a new instance of a UserTransaction that may be used to
- * read information. Read transactions do not have a source object
- * associated with them (since they never directly modify data).
- * <p>
- * The returned transaction object will not be bound to an underlying
- * system transaction until <code>begin()</code> is called on the returned
- * object.
- * @return the new transaction object
- */
- UserTransaction createReadTransaction();
-
- /**
- * Create a new instance of a UserTransaction that may be used to
- * write and/or update information. The transaction will <i>not</i> have a source object
- * associated with it.
- * <p>
- * The returned transaction object will not be bound to an underlying
- * system transaction until <code>begin()</code> is called on the returned
- * object.
- * @return the new transaction object
- */
- UserTransaction createWriteTransaction();
-
- /**
- * Create a new instance of a UserTransaction that may be used to
- * write and/or update information. The source object will be used for all events that are
- * fired as a result of or as a product of this transaction.
- * <p>
- * The returned transaction object will not be bound to an underlying
- * system transaction until <code>begin()</code> is called on the returned
- * object.
- * @param source the object that is considered to be the source of the transaction;
- * may be null
- * @return the new transaction object
- */
- UserTransaction createWriteTransaction(Object source);
-}
-
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/tree/AbstractTreeView.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/AbstractTreeView.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/AbstractTreeView.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -1,246 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.tree;
-
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-
-import com.metamatrix.common.CommonPlugin;
-import com.metamatrix.common.object.PropertiedObjectEditor;
-import com.metamatrix.common.transaction.UserTransaction;
-import com.metamatrix.common.util.ErrorMessageKeys;
-import com.metamatrix.core.util.ArgCheck;
-
-abstract public class AbstractTreeView implements TreeView {
-
- private static TreeNodeFilter DEFAULT_FILTER = new PassThroughTreeNodeFilter();
- private static Comparator DEFAULT_COMPARATOR = new TreeNodePathComparator();
- private TreeNodeFilter filter = DEFAULT_FILTER;
- private Comparator comparator = DEFAULT_COMPARATOR;
-
- public AbstractTreeView() {
- }
-
- /**
- * Set the filter that limits the set of TreeNode instances returned from this view.
- * @param filter the filter, or null if the default "pass-through" filter should be used.
- */
- public void setFilter(TreeNodeFilter filter) {
- if ( filter == null ) {
- this.filter = DEFAULT_FILTER;
- } else {
- this.filter = filter;
- }
- }
-
- /**
- * Return the filter that is being used by this view.
- * @return the current filter; never null
- */
- public TreeNodeFilter getFilter() {
- return this.filter;
- }
-
- /**
- * Set the comparator that should be used to order the children.
- * @param comparator the comparator, or null if node path sorting should be used.
- */
- public void setComparator(Comparator comparator) {
- if ( comparator == null ) {
- this.comparator = DEFAULT_COMPARATOR;
- } else {
- this.comparator = comparator;
- }
- }
-
- /**
- * Return the comparator used to order for children returned from this view.
- * @return the current comparator; never null
- */
- public Comparator getComparator() {
- return this.comparator;
- }
-
- /**
- * Get the definitions of the properties for the TreeNode instances
- * returned from this view.
- * @return the unmodifiable list of PropertyDefinition instances; never null
- */
- public abstract List getPropertyDefinitions();
-
- /**
- * Returns the single root of this TreeNode system.
- * @return the unmodifiable list of TreeNode instances
- * that represent the root of this view.
- */
- public abstract List getRoots();
-
- /**
- * Determine whether the specified TreeNode is a root of the underlying system.
- * @param node the TreeNode instance that is to be checked; may not be null
- * @return true if the node is a root, or false otherwise.
- */
- public boolean isRoot(TreeNode node) {
- if ( node == null ) {
- throw new AssertionError(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0001));
- }
- return this.getRoots().contains(node);
- }
-
- /**
- * Determine whether the specified TreeNode is hidden.
- * @param node the TreeNode instance that is to be checked; may not be null
- * @return true if the node is hidden, or false otherwise.
- */
- public abstract boolean isHidden(TreeNode node);
-
- /**
- * Return the marked state of the specified node.
- * @return the marked state of the node.
- */
- public abstract boolean isMarked(TreeNode node);
-
- /**
- * Obtain the DirectoryEntry that represents the home for the underlying
- * system. If the underlying system does not support a home entry concept,
- * null is returned.
- * @return the entry that represents the home, or null if no home concept
- * is supported.
- */
- public abstract TreeNode getHome();
-
- /**
- * Obtain the abstract path for this TreeNode.
- * @return the string that represents the abstract path of this node; never null
- */
- public abstract String getPath(TreeNode node);
-
- /**
- * Obtain the character that is used to separate names in a path sequence for
- * the abstract path. This character is completely dependent upon the implementation.
- * @return the charater used to delimit names in the abstract path.
- */
- public abstract char getSeparatorChar();
-
- /**
- * Obtain the character (as a String) that is used to separate names in a path sequence for
- * the abstract path.
- * @return the string containing the charater used to delimit names in the abstract path; never null
- */
- public abstract String getSeparator();
-
- /**
- * Determine the parent TreeNode for the specified node, or null if
- * the specified node is a root.
- * @param node the TreeNode instance for which the parent is to be obtained;
- * may not be null
- * @return the parent node, or null if there is no parent
- */
- public abstract TreeNode getParent(TreeNode node);
-
- /**
- * Obtain the set of entries that are considered the children of the specified
- * TreeNode.
- * @param parent the TreeNode instance for which the child entries
- * are to be obtained; may not be null
- * @return the unmodifiable list of TreeNode instances that are considered the children
- * of the specified node; never null but possibly empty
- */
- public abstract List getChildren(TreeNode parent);
-
- /**
- * Determine whether the specified node is a child of the given parent node.
- * @return true if the node is a child of the given parent node.
- */
- public abstract boolean isParentOf(TreeNode parent, TreeNode child);
-
- /**
- * Determine whether the specified node is a descendent of the given ancestor node.
- * @return true if the node is a descendent of the given ancestor node.
- */
- public abstract boolean isAncestorOf(TreeNode ancestor, TreeNode descendent);
-
- /**
- * Return the propertied object editor for this view.
- * @return the PropertiedObjectEditor instance
- */
- public abstract PropertiedObjectEditor getPropertiedObjectEditor();
-
- /**
- * Return the tree node editor for this view.
- * @return the TreeNodeEditor instance
- */
- public abstract TreeNodeEditor getTreeNodeEditor();
-
- /**
- * Create a new instance of a UserTransaction that may be used to
- * read information. Read transactions do not have a source object
- * associated with them (since they never directly modify data).
- * @return the new transaction object
- */
- public abstract UserTransaction createReadTransaction();
-
- /**
- * Create a new instance of a UserTransaction that may be used to
- * write and/or update information. The transaction will <i>not</i> have a source object
- * associated with it.
- * @return the new transaction object
- */
- public abstract UserTransaction createWriteTransaction();
-
- /**
- * Create a new instance of a UserTransaction that may be used to
- * write and/or update information. The source object will be used for all events that are
- * fired as a result of or as a product of this transaction.
- * @param source the object that is considered to be the source of the transaction;
- * may be null
- * @return the new transaction object
- */
- public abstract UserTransaction createWriteTransaction(Object source);
-
- /**
- * Obtain an iterator for this whole view, which navigates the view's
- * nodes using pre-order rules (i.e., it visits a node before its children).
- * @return the view iterator
- */
- public Iterator iterator() {
- return new TreeNodeIterator(this.getRoots(),this);
- }
-
- /**
- * Obtain an iterator for the view starting at the specified node. This
- * implementation currently navigates the subtree using pre-order rules
- * (i.e., it visits a node before its children).
- * @param startingPoint the root of the subtree over which the iterator
- * is to navigate; may not be null
- * @return the iterator that traverses the nodes in the subtree starting
- * at the specified node; never null
- */
- public Iterator iterator(TreeNode startingPoint) {
- ArgCheck.isNotNull(startingPoint);
- return new TreeNodeIterator(startingPoint,this);
- }
-
-}
-
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/tree/ChildRules.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/ChildRules.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/ChildRules.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -1,41 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.tree;
-
-import java.util.List;
-
-import com.metamatrix.common.object.ObjectDefinition;
-
-/**
- * This interface is used to encapsulate the rules that govern which types of
- * nodes may have children.
- */
-public interface ChildRules {
- boolean isHidden(ObjectDefinition defn);
- boolean getAllowsChildren(ObjectDefinition defn);
- boolean getAllowsChild(ObjectDefinition parentDefn, ObjectDefinition childDefn);
- void setValidName(TreeNode newNode, List children );
- void setValidName(TreeNode newNode, ObjectDefinition childType, List children );
-
-}
-
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/tree/DefaultChildRules.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/DefaultChildRules.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/DefaultChildRules.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.tree;
-
-import java.util.List;
-
-import com.metamatrix.common.object.ObjectDefinition;
-
-/**
- * This interface is used to encapsulate the rules that govern which types of
- * nodes may have children.
- */
-public class DefaultChildRules implements ChildRules {
- public boolean isHidden(ObjectDefinition defn) {
- return false;
- }
- public boolean getAllowsChildren(ObjectDefinition defn) {
- return true;
- }
- public boolean getAllowsChild(ObjectDefinition parentDefn, ObjectDefinition childDefn) {
- return getAllowsChildren(parentDefn);
- }
- public void setValidName(TreeNode newNode, List children ) {
- }
- public void setValidName(TreeNode newNode, ObjectDefinition childType, List children ) {
- }
-}
-
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/tree/RuledTreeViewImpl.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/RuledTreeViewImpl.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/RuledTreeViewImpl.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -1,450 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.tree;
-
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import com.metamatrix.common.CommonPlugin;
-import com.metamatrix.common.object.PropertiedObjectEditor;
-import com.metamatrix.common.transaction.UserTransaction;
-import com.metamatrix.common.util.ErrorMessageKeys;
-import com.metamatrix.core.util.ArgCheck;
-import com.metamatrix.core.util.Assertion;
-
-public class RuledTreeViewImpl extends AbstractTreeView implements TreeView {
-
- private List roots = null;
- private TreeView tree = null;
- private ChildRules rules = null;
-
- public RuledTreeViewImpl(TreeView tree, ChildRules rules ) {
- super();
- ArgCheck.isNotNull(tree);
- ArgCheck.isNotNull(rules);
- this.tree = tree;
- this.rules = rules;
- this.roots = null;
- }
-
- public RuledTreeViewImpl(TreeView tree, TreeNode root, ChildRules rules ) {
- super();
- ArgCheck.isNotNull(tree);
- ArgCheck.isNotNull(tree);
- ArgCheck.isNotNull(rules);
- // Assert that the root is within the tree ...
- boolean found = false;
- Iterator iter = tree.getRoots().iterator();
- while ( iter.hasNext() ) {
- TreeNode treeRoot = (TreeNode) iter.next();
- if ( tree.isAncestorOf(treeRoot,root) ) {
- found = true;
- break;
- }
- }
- Assertion.assertTrue(found,"The TreeNode must reference a node contained by the TreeView"); //$NON-NLS-1$
- this.tree = tree;
- this.rules = rules;
- this.roots = new ArrayList(1);
- this.roots.add(root);
- }
-
- protected TreeView getTreeView() {
- return tree;
- }
-
- // ########################## PropertiedObjectView Methods ###################################
-
- /**
- * Return the propertied object editor for this view.
- * @return the PropertiedObjectEditor instance
- */
- public PropertiedObjectEditor getPropertiedObjectEditor() {
- return this.tree.getPropertiedObjectEditor();
- }
-
- // ########################## TreeView Methods ###################################
-
- /**
- * Get the definitions of the properties for the TreeNode instances
- * returned from this view.
- * @return the unmodifiable list of PropertyDefinition instances; never null
- */
- public List getPropertyDefinitions() {
- throw new RuntimeException(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0004));
- }
-
- /**
- * Returns the single root of this Composite TreeNode system.
- * @return the unmodifiable list of TreeNode instances
- * that represent the root of this view.
- */
- public List getRoots() {
- List theRoots = this.roots;
- if ( theRoots == null ) {
- theRoots = this.tree.getRoots();
- }
- // Find those nodes that are not hidden; if all of the nodes are hidden,
- // then try their children ...
- List results = getUnhiddenNodes(theRoots);
- if ( results.size() != 0 ) {
- return results;
- }
- List modResults = new ArrayList( results );
- Iterator iter = theRoots.iterator();
- while ( iter.hasNext() ) {
- modResults.addAll( this.tree.getChildren((TreeNode)iter.next()) );
- }
- return getUnhiddenNodes(modResults);
- }
-
-
- /**
- * Set the roots for this view.
- * @param roots the roots for the view; if null, the view will use the same roots
- * as the view's original tree (model)
- */
- protected void setViewRoots( List roots ) {
- if ( roots == null || roots.isEmpty() ) {
- this.roots = null;
- } else {
- this.roots = roots;
- }
- }
-
- protected List getUnhiddenNodes( List nodes ) {
- if ( nodes == null ) {
- return Collections.EMPTY_LIST;
- }
- List removeNodes = null;
- Iterator iter = nodes.iterator();
- while ( iter.hasNext() ) {
- TreeNode node = (TreeNode) iter.next();
- if ( isNodeHidden(node) ) {
- if ( removeNodes == null ) {
- removeNodes = new ArrayList(nodes.size());
- }
- removeNodes.add(node);
- }
- }
- if ( removeNodes == null ) {
- return nodes;
- }
- List results = new ArrayList(nodes.size());
- results.addAll(nodes);
- results.removeAll(removeNodes);
- return Collections.unmodifiableList(results);
- }
-
- protected Set getUnhiddenNodes( Set nodes ) {
- if ( nodes == null ) {
- return Collections.EMPTY_SET;
- }
- List removeNodes = null;
- Iterator iter = nodes.iterator();
- while ( iter.hasNext() ) {
- TreeNode node = (TreeNode) iter.next();
- if ( isNodeHidden(node) ) {
- if ( removeNodes == null ) {
- removeNodes = new ArrayList(nodes.size());
- }
- removeNodes.add(node);
- }
- }
- if ( removeNodes == null ) {
- return nodes;
- }
- Set results = new HashSet(7);
- results.addAll(nodes);
- results.removeAll(removeNodes);
- return Collections.unmodifiableSet(results);
- }
-
- /**
- * Determine whether the specified TreeNode is hidden.
- * @param node the TreeNode instance that is to be checked; may
- * not be null
- * @return true if the node is hidden, or false otherwise.
- */
- public boolean isHidden(TreeNode node) {
- if ( node == null ) {
- throw new AssertionError(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0001));
- }
- return isNodeHidden(node);
- }
-
- protected boolean isNodeHidden(TreeNode node) {
- if ( this.rules.isHidden(node.getType()) ) {
- return true;
- }
- return ! super.getFilter().accept(node);
- }
-
- /**
- * Return the marked state of the specified node.
- * @return the marked state of the node.
- */
- public boolean isMarked(TreeNode node) {
- ArgCheck.isNotNull(node);
- return this.tree.isMarked(node);
- }
-
- /**
- * Set the marked state of the specified entry.
- * @param true if the node is to be marked, or false if it is to be un-marked.
- */
- public void setMarked(TreeNode node, boolean markedState) {
- ArgCheck.isNotNull(node);
- this.tree.setMarked(node,markedState);
- }
-
- /**
- * Return the set of marked nodes for this view.
- * @param the unmodifiable set of marked nodes; never null
- */
- public Set getMarked() {
- return this.getUnhiddenNodes(this.tree.getMarked());
- }
-
- /**
- * Obtain the TreeNode that represents the home for the underlying system.
- * which for a MetadataTreeView is the same as the root of the view.
- * @return the node that represents the home, or null if no home concept
- * is supported.
- */
- public TreeNode getHome() {
- return this.tree.getHome();
- }
-
- /**
- * Obtain the abstract path for this TreeNode.
- * @return the string that represents the abstract path of this node; never null
- */
- public String getPath(TreeNode node) {
- return this.tree.getPath(node);
- }
-
- /**
- * Obtain the character that is used to separate names in a path sequence for
- * the abstract path. This character is completely dependent upon the implementation.
- * @return the charater used to delimit names in the abstract path.
- */
- public char getSeparatorChar() {
- return this.tree.getSeparatorChar();
- }
-
- /**
- * Obtain the character (as a String) that is used to separate names in a path sequence for
- * the abstract path.
- * @return the string containing the charater used to delimit names in the abstract path; never null
- */
- public String getSeparator() {
- return this.tree.getSeparator();
- }
-
- /**
- * Determine the parent TreeNode for the specified node, or null if
- * the specified node is a root.
- * @param node the TreeNode instance for which the parent is to be obtained;
- * may not be null
- * @return the parent node, or null if there is no parent
- */
- public TreeNode getParent(TreeNode node) {
- // If the node is one of the roots, then return null
- if ( this.roots != null && this.roots.contains(node) ) {
- return null;
- }
- // Otherwise, find the parent from the tree
- return this.tree.getParent(node);
- }
-
- /**
- * Determine whether the specified TreeNode may contain children.
- * @param entry the TreeNode instance that is to be checked; may
- * not be null
- * @return true if the entry can contain children, or false otherwise.
- */
- public boolean allowsChildren(TreeNode entry) {
- ArgCheck.isNotNull(entry);
- return this.rules.getAllowsChildren(entry.getType());
- }
-
- /**
- * Determine whether the specified parent TreeNode may contain the
- * specified child node.
- * @param parent the TreeNode instance that is to be the parent;
- * may not be null
- * @param potentialChild the TreeNode instance that is to be the child;
- * may not be null
- * @return true if potentialChild can be placed as a child of parent,
- * or false otherwise.
- */
- public boolean allowsChild(TreeNode parent, TreeNode potentialChild) {
- ArgCheck.isNotNull(parent);
- ArgCheck.isNotNull(potentialChild);
- return this.rules.getAllowsChild(parent.getType(),potentialChild.getType());
- }
-
- /**
- * Obtain the set of entries that are considered the children of the specified
- * TreeNode.
- * @param parent the TreeNode instance for which the child entries
- * are to be obtained; may not be null
- * @return the unmodifiable list of TreeNode instances that are considered the children
- * of the specified node; never null but possibly empty
- */
- public List getChildren(TreeNode parent) {
- ArgCheck.isNotNull(parent);
- return this.getUnhiddenNodes( this.tree.getChildren(parent) );
- }
-
-// public int getIndexOfChild( TreeNode child ) {
-// Assertion.isNotNull(child,"The TreeNode reference may not be null");
-// return this.tree.getIndexOfChild(child);
-// }
-
- /**
- * Determine whether the specified node is a child of the given parent node.
- * @return true if the node is a child of the given parent node.
- */
- public boolean isParentOf(TreeNode parent, TreeNode child) {
- ArgCheck.isNotNull(parent);
- ArgCheck.isNotNull(child);
- // If the child is one of the roots, then return false
- if ( this.roots != null && this.roots.contains(child) ) {
- return false;
- }
- return this.tree.isParentOf(parent,child);
- }
-
- /**
- * Determine whether the specified node is a descendent of the given ancestor node.
- * @return true if the node is a descendent of the given ancestor node.
- */
- public boolean isAncestorOf(TreeNode ancestor, TreeNode descendent) {
- ArgCheck.isNotNull(ancestor);
- ArgCheck.isNotNull(descendent);
- // If the descendent is one of the roots, then return false
- if ( this.roots != null && this.roots.contains(descendent) ) {
- return false;
- }
- return this.tree.isAncestorOf(ancestor,descendent);
- }
-
- /**
- * Return the tree node editor for this view.
- * @return the TreeNodeEditor instance
- */
- public TreeNodeEditor getTreeNodeEditor() {
- return this.tree.getTreeNodeEditor();
- }
-
- // ########################## UserTransactionFactory Methods ###################################
-
- /**
- * Create a new instance of a UserTransaction that may be used to
- * read information. Read transactions do not have a source object
- * associated with them (since they never directly modify data).
- * @return the new transaction object
- */
- public UserTransaction createReadTransaction() {
- return this.tree.createReadTransaction();
- }
-
- /**
- * Create a new instance of a UserTransaction that may be used to
- * write and/or update information. The transaction will <i>not</i> have a source object
- * associated with it.
- * @return the new transaction object
- */
- public UserTransaction createWriteTransaction() {
- return this.tree.createWriteTransaction();
- }
-
- /**
- * Create a new instance of a UserTransaction that may be used to
- * write and/or update information. The source object will be used for all events that are
- * fired as a result of or as a product of this transaction.
- * @param source the object that is considered to be the source of the transaction;
- * may be null
- * @return the new transaction object
- */
- public UserTransaction createWriteTransaction(Object source) {
- return this.tree.createWriteTransaction(source);
- }
-
- /**
- * Obtain an iterator for this whole view, which navigates the view's
- * nodes using pre-order rules (i.e., it visits a node before its children).
- * @return the view iterator
- */
- public Iterator iterator() {
- return new TreeNodeIterator(this.getRoots(),this);
- }
-
- /**
- * Obtain an iterator for the view starting at the specified node. This
- * implementation currently navigates the subtree using pre-order rules
- * (i.e., it visits a node before its children).
- * @param startingPoint the root of the subtree over which the iterator
- * is to navigate; may not be null
- * @return the iterator that traverses the nodes in the subtree starting
- * at the specified node; never null
- */
- public Iterator iterator(TreeNode startingPoint) {
- ArgCheck.isNotNull(startingPoint);
- return new TreeNodeIterator(startingPoint,this);
- }
-
- protected ChildRules getChildRules() {
- return this.rules;
- }
-
- public void print( PrintStream stream ) {
- if ( stream == null ) {
- throw new AssertionError(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0010));
- }
- stream.println("ProxyTreeViewImpl"); //$NON-NLS-1$
- Iterator iter = this.getRoots().iterator();
- while ( iter.hasNext() ) {
- print((TreeNode)iter.next(),stream," "); //$NON-NLS-1$
- }
- }
-
- private void print( TreeNode node, PrintStream stream, String leadingString ) {
- if ( this.isNodeHidden(node) ) {
- return;
- }
- stream.println(leadingString + node.getName() );
- Iterator iter = this.getChildren(node).iterator();
- while ( iter.hasNext() ) {
- print((TreeNode)iter.next(),stream,leadingString + " "); //$NON-NLS-1$
- }
- }
-
-}
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeIteratorWithStack.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeIteratorWithStack.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/TreeNodeIteratorWithStack.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -1,227 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.tree;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.ListIterator;
-
-
-/**
- * This iterator implementation extends {@link com.metamatrix.common.tree.TreeNodeIterator} by maintaining
- * a stack of TreeNodes from the root to the last node returned by {@link #next()}.
- * <p>
- * This class has the ability to track with each TreeNode instance in the stack a payload object. However,
- * in order to use this feature, this class must be extended by subclassing the {@link #createPayload(TreeNode)}
- * method must be overridden.
- * </p>
- * <p>
- * Also, the {@link java.util.LinkedList stack} is accessed with the {@link #getStack()} method and contains
- * instances of {@link TreeNodeIteratorWithStack#StackEntry TreeNodeIteratorWithStack.StackEntry} instances.
- * </p>
- */
-public class TreeNodeIteratorWithStack implements Iterator {
-
- private final Iterator iterator;
- private final LinkedList workingList;
- private final LinkedList stack;
- private final TreeView view;
- private final TreeNode startingNode;
-
- /**
- * Construct an instance of XMLNamespaceAwareIterator.
- * @param startingNode
- * @param view
- */
- public TreeNodeIteratorWithStack(final TreeNode startingNode, final TreeView view) {
- this(startingNode,view, new TreeNodeIterator(startingNode,view));
- }
-
- /**
- * Construct an instance that wraps the supplied iterator.
- * @param startingNode
- * @param view
- * @param iter the iterator that provides the set of TreeNodes over which the iteration is to occur.
- */
- public TreeNodeIteratorWithStack(final TreeNode startingNode, final TreeView view, final Iterator iter) {
- this.iterator = iter;
- this.view = view;
- this.workingList = new LinkedList();
- this.stack = new LinkedList();
- this.startingNode = startingNode;
- }
-
- /* (non-Javadoc)
- * @see java.util.Iterator#hasNext()
- */
- public boolean hasNext() {
- return this.iterator.hasNext();
- }
-
- /* (non-Javadoc)
- * @see java.util.Iterator#remove()
- */
- public void remove() {
- this.iterator.remove();
- }
-
- /* (non-Javadoc)
- * @see java.util.Iterator#next()
- */
- public Object next() {
- final Object nextObj = this.iterator.next();
- process(nextObj);
- return nextObj;
- }
-
- protected void process( final Object object ) {
- synchronizeStack((TreeNode)object);
- }
-
- /**
- * @param entity
- */
- protected void synchronizeStack( final TreeNode obj ) {
- // populate the working list with the ancestor path ...
- this.workingList.clear();
- TreeNode node = obj;
- while ( node != null ) {
- this.workingList.add(0,node);
- if ( isStartingNode(node) ) {
- node = null;
- } else {
- node = view.getParent(node);
- }
- }
-
- // Go down from the stack until the paths diverge
- TreeNode objAncestor = null;
- final ListIterator workingIter = this.workingList.listIterator();
- final ListIterator stackIter = this.stack.listIterator();
- while (workingIter.hasNext() && stackIter.hasNext() ) {
- objAncestor = (TreeNode)workingIter.next();
- final StackEntry entry = (StackEntry) stackIter.next();
- if ( entry.getTreeNode() != objAncestor ) {
- // Clear the rest of the stack ...
- while ( this.stack.removeLast() != entry ) {
- }
- // back up the workingIter since we didn't do anything with objAncestor yet
- workingIter.previous();
- break;
- }
- }
-
- // Add whatever is left in the workingIter
- while ( workingIter.hasNext() ) {
- objAncestor = (TreeNode)workingIter.next();
- final Object payload = createPayload(objAncestor);
- final StackEntry entry = new StackEntry(objAncestor, payload);
- this.stack.add(entry);
- }
- }
-
- /**
- * @param node
- * @return
- */
- protected boolean isStartingNode(TreeNode node) {
- if ( this.startingNode != null ) {
- return this.startingNode == node;
- }
- if ( this.iterator instanceof TreeNodeIterator ) {
- return ((TreeNodeIterator)this.iterator).isStartingNode(node);
- }
- return false;
- }
-
- protected Object createPayload( final TreeNode node ) {
- return null;
- }
-
- /**
- * Return the list of {@link TreeNodeIteratorWithStack.StackEntry StackEntry} objects that each have
- * a target and a payload.
- * @return
- */
- public LinkedList getStack() {
- return this.stack;
- }
-
- /**
- * @return
- */
- public TreeView getTreeView() {
- return view;
- }
-
- public String toString() {
- final StringBuffer sb = new StringBuffer();
- int counter = 0;
- final Iterator iter = getStack().iterator();
- while (iter.hasNext()) {
- final StackEntry entry = (StackEntry)iter.next();
- sb.append(" "); //$NON-NLS-1$
- sb.append(++counter);
- sb.append(". "); //$NON-NLS-1$
- sb.append(entry.getTreeNode().getName());
- final Object payload = entry.getPayload();
- if ( payload != null ) {
- sb.append( toStringPayload(payload) );
- }
- sb.append("\n"); //$NON-NLS-1$
- }
- return sb.toString();
- }
-
- protected String toStringPayload( final Object obj ) {
- return ""; //$NON-NLS-1$
- }
-
- public static class StackEntry {
- private final TreeNode target;
- private final Object payload;
- protected StackEntry( final TreeNode target, final Object payload ) {
- this.target = target;
- this.payload = payload;
- }
- /**
- * Return the tree node.
- * @return the node; never null
- */
- public TreeNode getTreeNode() {
- return this.target;
- }
- /**
- * Return the payload for the node in the stack.
- * @return the payload; may be null
- */
- public Object getPayload() {
- return payload;
- }
- public String toString() {
- return this.target.toString();
- }
-
- }
-
-}
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/tree/basic/BasicTreeNodeEditor.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/basic/BasicTreeNodeEditor.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/basic/BasicTreeNodeEditor.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -33,9 +33,6 @@
import com.metamatrix.common.object.PropertiedObject;
import com.metamatrix.common.object.PropertyAccessPolicy;
import com.metamatrix.common.object.PropertyDefinition;
-import com.metamatrix.common.transaction.UserTransaction;
-import com.metamatrix.common.transaction.UserTransactionFactory;
-import com.metamatrix.common.transaction.manager.SimpleUserTransactionFactory;
import com.metamatrix.common.tree.TreeNode;
import com.metamatrix.common.tree.TreeNodeEditor;
import com.metamatrix.common.tree.directory.DirectoryEntry;
@@ -48,32 +45,21 @@
private ObjectIDFactory idFactory;
private PropertyAccessPolicy policy;
- private UserTransactionFactory txnFactory;
- public BasicTreeNodeEditor( ObjectIDFactory idFactory, PropertyAccessPolicy policy, UserTransactionFactory txnFactory ) {
+ public BasicTreeNodeEditor( ObjectIDFactory idFactory, PropertyAccessPolicy policy ) {
Assertion.isNotNull(idFactory,"The ObjectIDFactory reference may not be null"); //$NON-NLS-1$
Assertion.isNotNull(policy,"The PropertyAccessPolicy reference may not be null"); //$NON-NLS-1$
- Assertion.isNotNull(txnFactory,"The UserTransactionFactory reference may not be null"); //$NON-NLS-1$
this.idFactory = idFactory;
this.policy = policy;
- this.txnFactory = txnFactory;
}
/**
* Create an empty property definition object with all defaults.
*/
public BasicTreeNodeEditor( ObjectIDFactory idFactory ) {
- this(idFactory, new DefaultPropertyAccessPolicy(), new SimpleUserTransactionFactory() );
+ this(idFactory, new DefaultPropertyAccessPolicy() );
}
- public BasicTreeNodeEditor( ObjectIDFactory idFactory, PropertyAccessPolicy policy ) {
- this(idFactory, policy, new SimpleUserTransactionFactory() );
- }
-
- public BasicTreeNodeEditor( ObjectIDFactory idFactory, UserTransactionFactory txnFactory ) {
- this(idFactory, new DefaultPropertyAccessPolicy(), txnFactory );
- }
-
protected BasicTreeNode assertBasicTreeNode( PropertiedObject obj ) {
Assertion.isNotNull(obj,"The PropertiedObject reference may not be null"); //$NON-NLS-1$
Assertion.assertTrue(obj instanceof BasicTreeNode,"The referenced object must be an instance of BasicTreeNode"); //$NON-NLS-1$
@@ -243,40 +229,6 @@
this.policy.reset(obj);
}
- // ########################## UserTransactionFactory Methods ###################################
-
- /**
- * Create a new instance of a UserTransaction that may be used to
- * read information. Read transactions do not have a source object
- * associated with them (since they never directly modify data).
- * @return the new transaction object
- */
- public UserTransaction createReadTransaction() {
- return this.txnFactory.createReadTransaction();
- }
-
- /**
- * Create a new instance of a UserTransaction that may be used to
- * write and/or update information. The transaction will <i>not</i> have a source object
- * associated with it.
- * @return the new transaction object
- */
- public UserTransaction createWriteTransaction() {
- return this.txnFactory.createWriteTransaction();
- }
-
- /**
- * Create a new instance of a UserTransaction that may be used to
- * write and/or update information. The source object will be used for all events that are
- * fired as a result of or as a product of this transaction.
- * @param source the object that is considered to be the source of the transaction;
- * may be null
- * @return the new transaction object
- */
- public UserTransaction createWriteTransaction(Object source) {
- return this.txnFactory.createWriteTransaction(source);
- }
-
// ########################## TreeEditor Methods ###################################
/**
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/tree/basic/BasicTreeNodeSource.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/basic/BasicTreeNodeSource.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/basic/BasicTreeNodeSource.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -24,40 +24,30 @@
import java.util.List;
-import com.metamatrix.core.id.ObjectIDFactory;
import com.metamatrix.common.object.DefaultPropertyAccessPolicy;
import com.metamatrix.common.object.PropertyAccessPolicy;
-import com.metamatrix.common.transaction.UserTransactionFactory;
-import com.metamatrix.common.transaction.manager.SimpleUserTransactionFactory;
import com.metamatrix.common.tree.TreeNode;
import com.metamatrix.common.tree.TreeNodeEditor;
import com.metamatrix.common.tree.TreeNodeSource;
+import com.metamatrix.core.id.ObjectIDFactory;
import com.metamatrix.core.util.Assertion;
/**
* This interface defines an interface to a source of TreeNode information.
*/
public class BasicTreeNodeSource implements TreeNodeSource {
- private static UserTransactionFactory DEFAULT_TXN_FACTORY = new SimpleUserTransactionFactory();
private ObjectIDFactory idFactory;
private PropertyAccessPolicy policy;
- private UserTransactionFactory txnFactory;
public BasicTreeNodeSource(ObjectIDFactory idFactory) {
- this(idFactory, new DefaultPropertyAccessPolicy(), DEFAULT_TXN_FACTORY);
+ this(idFactory, new DefaultPropertyAccessPolicy());
}
- public BasicTreeNodeSource(ObjectIDFactory idFactory, UserTransactionFactory txnFactory) {
- this(idFactory, new DefaultPropertyAccessPolicy(), txnFactory);
- }
-
- public BasicTreeNodeSource(ObjectIDFactory idFactory, PropertyAccessPolicy policy, UserTransactionFactory txnFactory) {
+ public BasicTreeNodeSource(ObjectIDFactory idFactory, PropertyAccessPolicy policy) {
Assertion.isNotNull(idFactory,"The ObjectIDFactory reference may not be null"); //$NON-NLS-1$
Assertion.isNotNull(policy,"The PropertyAccessPolicy reference may not be null"); //$NON-NLS-1$
- Assertion.isNotNull(txnFactory,"The UserTransactionFactory reference may not be null"); //$NON-NLS-1$
this.idFactory = idFactory;
this.policy = policy;
- this.txnFactory = txnFactory;
}
protected BasicTreeNode assertBasicTreeNode( TreeNode node ) {
@@ -100,7 +90,7 @@
* @return the new editor instance; never null
*/
public TreeNodeEditor createTreeNodeEditor() {
- return new BasicTreeNodeEditor(this.idFactory, this.policy, this.txnFactory);
+ return new BasicTreeNodeEditor(this.idFactory, this.policy);
}
/**
@@ -177,13 +167,6 @@
return this.policy;
}
- /**
- * Return the UserTransactionFactory instance for this TreeNodeSource
- */
- public UserTransactionFactory getUserTransactionFactory() {
- return this.txnFactory;
- }
-
}
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/tree/basic/BasicTreeView.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/basic/BasicTreeView.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/basic/BasicTreeView.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -34,7 +34,6 @@
import com.metamatrix.common.CommonPlugin;
import com.metamatrix.common.object.PropertiedObjectEditor;
-import com.metamatrix.common.transaction.UserTransaction;
import com.metamatrix.common.tree.PassThroughTreeNodeFilter;
import com.metamatrix.common.tree.TreeNode;
import com.metamatrix.common.tree.TreeNodeEditor;
@@ -371,40 +370,6 @@
return editor;
}
- // ########################## UserTransactionFactory Methods ###################################
-
- /**
- * Create a new instance of a UserTransaction that may be used to
- * read information. Read transactions do not have a source object
- * associated with them (since they never directly modify data).
- * @return the new transaction object
- */
- public UserTransaction createReadTransaction() {
- return this.getTreeNodeEditor().createReadTransaction();
- }
-
- /**
- * Create a new instance of a UserTransaction that may be used to
- * write and/or update information. The transaction will <i>not</i> have a source object
- * associated with it.
- * @return the new transaction object
- */
- public UserTransaction createWriteTransaction() {
- return this.getTreeNodeEditor().createWriteTransaction();
- }
-
- /**
- * Create a new instance of a UserTransaction that may be used to
- * write and/or update information. The source object will be used for all events that are
- * fired as a result of or as a product of this transaction.
- * @param source the object that is considered to be the source of the transaction;
- * may be null
- * @return the new transaction object
- */
- public UserTransaction createWriteTransaction(Object source) {
- return this.getTreeNodeEditor().createWriteTransaction(source);
- }
-
// ########################## Implementation Methods ###################################
/**
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/FileSystemEntryEditor.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/FileSystemEntryEditor.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/FileSystemEntryEditor.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -32,9 +32,6 @@
import com.metamatrix.common.object.PropertiedObject;
import com.metamatrix.common.object.PropertyAccessPolicy;
import com.metamatrix.common.object.PropertyDefinition;
-import com.metamatrix.common.transaction.TransactionException;
-import com.metamatrix.common.transaction.TransactionStatus;
-import com.metamatrix.common.transaction.UserTransaction;
import com.metamatrix.common.tree.TreeNode;
import com.metamatrix.common.tree.TreeNodeException;
import com.metamatrix.common.util.ErrorMessageKeys;
@@ -582,38 +579,6 @@
throw new RuntimeException(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0052));
}
- /**
- * Create a new instance of a UserTransaction that may be used to
- * read information. Read transactions do not have a source object
- * associated with them (since they never directly modify data).
- * @return the new transaction object
- */
- public UserTransaction createReadTransaction() {
- return new EmptyUserTransaction(null);
- }
-
- /**
- * Create a new instance of a UserTransaction that may be used to
- * write and/or update information. The transaction will <i>not</i> have a source object
- * associated with it.
- * @return the new transaction object
- */
- public UserTransaction createWriteTransaction() {
- return new EmptyUserTransaction(null);
- }
-
- /**
- * Create a new instance of a UserTransaction that may be used to
- * write and/or update information. The source object will be used for all events that are
- * fired as a result of or as a product of this transaction.
- * @param source the object that is considered to be the source of the transaction;
- * may be null
- * @return the new transaction object
- */
- public UserTransaction createWriteTransaction(Object source) {
- return new EmptyUserTransaction(source);
- }
-
// ########################## Implementation Methods ###################################
protected FileSystemEntry assertFileSystemEntry( TreeNode obj ) {
@@ -671,31 +636,3 @@
throw new RuntimeException(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0052));
}
}
-
-
-class EmptyUserTransaction implements UserTransaction {
-
- private int status;
- private Object source;
- EmptyUserTransaction(Object source) {
- this.source = source;
- this.status = TransactionStatus.STATUS_UNKNOWN;
- }
- public int getStatus() throws TransactionException {
- return this.status;
- }
- public void begin() throws TransactionException {
- }
- public void setTransactionTimeout(int seconds) throws TransactionException {
- }
- public void setRollbackOnly() throws TransactionException {
- }
- public void commit() throws TransactionException {
- }
- public void rollback() throws TransactionException {
- }
- public Object getSource() throws TransactionException {
- return this.source;
- }
-
-}
Modified: trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/FileSystemView.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/FileSystemView.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/FileSystemView.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -36,8 +36,6 @@
import com.metamatrix.common.object.ObjectDefinition;
import com.metamatrix.common.object.PropertiedObjectEditor;
-import com.metamatrix.common.transaction.UserTransaction;
-import com.metamatrix.common.transaction.manager.SimpleUserTransaction;
import com.metamatrix.common.tree.PassThroughTreeNodeFilter;
import com.metamatrix.common.tree.TreeNode;
import com.metamatrix.common.tree.TreeNodeEditor;
@@ -620,38 +618,6 @@
}
/**
- * Create a new instance of a UserTransaction that may be used to
- * read information. Read transactions do not have a source object
- * associated with them (since they never directly modify data).
- * @return the new transaction object
- */
- public UserTransaction createReadTransaction() {
- return new SimpleUserTransaction();
- }
-
- /**
- * Create a new instance of a UserTransaction that may be used to
- * write and/or update information. The transaction will <i>not</i> have a source object
- * associated with it.
- * @return the new transaction object
- */
- public UserTransaction createWriteTransaction() {
- return new SimpleUserTransaction();
- }
-
- /**
- * Create a new instance of a UserTransaction that may be used to
- * write and/or update information. The source object will be used for all events that are
- * fired as a result of or as a product of this transaction.
- * @param source the object that is considered to be the source of the transaction;
- * may be null
- * @return the new transaction object
- */
- public UserTransaction createWriteTransaction(Object source) {
- return new SimpleUserTransaction(source);
- }
-
- /**
* Lookup the node referenced by the relative path in this view.
* Depending upon the implementation, this method may return a null
* reference if a node with the specified path is not found.
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/FolderOnlyFilter.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/FolderOnlyFilter.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/FolderOnlyFilter.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -1,79 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.tree.directory;
-
-import com.metamatrix.common.tree.TreeNode;
-
-/**
- * A simple filter that accepts only folders (i.e., those entries that have a type other than FileDefinition).
- */
-
-public class FolderOnlyFilter implements DirectoryEntryFilter {
-
- private String description;
-
- public FolderOnlyFilter() {
- this.description = ""; //$NON-NLS-1$
- }
-
- public FolderOnlyFilter(String description) {
- this.description = (description!=null?description:""); //$NON-NLS-1$
- }
-
- /**
- * Set the description for this filter.
- * @param description the description string
- */
- public void setDescription(String description){
- this.description = (description!=null?description:""); //$NON-NLS-1$
- }
-
- /**
- * Obtain a description for this filter.
- * @return the readable description. For example: "JPG and GIF Images"
- */
- public String getDescription(){
- return description;
- }
-
- /**
- * Determine whether the given TreeNode is accepted by this filter.
- * @return true if accepted, or false otherwise.
- */
- public boolean accept(TreeNode entry){
- if ( entry != null && !(entry.getType() instanceof FileDefinition) ) {
- return true;
- }
- return false;
- }
-
- public String getExtension(int index) {
- return ""; //$NON-NLS-1$
- }
-
- public int getExtensionCount() {
- return 0;
- }
-
-}
-
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/PlatformAwareFilePermission.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/PlatformAwareFilePermission.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/PlatformAwareFilePermission.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -1,335 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.tree.directory;
-
-import java.io.File;
-import java.io.PrintStream;
-import java.util.Properties;
-
-import com.metamatrix.common.CommonPlugin;
-import com.metamatrix.common.util.ErrorMessageKeys;
-import com.metamatrix.common.util.OSPlatformUtil;
-import com.metamatrix.core.util.Assertion;
-
-/**
- * PlatformAwareFileSystemView
- */
-public class PlatformAwareFilePermission {
- private static String SEPARATOR = File.separator;
-
-
- /** The operating system on which MetaMatrix runs*/
- private static int operatingSystem = OSPlatformUtil.getOperatingSystem();
-
- /** Get the operating system on which the IDE is running.
- * @return one of the <code>OS_*</code> constants (such as {@link #OS_WINNT})
- */
- public static final int getOperatingSystem () {
- return operatingSystem;
- }
-
- /** Test whether the IDE is running on some variant of Windows.
- * @return <code>true</code> if Windows, <code>false</code> if some other manner of operating system
- */
- public static final boolean isWindows () {
- return OSPlatformUtil.isWindows();
- }
-
- /** Test whether the IDE is running on some variant of Unix.
- * Linux is included as well as the commercial vendors.
- * @return <code>true</code> some sort of Unix, <code>false</code> if some other manner of operating system
- */
- public static final boolean isUnix () {
- return OSPlatformUtil.isUnix();
- }
-
- public static boolean changeReadOnly( File dir, String filespec, boolean makeRO ) {
-
-// System.out.println("Operating system is "+System.getProperty(OS_PROPERTY_NAME));
- if (isWindows()) {
- if (operatingSystem == OSPlatformUtil.OS_WIN95 || operatingSystem == OSPlatformUtil.OS_WIN98) {
- boolean success = changeReadOnlyWin95(dir,filespec,makeRO);
- if (!success) {
- success = changeReadOnlyWin95_V2(dir,filespec,makeRO);
- }
- return success;
- } else if (operatingSystem == OSPlatformUtil.OS_WIN2000) {
- return changeReadOnlyWin2000(dir,filespec,makeRO);
- } else if (operatingSystem == OSPlatformUtil.OS_WINXP) {
- return changeReadOnlyWin2000(dir,filespec,makeRO);
- } else {
- boolean success = changeReadOnlyWinNT(dir,filespec,makeRO);
- if (!success) {
- success = changeReadOnlyWinNT_V2(dir,filespec,makeRO);
- }
- return success;
- }
- } if (isUnix()) {
- return changeReadOnlyUnix(dir,filespec,makeRO);
- }
- throw new AssertionError(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0056, System.getProperty(OSPlatformUtil.OS_PROPERTY_NAME)));
-// if (osName.equalsIgnoreCase( "Windows NT")) {
-// return changeReadOnlyWinNT(dir,filespec,makeRO);
-// } else if (osName.equalsIgnoreCase("Windows 95")) {
-// return changeReadOnlyWin95(dir,filespec,makeRO);
-// } else if (osName.equalsIgnoreCase("Solaris")) {
-// return changeReadOnlySolaris(dir,filespec,makeRO);
-// } else {
-// throw new AssertionException("A native implementation of this method is not available for the \"" + osName + "\" operating system");
-// }
- }
-
- private static boolean changeReadOnlyUnix( File dir, String filespec, boolean makeRO ) {
- Runtime rt;
- Process proc;
- int exitcode;
- String dirpath;
- String[] attrib = new String[2];
-
- attrib[0] = "chmod"; //$NON-NLS-1$
-
- if ( makeRO ) {
- attrib[1] = "u-w"; //$NON-NLS-1$
- } else {
- attrib[1] = "u+wr,g+wr"; //$NON-NLS-1$
- }
- try {
- dirpath = dir.getCanonicalPath();
- attrib[1] = attrib[1] + " " + dirpath + SEPARATOR + filespec + ""; //$NON-NLS-1$ //$NON-NLS-2$
- rt = Runtime.getRuntime();
-
- String cmd = attrib[0] + " " + attrib[1]; //$NON-NLS-1$
- //printRuntimeCmd("changeReadOnlySolaris",cmd);
- //proc = rt.exec( attrib );
- proc = rt.exec( cmd );
-
- proc.waitFor();
- exitcode = proc.exitValue();
- } catch( Exception e ) {
- return( false );
- }
- return( exitcode == 0 );
- }
-
- private static boolean changeReadOnlyWin95( File dir, String filespec, boolean makeRO ) {
- Runtime rt;
- Process proc;
- int exitcode;
- String dirpath;
- String[] attrib = new String[2];
-
- attrib[0] = "c:\\windows\\command\\attrib.exe"; //$NON-NLS-1$
- //attrib[0] = "attrib -h -s";
-
- if ( makeRO ) {
- attrib[1] = "+R"; //$NON-NLS-1$
- } else {
- attrib[1] = "-R"; //$NON-NLS-1$
- }
- try {
- dirpath = dir.getCanonicalPath();
- attrib[1] = attrib[1] + " \"" + dirpath + SEPARATOR + filespec + "\""; //$NON-NLS-1$ //$NON-NLS-2$
- rt = Runtime.getRuntime();
- String cmd = attrib[0] + " " + attrib[1]; //$NON-NLS-1$
- //printRuntimeCmd("changeReadOnlyWin95",cmd);
- //proc = rt.exec( attrib );
- proc = rt.exec( cmd );
-
- proc.waitFor();
- exitcode = proc.exitValue();
- } catch( Exception e ) {
- return( false );
- }
- return( exitcode == 0 );
- }
-
- private static boolean changeReadOnlyWin95_V2( File dir, String filespec, boolean makeRO ) {
- Runtime rt;
- Process proc;
- int exitcode;
- String dirpath;
- String[] attrib = new String[2];
-
- attrib[0] = "attrib.exe"; //$NON-NLS-1$
-
- if ( makeRO ) {
- attrib[1] = "+R"; //$NON-NLS-1$
- } else {
- attrib[1] = "-R"; //$NON-NLS-1$
- }
- try {
- dirpath = dir.getCanonicalPath();
- attrib[1] = attrib[1] + " \"" + dirpath + SEPARATOR + filespec + "\""; //$NON-NLS-1$ //$NON-NLS-2$
- rt = Runtime.getRuntime();
- String cmd = attrib[0] + " " + attrib[1]; //$NON-NLS-1$
- proc = rt.exec( cmd );
-
- proc.waitFor();
- exitcode = proc.exitValue();
- } catch( Exception e ) {
- return( false );
- }
- return( exitcode == 0 );
- }
-
- private static boolean changeReadOnlyWin2000( File dir, String filespec, boolean makeRO ) {
- Runtime rt;
- Process proc;
- int exitcode;
- String dirpath;
- String[] attrib = new String[2];
-
- attrib[0] = "cmd.exe /c attrib"; //$NON-NLS-1$
-
- if ( makeRO ) {
- attrib[1] = "+R"; //$NON-NLS-1$
- } else {
- attrib[1] = "-R"; //$NON-NLS-1$
- }
- try {
- dirpath = dir.getCanonicalPath();
- attrib[1] = attrib[1] + " \"" + dirpath + SEPARATOR + filespec + "\""; //$NON-NLS-1$ //$NON-NLS-2$
- rt = Runtime.getRuntime();
- String cmd = attrib[0] + " " + attrib[1]; //$NON-NLS-1$
- //printRuntimeCmd("changeReadOnlyWin2000",cmd);
- //proc = rt.exec( attrib );
- proc = rt.exec( cmd );
-
- proc.waitFor();
- exitcode = proc.exitValue();
- } catch( Exception e ) {
- return( false );
- }
- return( exitcode == 0 );
- }
-
- private static boolean changeReadOnlyWinNT( File dir, String filespec, boolean makeRO ) {
- Runtime rt;
- Process proc;
- int exitcode;
- String dirpath;
- String[] attrib = new String[2];
- attrib[0] = "c:\\WINNT\\system32\\attrib.exe"; //$NON-NLS-1$
- //attrib[0] = "%SystemRoot%\\system32\\cmd.exe /c attrib";
-
- if ( makeRO ) {
- attrib[1] = "+R"; //$NON-NLS-1$
- } else {
- attrib[1] = "-R"; //$NON-NLS-1$
- }
- try {
- dirpath = dir.getCanonicalPath();
- attrib[1] = attrib[1] + " \"" + dirpath + SEPARATOR + filespec + "\""; //$NON-NLS-1$ //$NON-NLS-2$
- rt = Runtime.getRuntime();
-
- String cmd = attrib[0] + " " + attrib[1]; //$NON-NLS-1$
- //printRuntimeCmd("changeReadOnlyWinNT",cmd);
- //proc = rt.exec( attrib );
- proc = rt.exec( cmd );
-
- proc.waitFor();
- exitcode = proc.exitValue();
- } catch( Exception e ) {
- return( false );
- }
- return( exitcode == 0 );
- }
-
- private static boolean changeReadOnlyWinNT_V2( File dir, String filespec, boolean makeRO ) {
- Runtime rt;
- Process proc;
- int exitcode;
- String dirpath;
- String[] attrib = new String[2];
- attrib[0] = "attrib.exe"; //$NON-NLS-1$
- //attrib[0] = "%SystemRoot%\\system32\\cmd.exe /c attrib";
-
- if ( makeRO ) {
- attrib[1] = "+R"; //$NON-NLS-1$
- } else {
- attrib[1] = "-R"; //$NON-NLS-1$
- }
- try {
- dirpath = dir.getCanonicalPath();
- attrib[1] = attrib[1] + " \"" + dirpath + SEPARATOR + filespec + "\""; //$NON-NLS-1$ //$NON-NLS-2$
- rt = Runtime.getRuntime();
-
- String cmd = attrib[0] + " " + attrib[1]; //$NON-NLS-1$
- proc = rt.exec( cmd );
-
- proc.waitFor();
- exitcode = proc.exitValue();
- } catch( Exception e ) {
- return( false );
- }
- return( exitcode == 0 );
- }
- //*
- public static void main(String[] args) {
- if (args.length < 3) {
- System.out.println("Usage: PlatformAwareFilePermission dirPath fileName +r|-r"); //$NON-NLS-1$
- return;
- }
- try {
- // print system properties
- printSystemProperties(System.out);
- String dirPath = args[0];
- String filename = args[1];
- String permission = args[2];
- testChangePermission(dirPath, filename, permission);
-
-// String dirPath = "E:/Products/current/projects/metadata/testdata";
-// String filename = "ValidationTestModel4.xml";
-// testChangePermission(dirPath, filename, "-r");
-// testChangePermission(dirPath, filename, "+r");
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- static void printSystemProperties( PrintStream stream ) {
- Assertion.isNotNull(stream,"The PrintStream reference may not be null"); //$NON-NLS-1$
- Properties p = System.getProperties();
- p.list(stream);
- }
- static void printPermissions(File f, String action) {
- System.out.println("\nFile \"" + f + "\" action = " + action); //$NON-NLS-1$ //$NON-NLS-2$
- System.out.println("exists = "+f.exists()+" canRead = "+f.canRead()+" canWrite = "+f.canWrite()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- static void printRuntimeCmd(String methodName, String cmd) {
- System.out.println("\n[" + methodName + "] Runtime.exec( " + cmd + " )"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- static void testChangePermission(String dirPath, String filename, String permission) {
- boolean makeRO = true;
- if (permission.equalsIgnoreCase("-r")) { //$NON-NLS-1$
- makeRO = false;
- }
- File dir = new File(dirPath);
- File f = new File(dir,filename);
- //PlatformAwareFilePermission.printPermissions(f,"before changing permission to "+permission);
- PlatformAwareFilePermission.changeReadOnly(dir,filename,makeRO);
- PlatformAwareFilePermission.printPermissions(f,"after changing permission to "+permission); //$NON-NLS-1$
- }
- //*/
-}
-
-
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/PreviewableDirectoryEntry.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/PreviewableDirectoryEntry.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/PreviewableDirectoryEntry.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -1,266 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.tree.directory;
-
-import java.io.*;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import com.metamatrix.common.CommonPlugin;
-import com.metamatrix.common.object.ObjectDefinition;
-import com.metamatrix.common.util.ErrorMessageKeys;
-import com.metamatrix.core.util.Assertion;
-
-/**
- * This class represents a wrapper for a DirectoryEntry that
- * holds off on actually writing to the DirectoryEntry so
- * that a preview of the result can be obtained prior to writing.
- * Once the preview is determined to be acceptable, the
- * {@link #getPreviewStream() getPreviewStream()}
- * method can be used to actually write the previewable contents
- * to the DirectoryEntry.
- * <p>An instance of this class can only be used to wrap a
- * DirectoryEntry that can write (i.e.,
- * {@link DirectoryEntry#canWrite() DirectoryEntry.canWrite()}
- * returns true).</p>
- * @version 1.0
- * @author
- */
-public class PreviewableDirectoryEntry implements DirectoryEntry {
-
- protected static final int BUFFER_SIZE = 1024;
- private static final String TEMP_FILE_PREFIX = "prevDirEntTemp"; //$NON-NLS-1$
- private static final String TEMP_FILE_SUFFIX = "tmp"; //$NON-NLS-1$
-
- private DirectoryEntry entry;
- private File tempFile;
-
- /**
- * Construct a new instance that wraps another DirectoryEntry
- * @param actualEntry the DirectoryEntry that this instance is a preview for;
- * may not be null
- */
- public PreviewableDirectoryEntry( DirectoryEntry actualEntry ) {
- Assertion.isNotNull(actualEntry, "The DirectoryEntry reference may not be null."); //$NON-NLS-1$
- this.entry = actualEntry;
- }
-
- /*
- * @see DirectoryEntry#getOutputStream()
- */
- public OutputStream getOutputStream() throws IOException {
- if ( !this.canWrite() ) {
- throw new IOException(CommonPlugin.Util.getString(ErrorMessageKeys.TREE_ERR_0057));
- }
- // Create an output stream that write to the buffer
- this.tempFile = File.createTempFile(TEMP_FILE_PREFIX, TEMP_FILE_SUFFIX);
- return new FileOutputStream(this.tempFile);
- }
-
- /**
- * Writes the preview to the entry.
- * @return true if the preview was saved, or false if there was no preview to save
- * @throws IOException if there is an error writing
- * the contents to the DirectoryEntry
- */
- public boolean savePreview() throws IOException {
- boolean success = false;
- if ( this.tempFile != null ) {
- OutputStream fileOstream = this.entry.getOutputStream(); // may throw exception ...
- Writer entryWriter = new OutputStreamWriter(fileOstream);
- success = writePreview(entryWriter,true);
- }
- return success;
- }
-
- /**
- * Writes the preview to the specified writer.
- * @param writer the Writer to which the preview contents should be written
- * @param closeWriterUponCompletion true if this method should attempt to
- * close <code>writer</code> when this method completes writing the contents
- * @return true if the preview was written, or false if there was no preview to write
- * @throws IOException if there is an error reading the contents or writing
- * the contents to <code>writer</code>
- */
- public boolean writePreview( Writer writer, boolean closeWriterUponCompletion ) throws IOException {
- boolean success = false;
- if ( this.tempFile != null ) {
-
- // Create a reader to the temp file ...
- FileReader contentsReader = new FileReader(this.tempFile);
- char[] buffer = new char[BUFFER_SIZE]; // File reader uses 'char[]' not 'byte[]'
- int n=0;
-
- // Write the contents of the temp file to the writer ...
- while ((n = contentsReader.read(buffer)) > -1) {
- writer.write(buffer, 0, n);
- }
-
- // Close the reader and writer ...
- contentsReader.close();
- if ( closeWriterUponCompletion ) {
- writer.close();
- }
- success = true;
- }
- return success;
- }
-
- public void clearPreview() throws IOException {
- if( this.tempFile != null ) {
- try {
- this.tempFile.delete();
- } finally {
- this.tempFile = null;
- }
- }
- }
-
- public boolean hasPreview() {
- return this.tempFile != null;
- }
-
- public DirectoryEntry getTargetDirectoryEntry() {
- return this.entry;
- }
-
-
- /**
- * Returns true if there was anything written to the buffer.
- * @see DirectoryEntry#canRead()
- */
- public boolean canRead() {
- return ( this.tempFile != null );
- }
-
- /*
- * @see DirectoryEntry#getInputStream()
- */
- public InputStream getInputStream() throws IOException {
- if ( this.tempFile != null ) {
- return new FileInputStream(this.tempFile);
- }
- return this.entry.getInputStream();
- }
-
- // #################### DELEGATE BACK TO entry #########################
- //
- /*
- * @see DirectoryEntry#canWrite()
- */
- public boolean canWrite() {
- return this.entry.canWrite();
- }
-
- /*
- * @see DirectoryEntry#loadPreview()
- */
- public boolean loadPreview() {
- return this.entry.loadPreview();
- }
-
- /*
- * @see DirectoryEntry#toURL()
- */
- public URL toURL() throws MalformedURLException {
- return this.entry.toURL();
- }
-
- /*
- * @see TreeNode#exists()
- */
- public boolean exists() {
- return this.entry.exists();
- }
-
- /*
- * @see TreeNode#getName()
- */
- public String getName() {
- return this.entry.getName();
- }
-
- /*
- * @see TreeNode#getFullName()
- */
- public String getFullName() {
- return this.entry.getFullName();
- }
-
- /*
- * @see TreeNode#getNamespace()
- */
- public String getNamespace() {
- return this.entry.getNamespace();
- }
-
- /*
- * @see TreeNode#getType()
- */
- public ObjectDefinition getType() {
- return this.entry.getType();
- }
-
- /*
- * @see TreeNode#getSeparatorChar()
- */
- public char getSeparatorChar() {
- return this.entry.getSeparatorChar();
- }
-
- /*
- * @see TreeNode#getSeparator()
- */
- public String getSeparator() {
- return this.entry.getSeparator();
- }
-
- /*
- * @see TreeNode#isModified()
- */
- public boolean isModified() {
- return this.entry.isModified();
- }
-
- /*
- * @see Comparable#compareTo(Object)
- */
- public int compareTo(Object o) {
- if ( o == null ) {
- return 1; // this is greater than null
- }
- PreviewableDirectoryEntry that = (PreviewableDirectoryEntry) o; // will throw class cast exception
- if ( that == this ) {
- return 0;
- }
- return this.hashCode() - that.hashCode();
- }
-
- public boolean equals( Object o ) {
- if ( o instanceof PreviewableDirectoryEntry ) {
- return ( o == this || o.hashCode() == this.hashCode() );
- }
- return false;
- }
-
-}
Deleted: trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/RuledDirectoryEntryViewImpl.java
===================================================================
--- trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/RuledDirectoryEntryViewImpl.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/common-internal/src/main/java/com/metamatrix/common/tree/directory/RuledDirectoryEntryViewImpl.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -1,104 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * See the COPYRIGHT.txt file distributed with this work for information
- * regarding copyright ownership. Some portions may be licensed
- * to Red Hat, Inc. under one or more contributor license agreements.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA.
- */
-
-package com.metamatrix.common.tree.directory;
-
-import com.metamatrix.common.tree.ChildRules;
-import com.metamatrix.common.tree.RuledTreeViewImpl;
-import com.metamatrix.common.tree.TreeNode;
-import com.metamatrix.common.tree.TreeView;
-import com.metamatrix.core.util.Assertion;
-
-public class RuledDirectoryEntryViewImpl extends RuledTreeViewImpl implements DirectoryEntryView {
-
- public RuledDirectoryEntryViewImpl(TreeView treeView, ChildRules rules ) {
- super(treeView,rules);
- Assertion.assertTrue(treeView instanceof DirectoryEntryView,"The TreeView reference is expected to implement DirectoryEntryView"); //$NON-NLS-1$
- }
-
- public RuledDirectoryEntryViewImpl(TreeView treeView, TreeNode root, ChildRules rules ) {
- super(treeView,root,rules);
- Assertion.assertTrue(treeView instanceof DirectoryEntryView,"The TreeView reference is expected to implement DirectoryEntryView"); //$NON-NLS-1$
- Assertion.assertTrue(root instanceof DirectoryEntry,"The TreeNode reference is expected to implement DirectoryEntry"); //$NON-NLS-1$
- }
-
- protected DirectoryEntryView getDirectoryEntryView() {
- return (DirectoryEntryView)super.getTreeView();
- }
-
- // ########################## PropertiedObjectView Methods ###################################
-
- // ########################## TreeView Methods ###################################
-
- // ########################## DirectoryEntryView Methods ###################################
-
- /**
- * Return the directory entry editor for this view.
- * @return the DirectoryEntryEditor instance
- */
- public DirectoryEntryEditor getDirectoryEntryEditor() {
- return this.getDirectoryEntryView().getDirectoryEntryEditor();
- }
-
- /**
- * Lookup the node referenced by the relative path in this view.
- * Depending upon the implementation, this method may return a null
- * reference if a node with the specified path is not found.
- * @param path the path of the desired node specified in terms of this view
- * (i.e., the result of calling <code>getPath()</code> on this view with the
- * returned node as the parameter should result in the same value as <code>path</code>);
- * may not be null or zero-length
- * @return the node referenced by the specified path, or null if no such
- * node exists
- * @throws AssertionError if the path is null or zero-length
- */
- public DirectoryEntry lookup( String path ) {
- DirectoryEntry result = this.getDirectoryEntryView().lookup(path);
- if ( result != null && this.isHidden(result) ) {
- result = null;
- }
- return result;
- }
-
- /**
- * Lookup the node referenced by the relative path in this view, but
- * specify a separator. This method allows the lookup of a path
- * with a different separator than used by this view.
- * Depending upon the implementation, this method may return a null
- * reference if a node with the specified path is not found.
- * @param path the path of the desired node specified in terms of this view
- * (i.e., the result of calling <code>getPath()</code> on this view with the
- * returned node as the parameter should result in the same value as <code>path</code>);
- * may not be null or zero-length
- * @param separater the string used to separate the components of a name.
- * @return the node referenced by the specified path, or null if no such
- * node exists
- * @throws AssertionError if the path is null or zero-length
- */
- public DirectoryEntry lookup( String path, String separator ) {
- DirectoryEntry result = this.getDirectoryEntryView().lookup(path,separator);
- if ( result != null && this.isHidden(result) ) {
- result = null;
- }
- return result;
- }
-}
Modified: trunk/server/src/main/java/com/metamatrix/platform/config/util/CurrentConfigHelper.java
===================================================================
--- trunk/server/src/main/java/com/metamatrix/platform/config/util/CurrentConfigHelper.java 2009-06-18 14:21:50 UTC (rev 1064)
+++ trunk/server/src/main/java/com/metamatrix/platform/config/util/CurrentConfigHelper.java 2009-06-18 15:00:39 UTC (rev 1065)
@@ -47,7 +47,7 @@
public class CurrentConfigHelper {
public void loadMetaMatrixPropertiesIntoSystem() throws Exception {
- loadMetaMatrixPropertiesIntoSystem(CurrentConfiguration.BOOTSTRAP_FILE_NAME); //$NON-NLS-1$
+ loadMetaMatrixPropertiesIntoSystem(CurrentConfiguration.BOOTSTRAP_FILE_NAME);
}
public void loadMetaMatrixPropertiesIntoSystem(String filename) throws Exception {
@@ -132,6 +132,8 @@
protected static Properties createSystemProperties(String fileName, String path) {
Properties props = new Properties();
+ props.setProperty(CurrentConfiguration.CONFIGURATION_READER_CLASS_PROPERTY_NAME, XMLCurrentConfigurationReader.class.getName());
+
if (fileName != null) {
props.setProperty(FilePersistentConnection.CONFIG_NS_FILE_NAME_PROPERTY, fileName );
props.setProperty(PersistentConnectionFactory.PERSISTENT_FACTORY_NAME, PersistentConnectionFactory.FILE_FACTORY_NAME);
More information about the teiid-commits
mailing list