Package nexj.core.meta

Examples of nexj.core.meta.Metadata


            sBase = "";
         }

         properties.setProperty(XMLMetadataLoader.BASE_URL_PROPERTY, sBase);

         Metadata metadata = new MetadataLoaderDispatcher().load(getRequiredProperty("root.url"),
            properties, XMLMetadataLoader.VALIDATED_ONLY, null);

         s_logger.info("Version: " + metadata.getVersion());
         s_logger.info("Revision: " + metadata.getRevision());
         s_logger.info("Checksum: " + metadata.getChecksum());
         s_logger.info("Name: " + metadata.getName());
         s_logger.info("Namespace: " + metadata.getNamespace());

         s_logger.info("");
         s_logger.info("Base");
         s_logger.info("Version: " + metadata.getBaseVersion());
         s_logger.info("Checksum: " + metadata.getBaseChecksum());
         s_logger.info("Namespace: " + metadata.getBaseNamespace());

         s_logger.debug("");
         s_logger.debug("Statistics");
         s_logger.debug("Channels: " + metadata.getChannelCount());
         s_logger.debug("Channel Types: " + metadata.getChannelTypeCount());
         s_logger.debug("Class Aspects: " + metadata.getClassAspectCount());
         s_logger.debug("Data Sources: " + metadata.getDataSourceCount());
         s_logger.debug("Flow Macros: " + metadata.getFlowMacroCount());
         s_logger.debug("Formats: " + metadata.getFormatCount());
         s_logger.debug("Interfaces: " + metadata.getInterfaceCount());
         s_logger.debug("Locales: " + metadata.getLocaleCount());
         s_logger.debug("Messages: " + metadata.getMessageCount());
         s_logger.debug("Primitive Privileges: " + metadata.getPrimitivePrivilegeCount());
         s_logger.debug("Transformations: " + metadata.getTransformationCount());
      }
      else
      {
         throw new IllegalArgumentException("Invalid command \"" + sCommand + "\"");
      }
View Full Code Here


         throw new IllegalArgumentException("Target directory is invalid or does not exist");
      }
     
      m_sOptionalFilePrefix = getProperty("msg.prefix");
     
      Metadata metadata = Repository.getMetadata();

      Message[] messages;
     
      final XSDMessageImporter.MessageNameResolver fMsgNameResolver = new XSDMessageImporter.MessageNameResolver()
      {
View Full Code Here

            }
         };

         properties.setProperty(XMLMetadataLoader.BASE_URL_PROPERTY, sBaseURLProperty == null ? "" : sBaseURLProperty);

         Metadata oldMetadata = null;

         for (int nDumpIndex = 0; nDumpIndex < sDumpURLArray.length; ++nDumpIndex)
         {
            String sPreviousDumpURL;
View Full Code Here

    * Upgrades the data in the system.
    * @param bForce True to ignore the persistent store upgradability flag.
    */
   protected void upgradeData(boolean bForce)
   {
      Metadata metadata = m_context.getMetadata();
      boolean bCommit = false;

      try
      {
         Upgrade upgrade = metadata.getUpgrade("Main");

         upgrade.validate(metadata, null);
         new DataLoader(m_context).upgrade(getDataSourceSet(), upgrade, bForce);
         metadata.getMetaclass("SysUpgrade").invoke("upgrade");
         bCommit = true;
      }
      finally
      {
         m_context.complete(bCommit);
View Full Code Here

         configProperties.setProperty(SysUtil.CONFIG_PROPERTY, sConfig);

         MetadataLoaderDispatcher loaderDispatcher = new MetadataLoaderDispatcher();
        
         Metadata metadata = loaderDispatcher.load(
            URLUtil.toURL(getRequiredProperty("root.url")),
            configProperties, MetadataLoader.ENVIRONMENT_ONLY, null);

         metadataEnabledProperties.setMetadataLoaderProperties(metadata.getProperties());
         m_installer.setMetadata(metadata);

         for (int i = 0; i != CUSTOM_PROPERTIES.length; ++i)
         {
            String sName = CUSTOM_PROPERTIES[i];
            String sValue = getProperty(sName);
           
            if (sValue != null)
            {
               metadataEnabledProperties.setProperty(sName, sValue);
            }
         }

         // Decrypt the password
         sPassword = dispatcher.decrypt(sPassword);

         // Prepare for encryption
         if (metadataEnabledProperties.getProperty("cipher.scheme") == null)
         {
            metadataEnabledProperties.setProperty("cipher.scheme", metadata.getEncryptionScheme());
         }

         dispatcher.init(metadataEnabledProperties);

         m_installer.setProperties(metadataEnabledProperties);
View Full Code Here

      {
         exportSchema();
      }
      else if (sCommand.equals("setup"))
      {
         Metadata metadata = new MetadataLoaderDispatcher().load(null, null,
            MetadataLoader.DATASOURCE_ONLY | MetadataLoader.INTEGRATION_EXCLUDED, null);
         RelationalDatabase database = getDatabase(metadata);

         manager = getSchemaManager(database);
         manager.createDatabase((RelationalSchema)database.getSchema(), new PropertyMap()
View Full Code Here

    * Converts a dump file into an SQL script.
    * @throws Exception On script generation error.
    */
   private void generateInsertScript() throws Exception
   {
      Metadata metadata = Repository.getMetadata();
      String sDataSources = getProperty("meta.datasource", "DefaultRelationalDatabase");
      String sInputURL = getRequiredProperty("dump.file");
      String sOutputURL = getRequiredProperty("sql.file");
      InputStream in = URLUtil.openStream(new URL(URLUtil.toURL(sInputURL)));
      Writer out = // for requested DataSources
         IOUtil.openBufferedWriter((URLUtil.isURL(sOutputURL)) ?
            new File(new URI(sOutputURL)) : new File(sOutputURL), XMLUtil.ENCODING);
      Set dataSourceSet = null;
      InvocationContext context =
         (InvocationContext)metadata.getComponent("System.InvocationContext").getInstance(null);

      context.initialize(null);
      context.setLocale(Locale.getDefault());
      context.setProtected(false);
      context.setSecure(false);
      context.setPartitioned(false);

      if (sDataSources != null && !"*".equals(sDataSources))
      {
         dataSourceSet = new HashHolder();

         for (StringTokenizer tokenizer = new StringTokenizer(sDataSources, ",");
              tokenizer.hasMoreTokens();)
         {
            dataSourceSet.add(metadata.getDataSource(tokenizer.nextToken().trim()));
         }
      }

      try
      {
View Full Code Here

    * @param delete the function to determine a the resource seed delete can be performed for a given resource.
    * @param loader the loader of resources to seed.
    */
   protected void seed(String sTransformation, final Function enabled, final Function delete, ResourceLoader loader)
   {
      final Metadata metadata = m_context.getMetadata();
      final MessageParser parser = (MessageParser)metadata.getFormat("XML").getParser().getInstance(m_context);
      final MessageFormatter formatter = (MessageFormatter)metadata.getFormat("Object").getFormatter().getInstance(m_context);
      final Transformation transformation = metadata.getTransformation(sTransformation);
      final Transformer transformer = new Transformer(m_context);
      final UnitOfWork uow = m_context.getUnitOfWork();
      final boolean bRawSaved = uow.isRaw();

      try
View Full Code Here

      assertEquals("User", readRequest.getMetaclass().getName());
   }

   public void testEvent() throws Exception
   {
      Metadata metadata = new XMLMetadata(null, null, null, null, null);
      Metaclass metaclass = new Metaclass("Test");
      Attribute attr = new Attribute("attr");
      Argument untyped = new Argument("untyped");
      Argument anytyped = new Argument("anytyped");
      Argument inttyped = new Argument("inttyped");
      Argument listtyped = new Argument("listtyped");
      Event protectedEv = new Event("protected");
      Event publicEv = new Event("public");
      Event staticEv = new Event("static");
      MockServer server = new MockServer(new Object[]{null});
      Timestamp ts =
         SOAPUtil.parseDateTime("1234-05-06T07:08:09", true, true, TimeZone.getDefault());

      attr.setType(Primitive.ANY);
      anytyped.setType(Primitive.ANY);
      inttyped.setType(Primitive.INTEGER);
      listtyped.setType(Primitive.STRING);
      listtyped.setCollection(true);
      protectedEv.setVisibility(Metaclass.PROTECTED);
      publicEv.addArgument(untyped);
      publicEv.addArgument(anytyped);
      publicEv.addArgument(inttyped);
      publicEv.addArgument(listtyped);
      staticEv.addArgument(untyped);
      staticEv.addArgument(anytyped);
      staticEv.addArgument(inttyped);
      staticEv.addArgument(listtyped);
      staticEv.setStatic(true);
      staticEv.setVarArg(true);
      metaclass.addAttribute(attr);
      metaclass.addEvent(protectedEv);
      metaclass.addEvent(publicEv);
      metaclass.addEvent(staticEv);
      metadata.addMetaclass(metaclass);

      // test protected event
      XMLUnmarshaller unmarshaller = new XMLUnmarshaller(new InvocationContext(metadata));
      String sElement = XSDGenerator.computeElementName(protectedEv);
      StringReader reader = new StringReader(
View Full Code Here

    * @throws Exception
    */
   public void testUpdateInWrongWorkUnit() throws Exception
   {
      //Initialize InvocationContext
      Metadata metadata = Repository.getMetadata();
      InvocationContext context = new InvocationContext(metadata);

      context.setUserClass(metadata.getMetaclass("User"));
      context.initialize(new SimplePrincipal("jtest"));

      ThreadContextHolder.setContext(context);


      //Start work unit 1
      assertNull(context.beginTransaction(true));


      //Create instance in work unit 1
      Metaclass ContactClass = metadata.getMetaclass("Contact");
      Instance contact = (Instance)ContactClass.invoke("new");

      contact.setValue("firstName", "James");

     
View Full Code Here

TOP

Related Classes of nexj.core.meta.Metadata

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.