Package org.apache.cocoon.components.persistence

Examples of org.apache.cocoon.components.persistence.CastorSourceConverter


    final Map keyMap = (Map) key;
       
        final String uri = this.getURI( keyMap );
       
    Source source = null;
    CastorSourceConverter converter = null;
        SourceResolver resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
    try {
      source = resolver.resolveURI(uri);
            converter = (CastorSourceConverter) this.manager.lookup(CastorSourceConverter.ROLE);

      return converter.getObject(source.getInputStream(), parameters);
    } finally {
            if ( resolver != null ) {
                resolver.release(source);
            }
      manager.release(converter);
View Full Code Here


       
        final String uri = this.getURI( keyMap );

        // first test: modifiable source?
        SourceResolver resolver = null;
        CastorSourceConverter converter = null;
        Source source = null;
        try {
            resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
            source = resolver.resolveURI(uri);
            if ( source instanceof ModifiableSource ) {
                converter = (CastorSourceConverter) this.manager.lookup(CastorSourceConverter.ROLE);
                converter.storeObject( ((ModifiableSource)source).getOutputStream(), parameters, profile);
                return;
            }

        } finally {
            if ( resolver != null ) {
                resolver.release(source);
            }
            manager.release(converter);
            manager.release(resolver);
            source = null;
            converter = null;
            resolver = null;
        }
       
        final StringBuffer buffer = this.getSaveURI( keyMap );

    SAXParser parser = null;
    try {
            resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
            converter = (CastorSourceConverter) this.manager.lookup(CastorSourceConverter.ROLE);

            ByteArrayOutputStream writer = new ByteArrayOutputStream();
       
            converter.storeObject(writer, parameters, profile);

            buffer.append("&content=");
            buffer.append(SourceUtil.encode(writer.toString()));

            source = resolver.resolveURI(buffer.toString());
View Full Code Here

    final Map keyMap = (Map) key;
       
        final String uri = this.getURI( keyMap );
       
    Source source = null;
    CastorSourceConverter converter = null;
        SourceResolver resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
    try {
      source = resolver.resolveURI(uri);
            converter = (CastorSourceConverter) this.manager.lookup(CastorSourceConverter.ROLE);

      return converter.getObject(source.getInputStream(), parameters);
    } finally {
            if ( resolver != null ) {
                resolver.release(source);
            }
      manager.release(converter);
View Full Code Here

       
        final String uri = this.getURI( keyMap );

        // first test: modifiable source?
        SourceResolver resolver = null;
        CastorSourceConverter converter = null;
        Source source = null;
        try {
            resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
            source = resolver.resolveURI(uri);
            if ( source instanceof ModifiableSource ) {
                converter = (CastorSourceConverter) this.manager.lookup(CastorSourceConverter.ROLE);
                converter.storeObject( ((ModifiableSource)source).getOutputStream(), parameters, profile);
                return;
            }

        } finally {
            if ( resolver != null ) {
                resolver.release(source);
            }
            manager.release(converter);
            manager.release(resolver);
            source = null;
            converter = null;
            resolver = null;
        }
       
        final StringBuffer buffer = this.getSaveURI( keyMap );

    SAXParser parser = null;
    try {
            resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
            converter = (CastorSourceConverter) this.manager.lookup(CastorSourceConverter.ROLE);

            ByteArrayOutputStream writer = new ByteArrayOutputStream();
       
            converter.storeObject(writer, parameters, profile);

            buffer.append("&content=");
            buffer.append(SourceUtil.encode(writer.toString()));

            source = resolver.resolveURI(buffer.toString());
View Full Code Here

    final Map keyMap = (Map) key;
       
        final String uri = this.getURI( keyMap, parameters );
       
    Source source = null;
    CastorSourceConverter converter = null;
        SourceResolver resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
    try {
      source = resolver.resolveURI(uri);
            converter = (CastorSourceConverter) this.manager.lookup(CastorSourceConverter.ROLE);

      return converter.getObject(source.getInputStream(), parameters);
    } finally {
            if ( resolver != null ) {
                resolver.release(source);
            }
      manager.release(converter);
View Full Code Here

       
        final String uri = this.getURI( keyMap, parameters );

        // first test: modifiable source?
        SourceResolver resolver = null;
        CastorSourceConverter converter = null;
        Source source = null;
        try {
            resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
            source = resolver.resolveURI(uri);
            if ( source instanceof ModifiableSource ) {
                converter = (CastorSourceConverter) this.manager.lookup(CastorSourceConverter.ROLE);
                converter.storeObject( ((ModifiableSource)source).getOutputStream(), parameters, profile);
                return;
            }

        } finally {
            if ( resolver != null ) {
                resolver.release(source);
            }
            manager.release(converter);
            manager.release(resolver);
            source = null;
            converter = null;
            resolver = null;
        }
       
        final StringBuffer buffer = this.getSaveURI( keyMap, parameters );

    SAXParser parser = null;
    try {
            resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
            converter = (CastorSourceConverter) this.manager.lookup(CastorSourceConverter.ROLE);

            ByteArrayOutputStream writer = new ByteArrayOutputStream();
       
            converter.storeObject(writer, parameters, profile);

            buffer.append("&content=");
            buffer.append(SourceUtil.encode(writer.toString()));

            source = resolver.resolveURI(buffer.toString());
View Full Code Here

     */
    public void generate()
    throws IOException, SAXException, ProcessingException {
       
        SAXParser parser = null;
        CastorSourceConverter converter = null;
        final Object context = FlowHelper.getContextObject(this.objectModel);
        Map myMap = new HashMap();
        if (context instanceof Map) {
            myMap = (Map) context;
        } else {
            fillContext(context, myMap);
        }
        try {
          Object layout = myMap.get("layout");
          converter = (CastorSourceConverter) this.manager.lookup(org.apache.cocoon.components.persistence.CastorSourceConverter.ROLE);
          ByteArrayOutputStream os = new java.io.ByteArrayOutputStream();
          HashMap para = new HashMap();
          para.put("profiletype", "layout");
          converter.storeObject(os, para, layout);
          String xml = new String();
          xml = os.toString();
            final InputSource inputSource = new InputSource(new StringReader(xml));
            parser = (SAXParser)this.manager.lookup(SAXParser.ROLE);
            parser.parse(inputSource, super.xmlConsumer);
View Full Code Here

    final Map keyMap = (Map) key;
       
        final String uri = this.getURI( keyMap );
       
    Source source = null;
    CastorSourceConverter converter = null;
        SourceResolver resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
    try {
      source = resolver.resolveURI(uri);
            converter = (CastorSourceConverter) this.manager.lookup(CastorSourceConverter.ROLE);

      return converter.getObject(source.getInputStream(), parameters);
    } finally {
            if ( resolver != null ) {
                resolver.release(source);
            }
      manager.release(converter);
View Full Code Here

       
        final String uri = this.getURI( keyMap );

        // first test: modifiable source?
        SourceResolver resolver = null;
        CastorSourceConverter converter = null;
        Source source = null;
        try {
            resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
            source = resolver.resolveURI(uri);
            if ( source instanceof ModifiableSource ) {
                converter = (CastorSourceConverter) this.manager.lookup(CastorSourceConverter.ROLE);
                converter.storeObject( ((ModifiableSource)source).getOutputStream(), parameters, profile);
                return;
            }

        } finally {
            if ( resolver != null ) {
                resolver.release(source);
            }
            manager.release(converter);
            manager.release(resolver);
            source = null;
            converter = null;
            resolver = null;
        }
       
        final StringBuffer buffer = this.getSaveURI( keyMap );

    SAXParser parser = null;
    try {
            resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
            converter = (CastorSourceConverter) this.manager.lookup(CastorSourceConverter.ROLE);

            ByteArrayOutputStream writer = new ByteArrayOutputStream();
       
            converter.storeObject(writer, parameters, profile);

            buffer.append("&content=");
            try {
                buffer.append(NetUtils.encode(writer.toString(), "utf-8"));
            } catch (UnsupportedEncodingException uee) {
View Full Code Here

    final Map keyMap = (Map) key;
       
        final String uri = this.getURI( keyMap );
       
    Source source = null;
    CastorSourceConverter converter = null;
        SourceResolver resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
    try {
      source = resolver.resolveURI(uri);
            converter = (CastorSourceConverter) this.manager.lookup(CastorSourceConverter.ROLE);

      return converter.getObject(source.getInputStream(), parameters);
    } finally {
            if ( resolver != null ) {
                resolver.release(source);
            }
      manager.release(converter);
View Full Code Here

TOP

Related Classes of org.apache.cocoon.components.persistence.CastorSourceConverter

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.