Package org.exolab.castor.mapping

Examples of org.exolab.castor.mapping.Mapping


        SourceResolver resolver = null;

        try {
            resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
            Mapping mappingPortletXml = new Mapping();
            Mapping mappingWebXml = new Mapping();
            Source source = null;
            try {
                source = resolver.resolveURI(PORTLET_MAPPING);

                mappingPortletXml.loadMapping(SourceUtil.getInputSource(source));
            } finally {
                resolver.release(source);
            }
            try {
                source = resolver.resolveURI(WEBXML_MAPPING);

                mappingWebXml.loadMapping(SourceUtil.getInputSource(source));
            } finally {
                resolver.release(source);
            }

            String baseWMDir = servletContext.getRealPath("");
View Full Code Here


        this.logger.info("(Re)building the grammar from '"+this.grammarSource.getURI()+"'");

        if (this.grammarSource.getInputStream()==null)
          throw new ProcessingException("Source '"+this.grammarSource.getURI()+"' not found");

        Mapping mapping = new Mapping();

        mapping.loadMapping(new InputSource(ExtendedGrammar.class.getResource("mapping.xml")
                                                                 .openStream()));

        Unmarshaller unmarshaller = new Unmarshaller(ExtendedGrammar.class);
        unmarshaller.setMapping(mapping);
View Full Code Here

    {
        System.out.println("Testing marshalling of Registry");

        String xregFile = "webapp/WEB-INF/psml/test/testcase-2.xreg";

        Mapping mapping = null;
        String mapFile = getMappingFileName();
        File map = new File(mapFile);
        if (map.exists() && map.isFile() && map.canRead())
        {
            try
            {
                FileReader reader = new FileReader(xregFile);
                mapping = new SynchronizedMapping();
                InputSource is = new InputSource(new FileReader(map));
                is.setSystemId(mapFile);
                mapping.loadMapping(is);
                Unmarshaller unmarshaller = new Unmarshaller(mapping);
                RegistryFragment fragment = (RegistryFragment) unmarshaller.unmarshal(reader);
                assertNotNull(fragment);
                Vector portlets = fragment.getPortlets();
View Full Code Here

        boolean entryFound = false;
        System.out.println("Testing marshalling of Registry security-entry");

        String xregFile = "webapp/WEB-INF/psml/test/testcase-security.xreg";

        Mapping mapping = null;
        String mapFile = getMappingFileName();
        File map = new File(mapFile);
        if (map.exists() && map.isFile() && map.canRead())
        {
            FileReader reader = new FileReader(xregFile);
            mapping = new SynchronizedMapping();
            InputSource is = new InputSource(new FileReader(map));
            is.setSystemId(mapFile);
            mapping.loadMapping(is);
            Unmarshaller unmarshaller = new Unmarshaller(mapping);
            RegistryFragment fragment = (RegistryFragment) unmarshaller.unmarshal(reader);
            assertNotNull(fragment);
            Vector securityEntries = fragment.getSecurityEntries();
            assertTrue("Security Entries exist", !securityEntries.isEmpty());
View Full Code Here

    {
        System.out.println("Testing marshalling of Registry security-ref");

        String xregFile = "webapp/WEB-INF/psml/test/testcase-security.xreg";

        Mapping mapping = null;
        String mapFile = getMappingFileName();
        File map = new File(mapFile);
        if (map.exists() && map.isFile() && map.canRead())
        {
            FileReader reader = new FileReader(xregFile);
            mapping = new SynchronizedMapping();
            InputSource is = new InputSource(new FileReader(map));
            is.setSystemId(mapFile);
            mapping.loadMapping(is);
            Unmarshaller unmarshaller = new Unmarshaller(mapping);
            RegistryFragment fragment = (RegistryFragment) unmarshaller.unmarshal(reader);
            assertNotNull(fragment);
            Vector securityEntries = fragment.getSecurityEntries();
            assertTrue("Security Entries exist", !securityEntries.isEmpty());
View Full Code Here

    {
        System.out.println("Testing marshalling of Registry, URL");

        String xregFile = "webapp/WEB-INF/psml/test/url-testcase.xreg";

        Mapping mapping = null;
        String mapFile = getMappingFileName();
        File map = new File(mapFile);
        if (map.exists() && map.isFile() && map.canRead())
        {
            try
            {
                FileReader reader = new FileReader(xregFile);
                mapping = new SynchronizedMapping();
                InputSource is = new InputSource(new FileReader(map));
                is.setSystemId(mapFile);
                mapping.loadMapping(is);
                Unmarshaller unmarshaller = new Unmarshaller(mapping);
                ContentURL url = (ContentURL) unmarshaller.unmarshal(reader);
                assertNotNull(url);

                System.out.println(url.getURL());
View Full Code Here

        String registryFile = "test/conf/test-registry.xreg";
       
        File map = new File(mapFile);
        try
        {
            Mapping mapping = new SynchronizedMapping();
            InputSource is = new InputSource(new FileReader(map));
            is.setSystemId(mapFile);
            mapping.loadMapping(is);
           
            DocumentBuilderFactory dbfactory = DocumentBuilderFactory.newInstance();
            DocumentBuilder builder = dbfactory.newDocumentBuilder();
      
            Document d = builder.parse(new File(registryFile));
View Full Code Here

  public void storeObject(ModifiableSource source, String name, Object object) throws ConverterException {
    try {
      Writer writer = new OutputStreamWriter(source.getOutputStream());
      Marshaller marshaller = new Marshaller(writer);
      Mapping mapping = new Mapping();
      marshaller.setMapping((Mapping)this.mappings.get(name));
      marshaller.marshal(object);
      writer.close();
    } catch (MappingException e) {
      throw new ConverterException("can't create Unmarshaller", e);
View Full Code Here

        Source source = null;
        try {
      Entry entry;
      String name;
      String mappingSource;
      Mapping mapping;
      Iterator iterator = this.mappingSources.entrySet().iterator();
          while (iterator.hasNext()) {
            entry = (Map.Entry)iterator.next();
            name = (String)entry.getKey();
            mappingSource = (String)entry.getValue();
           
        source = resolver.resolveURI(mappingSource);
        mapping = new Mapping();
        mapping.loadMapping(SourceUtil.getInputSource(source));
        this.mappings.put(name, mapping);
          }
        } finally {
            if (source != null) {
                resolver.release(source);
View Full Code Here

    {
        System.out.println("Testing marshalling of PSML on base *** ConfigElement ***");

        String psmlFile = "webapp/WEB-INF/psml/test/testcase.psml";

        Mapping mapping = null;
        String mapFile = getMappingFileName();
        File map = new File(mapFile);
        if (map.exists() && map.isFile() && map.canRead())
        {
            try
            {
                FileReader reader = new FileReader(psmlFile);
                mapping = new SynchronizedMapping();
                InputSource is = new InputSource( new FileReader(map) );
                is.setSystemId( mapFile );
                mapping.loadMapping( is );
                Unmarshaller unmarshaller = new Unmarshaller(mapping);
                ConfigElement rootset = (ConfigElement)unmarshaller.unmarshal(reader);
               
                assertTrue(rootset.getName().equals("theRootSet"));

View Full Code Here

TOP

Related Classes of org.exolab.castor.mapping.Mapping

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.