Package railo.commons.io.res.type.s3

Examples of railo.commons.io.res.type.s3.S3


 
  /** */
  @Test public void  testObjectStruct() {
    try
    {
      S3 a  = null;
      testServer.p_object_struct( a );
      testClient.p_object_struct( a );
    }
    catch ( UnsupportedOperationException e )
    {
View Full Code Here


    assertSame( e, a );
  }
 
  private void testS3Export(String s, Object value)
  {
    StructValue sv = vf.exportCustomValue( new S3( s,value ) );
    sv.checkType( ValueFactoryTest1._mt_etch_tests_Test1_S3 );
    assertEquals( 2, sv.size() );
    assertEquals( s, sv.get( ValueFactoryTest1._mf_tipe ) );
    assertEquals( value, sv.get( ValueFactoryTest1._mf_x ) );
  }
View Full Code Here

  private void testS3Import(String s, Object value)
  {
    StructValue sv = new StructValue( ValueFactoryTest1._mt_etch_tests_Test1_S3, vf );
    sv.put( ValueFactoryTest1._mf_tipe, s );
    sv.put( ValueFactoryTest1._mf_x, value );
    S3 myS3 = (S3) vf.importCustomValue( sv );
    assertEquals( s, myS3.tipe );
    assertEquals( value, myS3.x );
 
View Full Code Here

    assertSame( e, a );
  }
 
  private void testS3Export(String s, Object value)
  {
    StructValue sv = vf.exportCustomValue( new S3( s,value ) );
    sv.checkType( ValueFactoryTest1._mt_org_apache_etch_tests_Test1_S3 );
    assertEquals( 2, sv.size() );
    assertEquals( s, sv.get( ValueFactoryTest1._mf_tipe ) );
    assertEquals( value, sv.get( ValueFactoryTest1._mf_x ) );
  }
View Full Code Here

  private void testS3Import(String s, Object value)
  {
    StructValue sv = new StructValue( ValueFactoryTest1._mt_org_apache_etch_tests_Test1_S3, vf );
    sv.put( ValueFactoryTest1._mf_tipe, s );
    sv.put( ValueFactoryTest1._mf_x, value );
    S3 myS3 = (S3) vf.importCustomValue( sv );
    assertEquals( s, myS3.tipe );
    assertEquals( value, myS3.x );
 
View Full Code Here

 
  /** */
  @Test public void  testObjectStruct() {
    try
    {
      S3 a  = null;
      testServer.p_object_struct( a );
      testClient.p_object_struct( a );
    }
    catch ( UnsupportedOperationException e )
    {
View Full Code Here

  private static Object toArrayStruct(List<AccessControl> accessControlList) throws S3Exception {
    Array arr=new ArrayImpl();
    String type;
    Struct sct;
    AccessControl ac;
    Iterator<AccessControl> it = accessControlList.iterator();
    while(it.hasNext()){
      ac=it.next();
      arr.appendEL(sct=new StructImpl());
      sct.setEL(KeyConstants._id, ac.getId());
      sct.setEL(PERMISSION, ac.getPermission());
     
      type = AccessControl.toType(ac.getType());
      if("Group".equalsIgnoreCase(type))        
        setGroup(sct,ac);
      else if("CanonicalUser".equalsIgnoreCase(type))
        sct.setEL(DISPLAY_NAME, ac.getDisplayName());
      else
        sct.setEL(KeyConstants._email, ac.getId());
    }
    return arr;
  }
View Full Code Here

    }
  }

  public static String _call(PageContext pc , String url, Object objACL) throws PageException, IOException {
    S3Resource res=toS3Resource(pc,url,"StoreAddACL");
    AccessControlPolicy acp = res.getAccessControlPolicy();
   
    List<AccessControl> acl = acp.getAccessControlList();
    List<AccessControl> newACL = AccessControl.toAccessControlList(objACL);
   
    Iterator<AccessControl> it = newACL.iterator();
    while(it.hasNext()){
      acl.add(it.next());
View Full Code Here

    invoke(res, objACL);
    return null;
  }
 
  public static void invoke(S3Resource res, Object objACL) throws PageException, IOException {
    AccessControlPolicy acp = res.getAccessControlPolicy();
    List<AccessControl> acl = AccessControl.toAccessControlList(objACL);
    AccessControlPolicy.removeDuplicates(acl);
    acp.setAccessControlList(acl);
    res.setAccessControlPolicy(acp);
  }
View Full Code Here

 
  private static void setS3Attrs(Resource res,Object acl,int storage) throws PageException {
    String scheme = res.getResourceProvider().getScheme();
   
    if("s3".equalsIgnoreCase(scheme)){
      S3Resource s3r=(S3Resource) res;
      if(acl!=null){
        try {
          // old way
          if(Decision.isString(acl)) {
            if(Decision.isInteger(acl)) s3r.setACL(Caster.toIntValue(acl));
            else s3r.setACL(S3.toIntACL(Caster.toString(acl)));
          }
          // new way
          else {
            StoreSetACL.invoke(s3r, acl);
          }
        } catch (IOException e) {
          throw Caster.toPageException(e);
        }
      }
     
      if(storage!=S3Constants.STORAGE_UNKNOW) s3r.setStorage(storage);
    }
  }
View Full Code Here

TOP

Related Classes of railo.commons.io.res.type.s3.S3

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.