Changeset 1838
- Timestamp:
- 01/17/08 13:11:39
(1 year ago)
- Author:
- gboyst
- Message:
eclipse bloes
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r1470 |
r1838 |
|
| 12 | 12 | package com.tresys.framework.compiler; |
|---|
| 13 | 13 | |
|---|
| | 14 | import java.io.ByteArrayOutputStream; |
|---|
| 14 | 15 | import java.io.FileOutputStream; |
|---|
| 15 | 16 | import java.io.FileNotFoundException; |
|---|
| … | … | |
| 24 | 25 | import com.tresys.framework.compiler.policy.Policy; |
|---|
| 25 | 26 | import com.tresys.framework.compiler.systemResources.SystemResources; |
|---|
| 26 | | import com.tresys.framework.compiler.translator.Translator; |
|---|
| | 27 | import com.tresys.framework.compiler.translator.TranslatorSELinux; |
|---|
| 27 | 28 | |
|---|
| 28 | 29 | /** |
|---|
| … | … | |
| 247 | 248 | Linkage linkage = null; |
|---|
| 248 | 249 | // the translator |
|---|
| 249 | | Translator translator = null; |
|---|
| | 250 | TranslatorSELinux translator = null; |
|---|
| 250 | 251 | |
|---|
| 251 | 252 | dictSourceFilenames = new Vector/*<String>*/(); |
|---|
| … | … | |
| 357 | 358 | fcFile = new File(fcFilename); |
|---|
| 358 | 359 | |
|---|
| 359 | | translator = new Translator(policy, linkage, fcFile); |
|---|
| 360 | | |
|---|
| | 360 | translator = new TranslatorSELinux(policy, linkage, fcFile.getName()); |
|---|
| | 361 | policy.Accept(translator); |
|---|
| | 362 | |
|---|
| | 363 | final ByteArrayOutputStream teData = translator.GetPolicy(); |
|---|
| | 364 | final ByteArrayOutputStream ifData = translator.GetInterfaces(); |
|---|
| | 365 | final ByteArrayOutputStream fcData = translator.GetSytemResources (); |
|---|
| | 366 | |
|---|
| 361 | 367 | if(polOutputFilename != null) { |
|---|
| 362 | 368 | try { |
|---|
| … | … | |
| 382 | 388 | moduleName = moduleName.substring(slash + 1); |
|---|
| 383 | 389 | |
|---|
| 384 | | translator.TranslatePolicy(streamPolicy, moduleName); |
|---|
| | 390 | streamPolicy.append(teData.toString ()); |
|---|
| 385 | 391 | |
|---|
| 386 | 392 | if(ifFilename != null) { |
|---|
| … | … | |
| 397 | 403 | streamInterface = System.out; |
|---|
| 398 | 404 | } |
|---|
| 399 | | translator.TranslateInterface(streamInterface); |
|---|
| | 405 | streamPolicy.append (ifData.toString ()); |
|---|
| 400 | 406 | |
|---|
| 401 | 407 | if(fcOutputFilename != null) { |
|---|
| … | … | |
| 412 | 418 | streamFileContext = System.out; |
|---|
| 413 | 419 | } |
|---|
| 414 | | |
|---|
| 415 | | translator.TranslateSystemResources(streamFileContext, streamPolicy); |
|---|
| 416 | | |
|---|
| | 420 | streamFileContext.append(fcData.toString ()); |
|---|
| | 421 | |
|---|
| 417 | 422 | streamPolicy.flush(); |
|---|
| 418 | 423 | streamPolicy.close(); |
|---|
| … | … | |
| 425 | 430 | |
|---|
| 426 | 431 | // test for error conditions |
|---|
| 427 | | if(translator.ErrorEncountered) { |
|---|
| | 432 | if(translator.GetErrorState()) { |
|---|
| 428 | 433 | System.err.println("Errors encountered during translation!"); |
|---|
| 429 | 434 | if(polOutputFilename != null) { |
|---|
| r1837 |
r1838 |
|
| 105 | 105 | private TreeSet/*<String>*/dirPermSet = new TreeSet/*<String>*/(); |
|---|
| 106 | 106 | |
|---|
| 107 | | public TranslatorSELinux(Linkage _linkage, String _moduleName, Policy _policy) |
|---|
| | 107 | public TranslatorSELinux(Policy _policy, Linkage _linkage, String _moduleName) |
|---|
| 108 | 108 | { |
|---|
| 109 | 109 | super(); |
|---|
| … | … | |
| 642 | 642 | if(fileType == null) |
|---|
| 643 | 643 | { |
|---|
| 644 | | if(hasFileContext) |
|---|
| | 644 | if(!hasFileContext) |
|---|
| 645 | 645 | { |
|---|
| 646 | | Utility.ProjectError("Unable to determine file context for " |
|---|
| | 646 | Utility.ProjectError("ASDFASDFASDF#### Unable to determine file context for " |
|---|
| 647 | 647 | + file.toString() + ", try associating the parent directory with a CDSFramework component"); |
|---|
| 648 | 648 | errorEncountered = true; |
|---|
| r1837 |
r1838 |
|
| 512 | 512 | |
|---|
| 513 | 513 | // only pass in file contexts if we were able to load libselinux |
|---|
| 514 | | final TranslatorSELinux translatorSELinux = new TranslatorSELinux(getLinkage(), m_name, m_policy); |
|---|
| | 514 | final TranslatorSELinux translatorSELinux = new TranslatorSELinux(m_policy, getLinkage(), m_name); |
|---|
| 515 | 515 | |
|---|
| 516 | 516 | m_policy.Accept(translatorSELinux); |
|---|
Download in other formats:
* Generating other formats may take time.