Package nexj.core.meta

Examples of nexj.core.meta.MetadataException


         Symbol sym = (Symbol)attributes.getHead();
         Attribute attr = metaclass.getAttribute(sym);

         if (attr.isStatic())
         {
            throw new MetadataException("err.meta.persistence.virtual.updateStaticAttribute",
               new Object[]{attr.getName(), metaclass.getName()});
         }

         attrSet.set(attr.getOrdinal());
         attributes = attributes.getNext();
View Full Code Here


            if (!metadata.getBaseNamespace().equals(helper.getNamespace(false)) ||
               !metadata.getBaseVersion().equals(helper.getVersion(false)) ||
               !metadata.getBaseChecksum().equals(sBaseChecksum))
            {
               throw new MetadataException("err.meta.baseVersion",
                  new Object[]
                  {
                     metadata.getBaseNamespace(),
                     metadata.getBaseVersion(),
                     metadata.getBaseChecksum(),
                     helper.getNamespace(false),
                     helper.getVersion(false),
                     sBaseChecksum
                  });
            }

            metadata.setBaseChecksum(sBaseChecksum);

            String sBaseCoreVersion = XMLUtil.getStringAttr(baseDescriptorElement, "coreVersion");

            if (metadata.getCoreVersion() != null)
            {
               if (sBaseCoreVersion != null &&
                  StringUtil.compareVersionRanges(metadata.getCoreVersion(), sBaseCoreVersion) < 0)
               {
                  throw new MetadataException("err.meta.baseCoreVersion",
                     new Object[] {XMLUtil.getStringAttr(baseDescriptorElement, "coreVersion"), metadata.getCoreVersion()}
                  );
               }
            }
            else
            {
               metadata.setCoreVersion(sBaseCoreVersion);
            }

            String sModule = XMLMetadataHelper.normalizeScope(XMLUtil.getStringAttr(descriptorElement, "module"));
            String sBaseModule = XMLMetadataHelper.normalizeScope(XMLUtil.getStringAttr(baseDescriptorElement, "module"));

            if (!ObjUtil.equal(sModule, sBaseModule))
            {
               throw new MetadataException("err.meta.baseModule",
                  new Object[]{(sModule == null) ? "" : sModule, (sBaseModule == null) ? "" : sBaseModule});
            }
         }

         String sCoreVersion = metadata.getCoreVersion();

         if (sCoreVersion != null)
         {
            boolean bPlus = sCoreVersion.length() > 0 &&
                            sCoreVersion.charAt(sCoreVersion.length() - 1) == '+';
            int nCompare = StringUtil.compareVersionRanges(Version.RELEASE, sCoreVersion);

            // if metadata coreVersion is older than Version.RELEASE then coreVersion must have '+'
            // if metadata coreVersion is newer than Version.RELEASE then metadata not compatible
            if (nCompare != 0 && (!bPlus || nCompare < 0))
            {
               throw new MetadataException(
                  "err.meta.coreVersion",
                  new Object[]
                  {
                     Version.RELEASE,
                     sCoreVersion
View Full Code Here

               {
                  m_bClient = false;
               }
               else
               {
                  throw new MetadataException("err.meta.library.scope",
                     new Object[]{sName});
               }
            }
         }
View Full Code Here

      {
         channel.setCombinationMode(Channel.COMBINE_ALL);
      }
      else
      {
         throw new MetadataException("err.meta.integration.combine",
            new Object[]{sCombine, channel.getName()});
      }

      XMLUtil.withFirstChildElement(element, "SenderProperties", false, new ElementHandler()
      {
View Full Code Here

      {
         m_metadata.setAuthenticationProtocol(Metadata.AUTH_PROTOCOL_CERTIFICATE);
      }
      else
      {
         throw new MetadataException("err.meta.authProtocol", new Object[]{sAuthProtocol});
      }

      m_metadata.setAuthenticationService(envProps.getProperty("authService"));
      m_metadata.setAuthenticationDomain(envProps.getProperty("authDomain"));
      m_metadata.setSessionTimeout(Integer.parseInt(envProps.getProperty(
         "sessionTimeout", Integer.toString(m_metadata.getSessionTimeout()))));
      m_metadata.setReplicatedSession(StringUtil.parseBoolean(envProps.getProperty(
         "replicatedSession", Boolean.toString(m_metadata.isReplicatedSession()))));
      m_metadata.setPersistentSession(StringUtil.parseBoolean(envProps.getProperty(
         "persistentSession", Boolean.toString(m_metadata.isPersistentSession()))));
      m_metadata.setSecureTransport(StringUtil.parseBoolean(envProps.getProperty(
         "secureTransport", Boolean.toString(m_metadata.isSecureTransport()))));
      m_metadata.setTestInterceptor(StringUtil.parseBoolean(envProps.getProperty(
         "test.record", Boolean.toString(m_metadata.isTestInterceptor()))));
      m_metadata.setTestEnvironment(StringUtil.parseBoolean(envProps.getProperty(
         "test", Boolean.toString(m_metadata.isTestEnvironment()))));

      m_metadata.setKeyStorePassword(decryptPassword(envProps.getProperty("keystorePassword")));
      String sHTTPURL = envProps.getProperty("httpURL");

      m_metadata.setHTTPRoot(sHTTPURL);
      m_metadata.setHTTPContextRoot(HTTP.getContextPath(sHTTPURL));
      m_metadata.setHTTPAnonymousContextRoot(HTTP.getContextPath(envProps.getProperty("httpAnonymousURL",
         m_metadata.getHTTPAnonymousContextRoot())));
      m_metadata.setHTTPFormContextRoot(HTTP.getContextPath(envProps.getProperty("httpFormURL",
         m_metadata.getHTTPFormContextRoot())));
      m_metadata.setHTTPPushRedirectorContextRoot(HTTP.getContextPath(envProps.getProperty("pushRedirectorURL",
         m_metadata.getHTTPPushRedirectorContextRoot())));

      if (m_metadata.getHTTPContextRoot().equals(m_metadata.getHTTPAnonymousContextRoot()) ||
         m_metadata.getHTTPContextRoot().equals(m_metadata.getHTTPFormContextRoot()) ||
         m_metadata.getHTTPAnonymousContextRoot().equals(m_metadata.getHTTPFormContextRoot()))
      {
         throw new MetadataException("err.meta.contextPathDup");
      }

      m_metadata.setHTTPFormLoginPage(envProps.getProperty("httpFormLoginPage",
         m_metadata.getHTTPFormLoginPage()));
      m_metadata.setHTTPFormErrorPage(envProps.getProperty("httpFormErrorPage",
View Full Code Here

                     DataSource source = m_metadata.getDataSource(sDataSource);
                     String sExpectedElement = m_metadata.getDataSourceTypeElement(source.getType()) + "Connection";

                     if (!sExpectedElement.equals(connectionElement.getNodeName()))
                     {
                        throw new MetadataException("err.meta.dataSourceConnectionElement",
                           new Object[]{connectionElement.getNodeName(), source.getName(),
                           sConnectionsName, sExpectedElement});
                     }

                     if (!connectionSet.add(source))
                     {
                        throw new MetadataException("err.meta.dupDataSourceConnection", new Object[]{sDataSource});
                     }

                     String sAdapter = XMLUtil.getStringAttr(connectionElement, "adapter");

                     if (sAdapter != null)
                     {
                        source.setAdapter(source.getType().getAdapter(sAdapter));
                     }

                     source.setReadLimit(XMLUtil.getIntAttr(connectionElement, "readLimit", source.getReadLimit()));

                     //Load DataSource-specific attributes.
                     ((XMLPersistenceMetadataLoader)m_helper.getClassInstance(source.getType().getLoader()))
                        .loadConnection(connectionElement, source, XMLMetadataLoader.this);
                  }
               });
            }
         });
      }

      //Call loadConnection to initialize DataSources with no entry in the .connections file.
      for (Iterator itr = m_metadata.getDataSourceIterator(); itr.hasNext();)
      {
         DataSource source = (DataSource)itr.next();

         if (!connectionSet.contains(source))
         {
            int nCookie = getHelper().pushMarker(MetadataValidationException.TYPE_NAME, "DataSourceConnection");
            getHelper().pushMarker("dataSourceConnection", source.getName());

            try
            {
               ((XMLPersistenceMetadataLoader)m_helper.getClassInstance(source.getType().getLoader()))
                  .loadConnection(null, source, XMLMetadataLoader.this);
            }
            catch (MetadataException e)
            {
               m_helper.addException(e);
            }
            finally
            {
               m_helper.restoreMarker(nCookie);
            }
         }
      }

      if (connectionsElement != null && !m_bIntegrationExcluded)
      {
         XMLUtil.withFirstChildElement(connectionsElement, "ChannelConnections", false, new ElementHandler()
         {
            public void handleElement(Element connectionsElement)
            {
               XMLUtil.forEachChildElement(connectionsElement, null,
                  m_helper.new ElementHandler("channel")
               {
                  protected String getName(Element element)
                  {
                     return XMLUtil.getReqStringAttr(element, "channel");
                  }

                  public void handleElement(Element connectionElement, String sChannel)
                  {
                     Channel channel = m_metadata.getChannel(sChannel);
                     String sExpectedElement = m_metadata.getChannelTypeElement(channel.getType()) + "Connection";

                     if (!sExpectedElement.equals(connectionElement.getNodeName()))
                     {
                        throw new MetadataException("err.meta.channelConnectionElement",
                           new Object[]{connectionElement.getNodeName(), channel.getName(),
                           sConnectionsName, sExpectedElement});
                     }

                     if (!connectionSet.add(channel))
                     {
                        throw new MetadataException("err.meta.dupChannelConnection", new Object[]{sChannel});
                     }

                     //Load Channel-specific attributes
                     ((XMLIntegrationMetadataLoader)m_helper.getClassInstance(channel.getType().getLoader()))
                        .loadConnection(connectionElement, channel, XMLMetadataLoader.this);
View Full Code Here

         {
            mapping.setNodeType(XMLMessagePartMapping.VALUE);
         }
         else
         {
            throw new MetadataException("err.meta.integration.xml.invalidNodeType",
               new Object[]{sType, part.getFullPath()});
         }
        
         String sSubtype = XMLUtil.getStringAttr(element, "subtype");

         if (sSubtype != null)
         {
            byte nSubtype = XMLMessagePartMapping.parseSubtype(sSubtype);

            if (nSubtype >= 0)
            {
               mapping.setSubtype(nSubtype);
            }
            else
            {
               throw new MetadataException("err.meta.integration.xml.invalidSubtype",
                  new Object[]{sSubtype, part.getFullPath()});
            }
         }

         mapping.setFormat(XMLUtil.getStringAttr(element, "format", mapping.getFormat()));

         // set the envelope before resolving the element namespace, since the namespace
         // may be implicitly declared through the presence of an envelope
         String sEnvelope = XMLUtil.getStringAttr(element, "envelope");

         if (sEnvelope != null)
         {
            if (mapping != rootMapping)
            {
               throw new MetadataException("err.meta.integration.xml.misplacedEnvelope",
                  new Object[]{part.getFullPath()});
            }

            if (sEnvelope.equals("soap"))
            {
               rootMapping.setEnvelope(RootXMLMessagePartMapping.ENVELOPE_SOAP);
            }
            else if (sEnvelope.equals("soap12"))
            {
               rootMapping.setEnvelope(RootXMLMessagePartMapping.ENVELOPE_SOAP12);
            }
            else
            {
               throw new MetadataException("err.meta.integration.xml.invalidEnvelope",
                  new Object[]{sEnvelope, part.getFullPath()});
            }
         }

         final String sNamespace = XMLUtil.getStringAttr(element, "namespace");
         String sURI = XMLUtil.getStringAttr(element, "uri");
         String sSchema = XMLUtil.getStringAttr(element, "schema");

         if (sNamespace != null)
         {
            if (sURI == null && sSchema != null)
            {
               throw new MetadataException("err.meta.integration.inapplicableSchema",
                  new Object[]{sSchema, part.getFullPath()});
            }

            mapping.setNamespace(rootMapping.addNamespace(sNamespace, sURI, sSchema, false));
         }
         else if (sURI != null)
         {
            throw new MetadataException("err.meta.integration.xml.missingNS",
               new Object[]{part.getFullPath()});
         }
         else if (sSchema != null)
         {
            throw new MetadataException("err.meta.integration.inapplicableSchema",
               new Object[]{sSchema, part.getFullPath()});
         }

         String sResource = XMLUtil.getStringAttr(element, "resource");

         if (sResource != null)
         {
            if (mapping != rootMapping)
            {
               throw new MetadataException("err.meta.integration.xml.misplacedResource",
                  new Object[]{part.getFullPath()});
            }

            try
            {
               XMLMetadataHelper helper = loader.getHelper();
               Pair list = (Pair)helper.parse(sResource, true, null, null, msg.getMetadata().getGlobalEnvironment());

               while (list != null)
               {
                  Object resource = list.getHead();
                  String sSourceURL;
                  URL dstURL;

                  if (resource instanceof Pair)
                  {
                     Pair resMap = (Pair)resource;

                     sSourceURL = resMap.getOperator().getName();
                     dstURL = helper.getResource(resMap.getNext().getOperator().getName()).getURL();
                  }
                  else
                  {
                     sSourceURL = ((Symbol)resource).getName();
                     dstURL = helper.getResource(sSourceURL).getURL();
                  }

                  rootMapping.addSchemaResourceMapping(sSourceURL, dstURL);
                  list = list.getNext();
               }
            }
            catch (Exception ex)
            {
               throw new MetadataException("err.meta.integration.xml.invalidResource", new Object[]{part.getFullPath()}, ex);
            }
         }

         String sAction = XMLUtil.getStringAttr(element, "action");

         if (sAction != null)
         {
            if (mapping != rootMapping)
            {
               throw new MetadataException("err.meta.integration.xml.misplacedAction",
                  new Object[]{part.getFullPath()});
            }

            rootMapping.setAction(sAction);
         }

         String sOperation = XMLUtil.getStringAttr(element, "operation");

         if (sOperation != null)
         {
            if (mapping != rootMapping)
            {
               throw new MetadataException("err.meta.integation.xml.misplacedOperation",
                  new Object[]{part.getFullPath()});
            }

            rootMapping.setOperation(sOperation);
         }

         String sXSDType = XMLUtil.getStringAttr(element, "xsdtype");

         if (sXSDType != null)
         {
            if (mapping != rootMapping)
            {
               throw new MetadataException("err.meta.integration.xml.misplacedXSDType",
                  new Object[]{part.getFullPath()});
            }

            rootMapping.setXSDType(sXSDType);
         }
View Full Code Here

      verifyNotReadOnly();

      if (m_lastVersion != null && m_lastVersion.getName() != null &&
         version.getName() == null)
      {
         throw new MetadataException("err.meta.upgrade.versionMismatch",
            new Object[]{m_lastVersion.getName(), m_sName});
      }

      if (version.getName() != null)
      {
         Object oldVersion = m_versionMap.put(version.getName(), version);

         if (oldVersion != null)
         {
            m_versionMap.put(version.getName(), oldVersion);

            throw new MetadataException("err.meta.upgrade.versionDup",
               new Object[]{version.getName(), m_sName});
         }
      }

      if (m_lastVersion == null)
View Full Code Here

            namespace.setSchema(sSchema);
         }

         if (sNamespaceURI != null && sURI != null && !sNamespaceURI.equals(sURI))
         {
            throw new MetadataException("err.meta.integration.xml.namespaceDup",
               new Object[]{sName, getRootMessage().getRoot().getFullPath()});
         }

         if (bDeclaredByEnvelope)
         {
            namespace.setDeclaredByEnvelope(true);
         }

         return namespace;
      }

      String sReservedURI = (String)s_reservedNamespaceMap.get(sName);

      if (sURI != null)
      {
         if (sReservedURI != null && !sURI.equals(sReservedURI))
         {
            throw new MetadataException("err.meta.integration.xml.reservedNamespaceRedefinition",
               new Object[]{sName, getRootMessage().getRoot().getFullPath()});
         }
      }
      else
      {
View Full Code Here

            ((XMLNamespace)oldNamespace).setDeclaredByEnvelope(true);
         }
        
         m_namespaceMap.put(namespace.getName(), oldNamespace);

         throw new MetadataException("err.meta.integration.xml.namespaceDup", new Object[]
         {
            namespace.getName(),
            getRootMessage().getRoot().getFullPath()
         });
      }
View Full Code Here

TOP

Related Classes of nexj.core.meta.MetadataException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.