Fix the issue #131631 - Exception on binding nodes createdby 'Cast' to a function
authorsupernikita@netbeans.org
Mon, 07 Apr 2008 16:30:37 +0400
changeset 4162dd666b326a17
parent 4161 da35d108d69d
child 4163 9c7f9ba4b62b
Fix the issue #131631 - Exception on binding nodes createdby 'Cast' to a function
bpel.mapper/src/org/netbeans/modules/bpel/mapper/cast/CastManager.java
bpel.mapper/src/org/netbeans/modules/bpel/mapper/cast/TypeCast.java
bpel.model/src/META-INF/services/org.netbeans.modules.bpel.model.xam.spi.NotImportedModelRetriever
bpel.model/src/org/netbeans/modules/bpel/model/api/references/OutOfImportReference.java
bpel.model/src/org/netbeans/modules/bpel/model/api/references/SchemaReferenceBuilder.java
bpel.model/src/org/netbeans/modules/bpel/model/api/support/BpelExternalModelResolver.java
bpel.model/src/org/netbeans/modules/bpel/model/api/support/NotImportedModelRetrieverImpl.java
bpel.model/src/org/netbeans/modules/bpel/model/api/support/Utils.java
bpel.model/src/org/netbeans/modules/bpel/model/api/support/XPathCastImpl.java
bpel.model/src/org/netbeans/modules/bpel/model/api/support/XPathCastResolverImpl.java
bpel.model/src/org/netbeans/modules/bpel/model/ext/editor/api/Cast.java
bpel.model/src/org/netbeans/modules/bpel/model/impl/BpelEntityImpl.java
bpel.model/src/org/netbeans/modules/bpel/model/xam/spi/NotImportedModelRetriever.java
     1.1 --- a/bpel.mapper/src/org/netbeans/modules/bpel/mapper/cast/CastManager.java	Sat Apr 05 18:31:19 2008 -0700
     1.2 +++ b/bpel.mapper/src/org/netbeans/modules/bpel/mapper/cast/CastManager.java	Mon Apr 07 16:30:37 2008 +0400
     1.3 @@ -140,8 +140,11 @@
     1.4                      PathConverter.constructObjectLocationtList(
     1.5                      typeCast.getXPathExpression());
     1.6              //
     1.7 -            return addTypeCastImpl(castedCompPath, typeCast);
     1.8 +            if (castedCompPath != null) {
     1.9 +                return addTypeCastImpl(castedCompPath, typeCast);
    1.10 +            }
    1.11          }
    1.12 +        //
    1.13          return false;
    1.14      }
    1.15      
    1.16 @@ -399,7 +402,7 @@
    1.17              }
    1.18              //
    1.19              TypeCast tCast = TypeCast.convert(cast);
    1.20 -            if (castToUnreg.equals(tCast)) {
    1.21 +            if (tCast != null && castToUnreg.equals(tCast)) {
    1.22                  // The required cast found!
    1.23                  casts.removeCast(index);
    1.24              }
     2.1 --- a/bpel.mapper/src/org/netbeans/modules/bpel/mapper/cast/TypeCast.java	Sat Apr 05 18:31:19 2008 -0700
     2.2 +++ b/bpel.mapper/src/org/netbeans/modules/bpel/mapper/cast/TypeCast.java	Mon Apr 07 16:30:37 2008 +0400
     2.3 @@ -68,17 +68,19 @@
     2.4      public static TypeCast convert(Cast cast) {
     2.5          GlobalType castTo = null;
     2.6          //
     2.7 +        SchemaReference<GlobalType> gTypeRef = cast.getType();
     2.8          XPathExpression xPathExpr = getExpression(cast);
     2.9          //
    2.10 -        SchemaReference<GlobalType> gTypeRef = cast.getType();
    2.11          if (gTypeRef == null) {
    2.12              ErrorManager.getDefault().log(ErrorManager.WARNING, 
    2.13                      "Cast To has to be specified");
    2.14 +            return null;
    2.15          } else {
    2.16              castTo = gTypeRef.get();
    2.17              if (castTo == null) {
    2.18                  ErrorManager.getDefault().log(ErrorManager.WARNING, 
    2.19                          "Unresolved global type: " + gTypeRef.getQName());
    2.20 +                return null;
    2.21              }
    2.22          }
    2.23          //
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/bpel.model/src/META-INF/services/org.netbeans.modules.bpel.model.xam.spi.NotImportedModelRetriever	Mon Apr 07 16:30:37 2008 +0400
     3.3 @@ -0,0 +1,1 @@
     3.4 +org.netbeans.modules.bpel.model.api.support.NotImportedModelRetrieverImpl
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/bpel.model/src/org/netbeans/modules/bpel/model/api/references/OutOfImportReference.java	Mon Apr 07 16:30:37 2008 +0400
     4.3 @@ -0,0 +1,54 @@
     4.4 +/*
     4.5 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
     4.6 + * 
     4.7 + * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
     4.8 + * 
     4.9 + * The contents of this file are subject to the terms of either the GNU
    4.10 + * General Public License Version 2 only ("GPL") or the Common
    4.11 + * Development and Distribution License("CDDL") (collectively, the
    4.12 + * "License"). You may not use this file except in compliance with the
    4.13 + * License. You can obtain a copy of the License at
    4.14 + * http://www.netbeans.org/cddl-gplv2.html
    4.15 + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
    4.16 + * specific language governing permissions and limitations under the
    4.17 + * License.  When distributing the software, include this License Header
    4.18 + * Notice in each file and include the License file at
    4.19 + * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
    4.20 + * particular file as subject to the "Classpath" exception as provided
    4.21 + * by Sun in the GPL Version 2 section of the License file that
    4.22 + * accompanied this code. If applicable, add the following below the
    4.23 + * License Header, with the fields enclosed by brackets [] replaced by
    4.24 + * your own identifying information:
    4.25 + * "Portions Copyrighted [year] [name of copyright owner]"
    4.26 + * 
    4.27 + * If you wish your version of this file to be governed by only the CDDL
    4.28 + * or only the GPL Version 2, indicate your decision by adding
    4.29 + * "[Contributor] elects to include this software in this distribution
    4.30 + * under the [CDDL or GPL Version 2] license." If you do not indicate a
    4.31 + * single choice of license, a recipient has the option to distribute
    4.32 + * your version of this file under either the CDDL, the GPL Version 2 or
    4.33 + * to extend the choice of license to its licensees as provided above.
    4.34 + * However, if you add GPL Version 2 code and therefore, elected the GPL
    4.35 + * Version 2 license, then the option applies only if the new code is
    4.36 + * made subject to such option by the copyright holder.
    4.37 + * 
    4.38 + * Contributor(s):
    4.39 + * 
    4.40 + * Portions Copyrighted 2008 Sun Microsystems, Inc.
    4.41 + */
    4.42 +
    4.43 +package org.netbeans.modules.bpel.model.api.references;
    4.44 +
    4.45 +/**
    4.46 + * Marker interface. It indicates which rules should be used to 
    4.47 + * resolve external references. By the default behaviour, BPEL model does
    4.48 + * not allow refering to not imported external models. A BPEL entity, 
    4.49 + * which implements this interface, can refer to not imported models. 
    4.50 + * 
    4.51 + * See Cast extension.
    4.52 + * 
    4.53 + * @author nk160297
    4.54 + */
    4.55 +public interface OutOfImportReference {
    4.56 +
    4.57 +}
     5.1 --- a/bpel.model/src/org/netbeans/modules/bpel/model/api/references/SchemaReferenceBuilder.java	Sat Apr 05 18:31:19 2008 -0700
     5.2 +++ b/bpel.model/src/org/netbeans/modules/bpel/model/api/references/SchemaReferenceBuilder.java	Mon Apr 07 16:30:37 2008 +0400
     5.3 @@ -19,8 +19,10 @@
     5.4  package org.netbeans.modules.bpel.model.api.references;
     5.5  
     5.6  import java.util.Collection;
     5.7 +import java.util.HashSet;
     5.8  import java.util.LinkedList;
     5.9  
    5.10 +import java.util.Set;
    5.11  import org.netbeans.modules.bpel.model.api.BpelEntity;
    5.12  import org.netbeans.modules.bpel.model.api.BpelModel;
    5.13  import org.netbeans.modules.bpel.model.api.Import;
    5.14 @@ -37,6 +39,7 @@
    5.15  import org.netbeans.modules.bpel.model.impl.references.AbstractNamedComponentReference;
    5.16  import org.netbeans.modules.bpel.model.impl.references.BpelAttributesType;
    5.17  import org.netbeans.modules.bpel.model.impl.references.SchemaReferenceImpl;
    5.18 +import org.netbeans.modules.bpel.model.xam.spi.NotImportedModelRetriever;
    5.19  import org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent;
    5.20  import org.netbeans.modules.xml.xam.dom.Attribute;
    5.21  import org.openide.util.Lookup;
    5.22 @@ -48,9 +51,13 @@
    5.23  public final class SchemaReferenceBuilder {
    5.24  
    5.25      private SchemaReferenceBuilder() {
    5.26 -        Result result = Lookup.getDefault().lookup(
    5.27 +        Result<ExternalModelRetriever> result = Lookup.getDefault().lookup(
    5.28                  new Lookup.Template(ExternalModelRetriever.class));
    5.29 -        myRetrievers = result.allInstances();
    5.30 +        mModelRetrievers = result.allInstances();
    5.31 +        
    5.32 +        result = Lookup.getDefault().lookup(
    5.33 +                new Lookup.Template(NotImportedModelRetriever.class));
    5.34 +        mNotImportedModelsRetrievers = result.allInstances();
    5.35          
    5.36          myCollection = new LinkedList<SchemaReferenceFactory>();
    5.37          myCollection.add( new SchemaElementFactory() );
    5.38 @@ -63,9 +70,9 @@
    5.39      
    5.40      public <T extends ReferenceableSchemaComponent> SchemaReference<T> 
    5.41              build( Class<T> clazz ,AbstractDocumentComponent entity , 
    5.42 -                    Attribute attr )
    5.43 +            Attribute attr )
    5.44      {
    5.45 -        SchemaReference<T>  ref = build( clazz , entity , 
    5.46 +        SchemaReference<T>  ref = build( clazz, entity, 
    5.47                  entity.getAttribute( attr ) );
    5.48          if ( ref instanceof MappedReference ){
    5.49              ((MappedReference)ref).setAttribute( attr );
    5.50 @@ -89,7 +96,7 @@
    5.51      }
    5.52      
    5.53      public <T extends ReferenceableSchemaComponent> SchemaReference<T> build( 
    5.54 -            T target , Class<T> clazz , AbstractDocumentComponent entity  )
    5.55 +            T target , Class<T> clazz , AbstractDocumentComponent entity )
    5.56      {
    5.57          for (SchemaReferenceFactory resolver : myCollection) {
    5.58              if ( resolver.isApplicable( clazz )){
    5.59 @@ -138,8 +145,10 @@
    5.60              collection.add( SchemaModelFactory.getDefault().
    5.61                      getPrimitiveTypesModel() );
    5.62          }
    5.63 +        
    5.64 +        boolean lookNotImportedModels = entity instanceof OutOfImportReference;
    5.65          Collection<SchemaModel> moreModels = getSchemaModels( 
    5.66 -                ((BpelEntity)entity).getBpelModel() , nsUri );
    5.67 +                ((BpelEntity)entity).getBpelModel() , nsUri, lookNotImportedModels);
    5.68          if ( collection == null ) {
    5.69              collection = moreModels;
    5.70          }
    5.71 @@ -150,36 +159,49 @@
    5.72      }
    5.73      
    5.74      public static Collection<SchemaModel> getSchemaModels( BpelModel model , 
    5.75 -            String namespace )
    5.76 +            String namespace, boolean lookNotImportedModels )
    5.77      {
    5.78 -        return getInstance().getModels(model, namespace);
    5.79 +        return getInstance().getModels(model, namespace, lookNotImportedModels);
    5.80      }
    5.81  
    5.82 -    private Collection<SchemaModel> getModels( BpelModel model, String namespace )
    5.83 +    private Collection<SchemaModel> getModels( BpelModel model, String namespace, 
    5.84 +            boolean lookNotImportedModels )
    5.85      {
    5.86          Collection<SchemaModel> ret = new LinkedList<SchemaModel>();
    5.87 -        if ( myRetrievers.size() == 1) {
    5.88 -            return ((ExternalModelRetriever)myRetrievers.iterator().next()).
    5.89 +        if ( !lookNotImportedModels && mModelRetrievers.size() == 1) {
    5.90 +            return (mModelRetrievers.iterator().next()).
    5.91                  getSchemaModels(model, namespace);
    5.92          }
    5.93 -        for ( Object obj : myRetrievers ) {
    5.94 -            ExternalModelRetriever retriever = (ExternalModelRetriever)obj;
    5.95 +        for ( ExternalModelRetriever retriever : mModelRetrievers ) {
    5.96              Collection<SchemaModel> collection = 
    5.97                  retriever.getSchemaModels(model, namespace);
    5.98              ret.addAll( collection );
    5.99          }
   5.100 +        if (lookNotImportedModels) {
   5.101 +            Set<SchemaModel> importedModelsSet = new HashSet<SchemaModel>(ret);
   5.102 +            for ( ExternalModelRetriever retriever : mNotImportedModelsRetrievers ) {
   5.103 +                Collection<SchemaModel> notImportedModels = 
   5.104 +                    retriever.getSchemaModels(model, namespace);
   5.105 +                for (SchemaModel notImported : notImportedModels) {
   5.106 +                    if (!importedModelsSet.contains(notImported)) {
   5.107 +                        ret.add( notImported );
   5.108 +                    }
   5.109 +                }
   5.110 +            }
   5.111 +        }
   5.112          return ret;
   5.113      }
   5.114      
   5.115      public interface SchemaResolver {
   5.116          <T extends ReferenceableSchemaComponent> T resolve(
   5.117 -                AbstractNamedComponentReference<T> reference );
   5.118 +                AbstractNamedComponentReference<T> reference);
   5.119      }
   5.120  
   5.121      private static final SchemaReferenceBuilder INSTANCE = 
   5.122          new SchemaReferenceBuilder();
   5.123      
   5.124 -    private static Collection myRetrievers;
   5.125 +    private static Collection<? extends ExternalModelRetriever> mModelRetrievers;
   5.126 +    private static Collection<? extends ExternalModelRetriever> mNotImportedModelsRetrievers;
   5.127      
   5.128      private Collection<SchemaReferenceFactory> myCollection;
   5.129  }
   5.130 @@ -269,9 +291,9 @@
   5.131          }
   5.132          return null;
   5.133      }
   5.134 +
   5.135 +    }
   5.136      
   5.137 -}
   5.138 -
   5.139  class SchemaTypeFactory extends AbstractSchemaReferenceFactory {
   5.140  
   5.141      /* (non-Javadoc)
     6.1 --- a/bpel.model/src/org/netbeans/modules/bpel/model/api/support/BpelExternalModelResolver.java	Sat Apr 05 18:31:19 2008 -0700
     6.2 +++ b/bpel.model/src/org/netbeans/modules/bpel/model/api/support/BpelExternalModelResolver.java	Mon Apr 07 16:30:37 2008 +0400
     6.3 @@ -63,12 +63,13 @@
     6.4          mBpelModel = bpelModel;
     6.5      }
     6.6      
     6.7 +    /**
     6.8 +     * Looks for not only imported models! 
     6.9 +     * @param modelNsUri
    6.10 +     * @return
    6.11 +     */
    6.12      public Collection<SchemaModel> getModels(String modelNsUri) {
    6.13 -        //
    6.14 -        // TODO: It seems only imported schema models can be processed here.
    6.15 -        // Maybe it worth to use the list of visible models instead.
    6.16 -        //
    6.17 -        return SchemaReferenceBuilder.getSchemaModels(mBpelModel, modelNsUri);
    6.18 +        return SchemaReferenceBuilder.getSchemaModels(mBpelModel, modelNsUri, true);
    6.19      }
    6.20  
    6.21      public Collection<SchemaModel> getVisibleModels() {
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/bpel.model/src/org/netbeans/modules/bpel/model/api/support/NotImportedModelRetrieverImpl.java	Mon Apr 07 16:30:37 2008 +0400
     7.3 @@ -0,0 +1,81 @@
     7.4 +/*
     7.5 + * The contents of this file are subject to the terms of the Common Development
     7.6 + * and Distribution License (the License). You may not use this file except in
     7.7 + * compliance with the License.
     7.8 + * 
     7.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
    7.10 + * or http://www.netbeans.org/cddl.txt.
    7.11 + * 
    7.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
    7.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
    7.14 + * If applicable, add the following below the CDDL Header, with the fields
    7.15 + * enclosed by brackets [] replaced by your own identifying information:
    7.16 + * "Portions Copyrighted [year] [name of copyright owner]"
    7.17 + * 
    7.18 + * The Original Software is NetBeans. The Initial Developer of the Original
    7.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
    7.20 + * Microsystems, Inc. All Rights Reserved.
    7.21 + */
    7.22 +package org.netbeans.modules.bpel.model.api.support;
    7.23 +
    7.24 +import java.util.ArrayList;
    7.25 +import java.util.Collection;
    7.26 +import java.util.Collections;
    7.27 +import java.util.List;
    7.28 +
    7.29 +import org.netbeans.api.project.Project;
    7.30 +import org.netbeans.modules.bpel.model.api.BpelModel;
    7.31 +import org.netbeans.modules.bpel.model.xam.spi.NotImportedModelRetriever;
    7.32 +import org.netbeans.modules.xml.catalogsupport.util.ProjectUtilities;
    7.33 +import org.netbeans.modules.xml.schema.model.SchemaModel;
    7.34 +import org.netbeans.modules.xml.wsdl.model.WSDLModel;
    7.35 +import org.openide.filesystems.FileObject;
    7.36 +
    7.37 +/**
    7.38 + * Looks for all schema models in current project and all related projects 
    7.39 + * 
    7.40 + * @author nk160297
    7.41 + */
    7.42 +public class NotImportedModelRetrieverImpl implements NotImportedModelRetriever {
    7.43 +
    7.44 +
    7.45 +    /* (non-Javadoc)
    7.46 +     * @see org.netbeans.modules.bpel.model.xam.spi.ExternalModelRetriever#getWSDLModels(org.netbeans.modules.bpel.model.api.BpelModel, java.lang.String)
    7.47 +     */
    7.48 +    @SuppressWarnings("unchecked")
    7.49 +    public Collection<WSDLModel> getWSDLModels(BpelModel model, String namespace) {
    7.50 +        return Collections.EMPTY_LIST;
    7.51 +    }
    7.52 +    
    7.53 +
    7.54 +    /* (non-Javadoc)
    7.55 +     * @see org.netbeans.modules.bpel.model.xam.spi.ExternalModelRetriever#getSchemaModels(org.netbeans.modules.bpel.model.api.BpelModel, java.lang.String)
    7.56 +     */
    7.57 +    @SuppressWarnings("unchecked")
    7.58 +    public Collection<SchemaModel> getSchemaModels(BpelModel model, String namespace) {
    7.59 +        if ( namespace == null ) {
    7.60 +            return Collections.EMPTY_LIST;
    7.61 +        }
    7.62 +        //
    7.63 +        //
    7.64 +        // TODO: Only schema models from this and related projects are returned. 
    7.65 +        // It is necessary to add schema models from the "BPEL Global Catalog"
    7.66 +        // 
    7.67 +        Project project = Utils.safeGetProject(model);
    7.68 +        List<FileObject> schemaFoList = ProjectUtilities.
    7.69 +                getXSDFilesRecursively(project);
    7.70 +        Collection<SchemaModel> resultList = new ArrayList<SchemaModel>();
    7.71 +        for (FileObject fo : schemaFoList) {
    7.72 +            SchemaModel sModel = Utils.getSchemaModel(fo);
    7.73 +            if (sModel != null) {
    7.74 +                String modelNs = sModel.getEffectiveNamespace(sModel.getSchema());
    7.75 +                if (namespace.equals(modelNs)) {
    7.76 +                    resultList.add(sModel);
    7.77 +                }
    7.78 +            }
    7.79 +        }
    7.80 +        //
    7.81 +        return resultList;
    7.82 +    }
    7.83 +
    7.84 +}
     8.1 --- a/bpel.model/src/org/netbeans/modules/bpel/model/api/support/Utils.java	Sat Apr 05 18:31:19 2008 -0700
     8.2 +++ b/bpel.model/src/org/netbeans/modules/bpel/model/api/support/Utils.java	Mon Apr 07 16:30:37 2008 +0400
     8.3 @@ -54,7 +54,6 @@
     8.4  import java.util.StringTokenizer;
     8.5  import java.util.Map.Entry;
     8.6  
     8.7 -import javax.xml.namespace.NamespaceContext;
     8.8  import javax.xml.namespace.QName;
     8.9  
    8.10  import org.netbeans.api.project.FileOwnerQuery;
    8.11 @@ -116,10 +115,7 @@
    8.12  import org.openide.filesystems.FileObject;
    8.13  import org.openide.util.Lookup;
    8.14  import org.w3c.dom.Element;
    8.15 -import org.netbeans.modules.xml.schema.model.GlobalType;
    8.16 -import org.netbeans.modules.xml.xpath.ext.spi.XPathCast;
    8.17  import org.netbeans.modules.xml.xpath.ext.spi.XPathCastResolver;
    8.18 -import org.netbeans.modules.bpel.model.api.references.SchemaReference;
    8.19  import org.netbeans.modules.bpel.model.ext.editor.api.Cast;
    8.20  import org.netbeans.modules.bpel.model.ext.editor.api.Casts;
    8.21  import org.netbeans.modules.bpel.model.ext.editor.api.Editor;
    8.22 @@ -217,7 +213,7 @@
    8.23          model.setExternalModelResolver(new ExternalModelResolver() {
    8.24              public Collection<SchemaModel> getModels(String modelNsUri) {
    8.25                  BpelModel bpelModel = ((BpelEntity) element).getBpelModel();
    8.26 -                return SchemaReferenceBuilder.getSchemaModels(bpelModel, modelNsUri);
    8.27 +                return SchemaReferenceBuilder.getSchemaModels(bpelModel, modelNsUri, true);
    8.28              }
    8.29  
    8.30              public Collection<SchemaModel> getVisibleModels() {
     9.1 --- a/bpel.model/src/org/netbeans/modules/bpel/model/api/support/XPathCastImpl.java	Sat Apr 05 18:31:19 2008 -0700
     9.2 +++ b/bpel.model/src/org/netbeans/modules/bpel/model/api/support/XPathCastImpl.java	Mon Apr 07 16:30:37 2008 +0400
     9.3 @@ -69,12 +69,33 @@
     9.4          return xPathExpr;
     9.5      }
     9.6  
     9.7 -    public XPathCastImpl(Cast cast) {
     9.8 -        mCast = cast;
     9.9 -        mCastTo = getType(cast);
    9.10 -        myPathText = cast.getPath();
    9.11 +    public static XPathCastImpl convert(Cast cast) {
    9.12 +        SchemaReference<GlobalType> ref = cast.getType();
    9.13 +        if (ref == null) {
    9.14 +            return null;
    9.15 +        }
    9.16 +        GlobalType castTo = ref.get();
    9.17 +        String pathText = cast.getPath();
    9.18 +        //
    9.19 +        if (cast == null || pathText == null || pathText.length() == 0) {
    9.20 +            return null;
    9.21 +        }
    9.22 +        XPathCastImpl result = new XPathCastImpl();
    9.23 +        result.mCast = cast;
    9.24 +        result.myPathText = pathText;
    9.25 +        result.mCastTo = castTo;
    9.26 +        //
    9.27 +        return result;
    9.28      }
    9.29 -
    9.30 +    
    9.31 +    private XPathCastImpl() {
    9.32 +    }
    9.33 +    
    9.34 +    public XPathCastImpl(XPathExpression castWhat, GlobalType castTo) {
    9.35 +        mXPathExpression = castWhat;
    9.36 +        mCastTo = castTo;
    9.37 +    }
    9.38 +    
    9.39      public String getPathText() {
    9.40          return myPathText;
    9.41      }
    9.42 @@ -90,18 +111,6 @@
    9.43          return mXPathExpression;
    9.44      }
    9.45  
    9.46 -    private GlobalType getType(Cast cast) {
    9.47 -        SchemaReference<GlobalType> ref = cast.getType();
    9.48 -//System.out.println();
    9.49 -//System.out.println("---: " + ref);
    9.50 -
    9.51 -        if (ref == null) {
    9.52 -            return null;
    9.53 -        }
    9.54 -//System.out.println("   : " + ref.get());
    9.55 -        return ref.get();
    9.56 -    }
    9.57 -
    9.58      @Override
    9.59      public String toString() {
    9.60          return "(" + mCastTo.toString() + ")" + mXPathExpression.getExpressionString();
    10.1 --- a/bpel.model/src/org/netbeans/modules/bpel/model/api/support/XPathCastResolverImpl.java	Sat Apr 05 18:31:19 2008 -0700
    10.2 +++ b/bpel.model/src/org/netbeans/modules/bpel/model/api/support/XPathCastResolverImpl.java	Mon Apr 07 16:30:37 2008 +0400
    10.3 @@ -46,23 +46,33 @@
    10.4  import org.netbeans.modules.xml.xpath.ext.spi.XPathCast;
    10.5  import org.netbeans.modules.xml.xpath.ext.spi.XPathCastResolver;
    10.6  import org.netbeans.modules.bpel.model.ext.editor.api.Cast;
    10.7 +import org.openide.ErrorManager;
    10.8  
    10.9  /**
   10.10   * @author Vladimir Yaroslavskiy
   10.11   * @version 2008.03.27
   10.12   */
   10.13  public class XPathCastResolverImpl implements XPathCastResolver {
   10.14 -  public XPathCastResolverImpl(List<Cast> casts) {
   10.15 -    myXPathCasts = new ArrayList<XPathCast>();
   10.16  
   10.17 -    for (Cast cast : casts) {
   10.18 -      myXPathCasts.add(new XPathCastImpl(cast));
   10.19 +    public XPathCastResolverImpl(List<Cast> casts) {
   10.20 +        myXPathCasts = new ArrayList<XPathCast>();
   10.21 +
   10.22 +        for (Cast cast : casts) {
   10.23 +            XPathCastImpl xPathCast = XPathCastImpl.convert(cast);
   10.24 +            if (xPathCast != null) {
   10.25 +                myXPathCasts.add(xPathCast);
   10.26 +            } else {
   10.27 +                String msg = "An error while processing the cast: path=\"" +
   10.28 +                        cast.getPath() + "\" castTo=\"" +
   10.29 +                        cast.getType() + "\"";
   10.30 +                ErrorManager.getDefault().log(ErrorManager.WARNING, msg);
   10.31 +            }
   10.32 +        }
   10.33      }
   10.34 -  }
   10.35  
   10.36 -  public List<XPathCast> getXPathCasts() {
   10.37 -    return myXPathCasts;
   10.38 -  }
   10.39 -
   10.40 -  private List<XPathCast> myXPathCasts;
   10.41 +    public List<XPathCast> getXPathCasts() {
   10.42 +        return myXPathCasts;
   10.43 +    }
   10.44 +    
   10.45 +    private List<XPathCast> myXPathCasts;
   10.46  }
    11.1 --- a/bpel.model/src/org/netbeans/modules/bpel/model/ext/editor/api/Cast.java	Sat Apr 05 18:31:19 2008 -0700
    11.2 +++ b/bpel.model/src/org/netbeans/modules/bpel/model/ext/editor/api/Cast.java	Mon Apr 07 16:30:37 2008 +0400
    11.3 @@ -30,6 +30,7 @@
    11.4  import org.netbeans.modules.bpel.model.api.BpelContainer;
    11.5  import org.netbeans.modules.bpel.model.api.ExtensionEntity;
    11.6  import org.netbeans.modules.bpel.model.api.events.VetoException;
    11.7 +import org.netbeans.modules.bpel.model.api.references.OutOfImportReference;
    11.8  import org.netbeans.modules.bpel.model.api.references.ReferenceCollection;
    11.9  import org.netbeans.modules.bpel.model.api.references.SchemaReference;
   11.10  import org.netbeans.modules.xml.schema.model.GlobalType;
   11.11 @@ -38,7 +39,9 @@
   11.12   * @author Vitaly Bychkov
   11.13   * @version 1.0
   11.14   */
   11.15 -public interface Cast extends ExtensionEntity, BpelContainer, ReferenceCollection {
   11.16 +public interface Cast extends ExtensionEntity, BpelContainer, 
   11.17 +        ReferenceCollection, OutOfImportReference {
   11.18 +    
   11.19      String SOURCE = "source"; //NOI18N
   11.20      String PATH = "path"; //NOI18N
   11.21      String TYPE = "type"; //NOI18N
    12.1 --- a/bpel.model/src/org/netbeans/modules/bpel/model/impl/BpelEntityImpl.java	Sat Apr 05 18:31:19 2008 -0700
    12.2 +++ b/bpel.model/src/org/netbeans/modules/bpel/model/impl/BpelEntityImpl.java	Mon Apr 07 16:30:37 2008 +0400
    12.3 @@ -260,11 +260,11 @@
    12.4      //##    Default implementation.
    12.5      //##
    12.6      //############################################################################
    12.7 -    public <T extends ReferenceableSchemaComponent> SchemaReference<T> createSchemaReference(T target, Class<T> type) {
    12.8 +    public <T extends ReferenceableSchemaComponent> SchemaReference<T> 
    12.9 +            createSchemaReference(T target, Class<T> type) {
   12.10          readLock();
   12.11          try {
   12.12 -            return SchemaReferenceBuilder.getInstance().build(target, type,
   12.13 -                    this);
   12.14 +            return SchemaReferenceBuilder.getInstance().build(target, type, this);
   12.15          } finally {
   12.16              readUnlock();
   12.17          }
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/bpel.model/src/org/netbeans/modules/bpel/model/xam/spi/NotImportedModelRetriever.java	Mon Apr 07 16:30:37 2008 +0400
    13.3 @@ -0,0 +1,34 @@
    13.4 +/*
    13.5 + * The contents of this file are subject to the terms of the Common Development
    13.6 + * and Distribution License (the License). You may not use this file except in
    13.7 + * compliance with the License.
    13.8 + * 
    13.9 + * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
   13.10 + * or http://www.netbeans.org/cddl.txt.
   13.11 + * 
   13.12 + * When distributing Covered Code, include this CDDL Header Notice in each file
   13.13 + * and include the License file at http://www.netbeans.org/cddl.txt.
   13.14 + * If applicable, add the following below the CDDL Header, with the fields
   13.15 + * enclosed by brackets [] replaced by your own identifying information:
   13.16 + * "Portions Copyrighted [year] [name of copyright owner]"
   13.17 + * 
   13.18 + * The Original Software is NetBeans. The Initial Developer of the Original
   13.19 + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
   13.20 + * Microsystems, Inc. All Rights Reserved.
   13.21 + */
   13.22 +
   13.23 +package org.netbeans.modules.bpel.model.xam.spi;
   13.24 +
   13.25 +/**
   13.26 + * This interface will be implemented by services that search
   13.27 + * avaliable models.
   13.28 + *
   13.29 + * This interface is a marker only. It is applied that the services, 
   13.30 + * which implement it, will retrive models not imported to a BPEL file. 
   13.31 + * It is helpful for XPath exrensions inside of BPEL.
   13.32 + * 
   13.33 + * @author nk160297
   13.34 + */
   13.35 +public interface NotImportedModelRetriever extends ExternalModelRetriever {
   13.36 +
   13.37 +}