当前位置: 首页>>代码示例>>Java>>正文


Java IMetadataDomainRepository类代码示例

本文整理汇总了Java中org.pentaho.metadata.repository.IMetadataDomainRepository的典型用法代码示例。如果您正苦于以下问题:Java IMetadataDomainRepository类的具体用法?Java IMetadataDomainRepository怎么用?Java IMetadataDomainRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IMetadataDomainRepository类属于org.pentaho.metadata.repository包,在下文中一共展示了IMetadataDomainRepository类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fromXML

import org.pentaho.metadata.repository.IMetadataDomainRepository; //导入依赖的package包/类
public Query fromXML( IMetadataDomainRepository repo, String XML ) throws PentahoMetadataException {
  if ( XML == null ) {
    throw new PentahoMetadataException( Messages.getErrorString( "QueryXmlHelper.ERROR_0008_XML_NULL" ) ); //$NON-NLS-1$
  }
  Document doc;

  // Check and open XML document
  try {
    DocumentBuilderFactory dbf = XmiParser.createSecureDocBuilderFactory();
    DocumentBuilder db = dbf.newDocumentBuilder();
    doc = db.parse( new InputSource( new java.io.StringReader( XML ) ) );
  } catch ( ParserConfigurationException pcx ) {
    throw new PentahoMetadataException( pcx );
  } catch ( SAXException sex ) {
    throw new PentahoMetadataException( sex );
  } catch ( IOException iex ) {
    throw new PentahoMetadataException( iex );
  }
  return fromXML( repo, doc );
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:21,代码来源:QueryXmlHelper.java

示例2: exceptionThrown_WhenParsingXmlWith_BigNumberOfExternalEntities

import org.pentaho.metadata.repository.IMetadataDomainRepository; //导入依赖的package包/类
@Test( expected = PentahoMetadataException.class )
public void exceptionThrown_WhenParsingXmlWith_BigNumberOfExternalEntities() throws Exception {
  /**
   * @see  <a href="https://en.wikipedia.org/wiki/Billion_laughs" />
   */
  final String maliciousXml =
    "<?xml version=\"1.0\"?>\n"
      + "<!DOCTYPE lolz [\n"
      + " <!ENTITY lol \"lol\">\n"
      + " <!ELEMENT lolz (#PCDATA)>\n"
      + " <!ENTITY lol1 \"&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;&lol;\">\n"
      + " <!ENTITY lol2 \"&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;&lol1;\">\n"
      + " <!ENTITY lol3 \"&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;&lol2;\">\n"
      + " <!ENTITY lol4 \"&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;&lol3;\">\n"
      + " <!ENTITY lol5 \"&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;&lol4;\">\n"
      + " <!ENTITY lol6 \"&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;&lol5;\">\n"
      + " <!ENTITY lol7 \"&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;&lol6;\">\n"
      + " <!ENTITY lol8 \"&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;&lol7;\">\n"
      + " <!ENTITY lol9 \"&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;&lol8;\">\n"
      + "]>\n"
      + "<lolz>&lol9;</lolz>";

  helper.fromXML( mock( IMetadataDomainRepository.class ), maliciousXml );
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:25,代码来源:QueryXmlHelperTest.java

示例3: generateSql

import org.pentaho.metadata.repository.IMetadataDomainRepository; //导入依赖的package包/类
/**
 * Generates SQl for the specified query, locale and metadata.
 * @param query
 *        The query to generate SQL for.
 * @param locale
 *        The locale to be used during query generation.
 * @param repo
 *        Metadata repository.
 * @param databaseMeta
 *        Database metadata.
 * @param parameters
 *        Parameters to be used during query generation.
 * @param genAsPreparedStatement
 *        Forces the method generate query as prepared statement.
 * @return Generated query model.
 * @throws PentahoMetadataException
 */
public MappedQuery generateSql( Query query, String locale, IMetadataDomainRepository repo,
    DatabaseMeta databaseMeta, Map<String, Object> parameters, boolean genAsPreparedStatement )
  throws PentahoMetadataException {

  Constraint securityConstraint = null;

  if ( repo != null ) {
    String mqlSecurityConstraint = repo.generateRowLevelSecurityConstraint( query.getLogicalModel() );
    if ( StringUtils.isNotBlank( mqlSecurityConstraint ) ) {
      securityConstraint = new Constraint( CombinationType.AND, mqlSecurityConstraint );
    }
  }

  // resolve any missing parameters with default values
  if ( parameters == null && query.getParameters().size() > 0 ) {
    parameters = new HashMap<String, Object>();
  }
  for ( Parameter param : query.getParameters() ) {
    if ( !parameters.containsKey( param.getName() ) ) {
      parameters.put( param.getName(), param.getDefaultValue() );
    }
  }

  return getSQL( query.getLogicalModel(), query.getSelections(), query.getConstraints(), query.getOrders(),
      databaseMeta, locale, parameters, genAsPreparedStatement, query.getDisableDistinct(), query.getLimit(),
      securityConstraint );
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:45,代码来源:SqlGenerator.java

示例4: MQLEditorServiceDelegate

import org.pentaho.metadata.repository.IMetadataDomainRepository; //导入依赖的package包/类
public MQLEditorServiceDelegate( IMetadataDomainRepository domainRepository ) {
  this.domainRepository = domainRepository;

  for ( String id : domainRepository.getDomainIds() ) {
    if ( !domains.containsKey( id ) ) {
      // add the domain
      addThinDomain( id );
    }
  }
}
 
开发者ID:pentaho,项目名称:mql-editor,代码行数:11,代码来源:MQLEditorServiceDelegate.java

示例5: getMetadataDomainRepository

import org.pentaho.metadata.repository.IMetadataDomainRepository; //导入依赖的package包/类
public IMetadataDomainRepository getMetadataDomainRepository() {
  return metadataDomainRepository;
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:4,代码来源:BaseMetadataQueryExec.java

示例6: setMetadataDomainRepository

import org.pentaho.metadata.repository.IMetadataDomainRepository; //导入依赖的package包/类
public void setMetadataDomainRepository( IMetadataDomainRepository metadataDomainRepository ) {
  this.metadataDomainRepository = metadataDomainRepository;
}
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:4,代码来源:BaseMetadataQueryExec.java

示例7: AbstractMqlEditor

import org.pentaho.metadata.repository.IMetadataDomainRepository; //导入依赖的package包/类
public AbstractMqlEditor( Window parent, IMetadataDomainRepository repo ) {
  parentWindow = parent;
  init();
  setService( new MQLEditorServiceImpl( repo ) );
}
 
开发者ID:pentaho,项目名称:mql-editor,代码行数:6,代码来源:AbstractMqlEditor.java

示例8: SwingMqlEditor

import org.pentaho.metadata.repository.IMetadataDomainRepository; //导入依赖的package包/类
public SwingMqlEditor( Window parent, IMetadataDomainRepository repo ) {
  super( parent, repo );
}
 
开发者ID:pentaho,项目名称:mql-editor,代码行数:4,代码来源:SwingMqlEditor.java

示例9: SwtMqlEditor

import org.pentaho.metadata.repository.IMetadataDomainRepository; //导入依赖的package包/类
public SwtMqlEditor( Window parent, IMetadataDomainRepository repo ) {
  super( parent, repo );
}
 
开发者ID:pentaho,项目名称:mql-editor,代码行数:4,代码来源:SwtMqlEditor.java

示例10: MQLEditorServiceImpl

import org.pentaho.metadata.repository.IMetadataDomainRepository; //导入依赖的package包/类
public MQLEditorServiceImpl( IMetadataDomainRepository repo ) {
  delegate = new MQLEditorServiceDelegate( repo );
}
 
开发者ID:pentaho,项目名称:mql-editor,代码行数:4,代码来源:MQLEditorServiceImpl.java

示例11: testConcurrency

import org.pentaho.metadata.repository.IMetadataDomainRepository; //导入依赖的package包/类
@Test( timeout = 5000 )
public void testConcurrency() throws Exception {
  String domainIdPrefix = "id";
  int repoSize = 100;
  //init repo
  IMetadataDomainRepository repo = new InMemoryMetadataDomainRepository();
  for ( int i = 0; i < repoSize; i++ ) {
    Domain domain = new Domain();
    LocalizedString name = new LocalizedString();
    name.setString( "US", String.valueOf( i + 1 ) );
    domain.setId( domainIdPrefix + String.valueOf( i + 1 ) );
    domain.setName( name );
    repo.storeDomain( domain, false );
  }

  MQLEditorServiceDelegate service = new MQLEditorServiceDelegate( repo );

  int poolSize = repoSize / 2;
  ExecutorService executorService = Executors.newFixedThreadPool( poolSize );

  List<Future<Boolean>> results = new ArrayList<>();
  for ( int i = 0; i < poolSize; i++ ) {
    results.add( executorService.submit( new Callable<Boolean>() {
      public Boolean call() throws Exception {
        for ( int i = 0; i < repoSize; i++ ) {
          try {
            String id = domainIdPrefix + String.valueOf( i + 1 );
            service.getDomainByName( id );
            service.addThinDomain( id );
          } catch ( Exception e ) {
            return false;
          }
        }
        return true;
      }
    } ) );
  }
  for ( Future<Boolean> result : results ) {
    Assert.assertTrue( result.get() );
  }
  executorService.shutdown();
}
 
开发者ID:pentaho,项目名称:mql-editor,代码行数:43,代码来源:MQLEditorServiceDelegateTest.java

示例12: getDomainRepo

import org.pentaho.metadata.repository.IMetadataDomainRepository; //导入依赖的package包/类
private IMetadataDomainRepository getDomainRepo() throws ReportDataFactoryException {

      IPmdConnectionProvider connectionProvider = ((PmdDataFactory) getEditorModel().getReportDefinition().getDataFactory()).getConnectionProvider();
      IMetadataDomainRepository repo = connectionProvider.getMetadataDomainRepository(DEFAULT, getEditorModel().getReportDefinition().getResourceManager(), getEditorModel().getReportDefinition().getContentBase(), df.getXmiFile());
      
      return repo;
    }
 
开发者ID:pentaho,项目名称:pdi-agile-bi-plugin,代码行数:8,代码来源:DataSourceAndQueryStep.java

示例13: setMetadataDomainRepository

import org.pentaho.metadata.repository.IMetadataDomainRepository; //导入依赖的package包/类
/**
 * Sets the repository that the metadata model is stored in
 * 
 * @param repo
 */
public void setMetadataDomainRepository( IMetadataDomainRepository repo );
 
开发者ID:pentaho,项目名称:pentaho-metadata,代码行数:7,代码来源:IMetadataQueryExec.java


注:本文中的org.pentaho.metadata.repository.IMetadataDomainRepository类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。