// Initialize the list of ReportModules
  private void initModules() {
    for (TableReportModule module : Lookup.getDefault().lookupAll(TableReportModule.class)) {
      tableModules.add(module);
      modules.add(module);
    }

    for (GeneralReportModule module : Lookup.getDefault().lookupAll(GeneralReportModule.class)) {
      generalModules.add(module);
      modules.add(module);
    }

    for (FileReportModule module : Lookup.getDefault().lookupAll(FileReportModule.class)) {
      fileModules.add(module);
      modules.add(module);
    }

    Collections.sort(
        modules,
        new Comparator<ReportModule>() {
          @Override
          public int compare(ReportModule rm1, ReportModule rm2) {
            return rm1.getName().compareTo(rm2.getName());
          }
        });

    modulesJList.getSelectionModel().addListSelectionListener(this);
    modulesJList.setCellRenderer(new ModuleCellRenderer());
    modulesJList.setListData(modules.toArray(new ReportModule[modules.size()]));
    selectedIndex = 0;
    modulesJList.setSelectedIndex(selectedIndex);
  }
 WsdlPolicyHandler(FileObject wsdl, Collection<Lookup> supportLookups) {
   delegates = new ArrayList<DefaultHandler>(supportLookups.size());
   for (Lookup lookup : supportLookups) {
     DefaultHandler handler = lookup.lookup(DefaultHandler.class);
     delegates.add(handler);
   }
 }
 public void annotate(Line.Set set, Lookup lookup) {
   final FileObject fo = lookup.lookup(FileObject.class);
   if (fo != null) {
     DataObject dobj = lookup.lookup(DataObject.class);
     if (dobj != null) {
       PropertyChangeListener pchl =
           new PropertyChangeListener() {
             /** annotate renamed files. */
             public void propertyChange(PropertyChangeEvent evt) {
               if (DataObject.PROP_PRIMARY_FILE.equals(evt.getPropertyName())) {
                 DataObject dobj = (DataObject) evt.getSource();
                 FileObject newFO = dobj.getPrimaryFile();
                 annotate(newFO);
               }
             }
           };
       dobj.addPropertyChangeListener(WeakListeners.propertyChange(pchl, dobj));
       synchronized (this) {
         if (dataObjectListeners == null) {
           dataObjectListeners = new HashSet<PropertyChangeListener>();
         }
         // Prevent from GC.
         dataObjectListeners.add(pchl);
       }
     }
     annotate(fo);
   }
 }
  @Override
  public void actionPerformed(PhpModule phpModule) {
    // Check CakePHP project
    if (!CakePhpUtils.isCakePHP(phpModule)) {
      return;
    }

    // get EditorCookie
    Lookup lookup = Utilities.actionsGlobalContext();
    EditorCookie context = lookup.lookup(EditorCookie.class);
    if (context == null) {
      return;
    }

    Document doc = context.getDocument();
    if (doc == null) {
      return;
    }

    reformat(doc);

    // Change line feed
    if (!BaseDocument.LS_LF.equals(doc.getProperty(BaseDocument.READ_LINE_SEPARATOR_PROP))) {
      doc.putProperty(BaseDocument.READ_LINE_SEPARATOR_PROP, BaseDocument.LS_LF);
    }
  }
  public void clusterize(final Clusterer clusterer) {
    // Get Graph
    GraphController gc = Lookup.getDefault().lookup(GraphController.class);
    final GraphModel graphModel = gc.getModel();

    // Model
    final ClusteringModel model =
        Lookup.getDefault()
            .lookup(ProjectController.class)
            .getCurrentWorkspace()
            .getLookup()
            .lookup(ClusteringModel.class);

    // LongTask
    LongTask task = null;
    if (clusterer instanceof LongTask) {
      task = (LongTask) clusterer;
    }
    executor.execute(
        task,
        new Runnable() {

          public void run() {
            model.setRunning(true);
            clusterer.execute(graphModel);
            writeColumns(clusterer);
            model.setRunning(false);
          }
        });
  }
  public EnterpriseCell() {

    this.enterpriseDAO = Lookup.getDefault().lookup(IEnterpriseBN.class);
    this.personDAO = Lookup.getDefault().lookup(IPersonBN.class);
    txtIdE = new JTextField();
    txtLogo = new JTextField();
    txtLogo.addMouseListener(this);
    txtNameE = new JTextField();
    txtSlogan = new JTextField();

    modelEnter = new DefaultComboBoxModel();
    modelEnter.addElement(" ");
    modelPerson = new DefaultComboBoxModel();
    modelPerson.addElement(" ");
    txtIdE.setText(" ");
    txtNameE.setText(" ");

    // Create model for combobox

    List<Enterprise> list = new ArrayList<Enterprise>();
    list = enterpriseDAO.getAllEnterprise();
    for (Enterprise bean : list) {
      modelEnter.addElement(bean);
    }

    List<Person> list1 = new ArrayList<Person>();
    list1 = personDAO.getAllPerson();
    for (Person bean : list1) {
      modelPerson.addElement(bean);
    }

    cboEnterprise = new JComboBox(modelEnter);
    cboPerson = new JComboBox(modelPerson);
  }
  public Export() {
    menu = new JMenu(NbBundle.getMessage(Export.class, "CTL_Export"));

    Lookup.getDefault()
        .lookup(ProjectController.class)
        .addWorkspaceListener(
            new WorkspaceListener() {

              public void initialize(Workspace workspace) {}

              public void select(Workspace workspace) {
                menu.setEnabled(true);
              }

              public void unselect(Workspace workspace) {}

              public void close(Workspace workspace) {}

              public void disable() {
                menu.setEnabled(false);
              }
            });
    boolean enabled =
        Lookup.getDefault().lookup(ProjectController.class).getCurrentWorkspace() != null;
    menu.setEnabled(enabled);
  }
 @Override
 public JComponent createComponent(ProjectCustomizer.Category category, Lookup context) {
   jwsProps = new ProjectExtensionProperties(context.lookup(Project.class), keyList);
   DesktopExeCustomizerPanel panel = new DesktopExeCustomizerPanel(jwsProps);
   category.setStoreListener(new SavePropsListener(jwsProps, context.lookup(Project.class)));
   category.setOkButtonListener(panel);
   return panel;
 }
 private void executeInjection() {
   if (this.modello == null) {
     this.modello = Lookup.getDefault().lookup(Modello.class);
   }
   if (this.vista == null) {
     this.vista = Lookup.getDefault().lookup(Vista.class);
   }
 }
Beispiel #10
0
 @Override
 public void actionPerformed(ActionEvent e) {
   Lookup lookup =
       WindowManager.getDefault().findTopComponent("SimpleChatWindowTopComponent").getLookup();
   XMPPMessenger messenger = lookup.lookup(XMPPMessenger.class);
   if (messenger.isLoggedIn()) {
     messenger.logout();
   }
 }
 public ClojureEditorKit(String mimetype) {
   super();
   this.MIME_TYPE = mimetype;
   if (MIME_TYPE.equals("text/x-clojure")) {
     Lookup l = MimeLookup.getLookup(MimePath.get("text/x-clojure"));
     Preferences p = l.lookup(Preferences.class);
     p.put(SimpleValueNames.CODE_FOLDING_ENABLE, Boolean.TRUE.toString());
   }
 }
  public static synchronized JContextTree getContextTree() {
    if (tree == null) {
      final JContextTree tree = new JContextTree();

      // search available popup menu items
      Lookup lk = Lookups.forPath("/Puzzle/ContextTree/Actions");
      for (TreePopupItem item : lk.lookupAll(TreePopupItem.class)) {
        tree.controls().add(item);
      }

      final List<PropertyPane> configPanes = new ArrayList<PropertyPane>();

      JPropertyTree propertyTree = new JPropertyTree();

      DefaultMutableTreeNode root = new DefaultMutableTreeNode();

      // search available property panels
      lk = Lookups.forPath("/Puzzle/ContextTree/PropertyPanels");
      for (PropertyPane p : lk.lookupAll(PropertyPane.class)) {
        root.add(new DefaultMutableTreeNode(p));
      }

      // search filter panels
      DefaultMutableTreeNode filterNodes =
          new DefaultMutableTreeNode(CoreResource.getString("filter"));
      lk = Lookups.forPath("/Puzzle/ContextTree/FilterPanels");
      for (PropertyPane p : lk.lookupAll(PropertyPane.class)) {
        filterNodes.add(new DefaultMutableTreeNode(p));
      }
      root.add(filterNodes);

      // search style panels
      DefaultMutableTreeNode styleNodes =
          new DefaultMutableTreeNode(CoreResource.getString("symbology"));
      lk = Lookups.forPath("/Puzzle/ContextTree/StylePanels");
      for (PropertyPane p : lk.lookupAll(PropertyPane.class)) {
        styleNodes.add(new DefaultMutableTreeNode(p));
      }
      root.add(styleNodes);

      if (!tree.controls().isEmpty()) {
        tree.controls().add(new SeparatorItem());
      }

      LayerPropertyItem property = new LayerPropertyItem(root);
      tree.controls().add(property);

      tree.revalidate();
      tree.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
      ContextTreeTopComponent.tree = tree;
    }
    return tree;
  }
Beispiel #13
0
  public TimelineControllerImpl() {
    listeners = new ArrayList<TimelineModelListener>();

    // Workspace events
    ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
    dynamicController = Lookup.getDefault().lookup(DynamicController.class);

    pc.addWorkspaceListener(
        new WorkspaceListener() {

          @Override
          public void initialize(Workspace workspace) {}

          @Override
          public void select(Workspace workspace) {
            model = workspace.getLookup().lookup(TimelineModelImpl.class);
            if (model == null) {
              model = new TimelineModelImpl(dynamicController.getModel(workspace));
              workspace.add(model);
            }
            attributeModel =
                Lookup.getDefault().lookup(AttributeController.class).getModel(workspace);
            setup();
          }

          @Override
          public void unselect(Workspace workspace) {
            unsetup();
          }

          @Override
          public void close(Workspace workspace) {}

          @Override
          public void disable() {
            model = null;
            attributeModel = null;
            fireTimelineModelEvent(
                new TimelineModelEvent(TimelineModelEvent.EventType.MODEL, null, null));
          }
        });

    if (pc.getCurrentWorkspace() != null) {
      model = pc.getCurrentWorkspace().getLookup().lookup(TimelineModelImpl.class);
      if (model == null) {
        model = new TimelineModelImpl(dynamicController.getModel(pc.getCurrentWorkspace()));
        pc.getCurrentWorkspace().add(model);
      }
      attributeModel =
          Lookup.getDefault().lookup(AttributeController.class).getModel(pc.getCurrentWorkspace());
      setup();
    }
  }
  public void script() {
    // Init a project - and therefore a workspace
    ProjectController pc = Lookup.getDefault().lookup(ProjectController.class);
    pc.newProject();
    Workspace workspace = pc.getCurrentWorkspace();

    // Get controllers and models
    ImportController importController = Lookup.getDefault().lookup(ImportController.class);

    // Import file
    Container container;
    try {
      File file =
          new File(
              getClass().getResource("/org/gephi/toolkit/demos/resources/polblogs.gml").toURI());
      container = importController.importFile(file);
      container.getLoader().setEdgeDefault(EdgeDefault.DIRECTED); // Force DIRECTED
      container.setAllowAutoNode(false); // Don't create missing nodes
    } catch (Exception ex) {
      ex.printStackTrace();
      return;
    }

    // Append imported data to GraphAPI
    importController.process(container, new DefaultProcessor(), workspace);

    // List node columns
    AttributeController ac = Lookup.getDefault().lookup(AttributeController.class);
    AttributeModel model = ac.getModel();
    for (AttributeColumn col : model.getNodeTable().getColumns()) {
      System.out.println(col);
    }

    // Add boolean column
    AttributeColumn testCol = model.getNodeTable().addColumn("test", AttributeType.BOOLEAN);

    // Write values to nodes
    GraphModel graphModel = Lookup.getDefault().lookup(GraphController.class).getModel();
    for (Node n : graphModel.getGraph().getNodes()) {
      n.getNodeData().getAttributes().setValue(testCol.getIndex(), Boolean.TRUE);
    }

    // Iterate values - fastest
    AttributeColumn sourceCol = model.getNodeTable().getColumn("source");
    for (Node n : graphModel.getGraph().getNodes()) {
      System.out.println(n.getNodeData().getAttributes().getValue(sourceCol.getIndex()));
    }

    // Iterate values - normal
    for (Node n : graphModel.getGraph().getNodes()) {
      System.out.println(n.getNodeData().getAttributes().getValue("source"));
    }
  }
  public ReplTopComponent(String replName, ReplPanel replPanel) {
    _projectName = replName;

    initComponents();
    setName(getBundleProperty("CTL_ReplTopComponent", _projectName));
    setToolTipText(getBundleProperty("HINT_ReplTopComponent", _projectName));
    setIcon(ImageUtilities.loadImage(ICON_PATH, true));
    Lookup l = MimeLookup.getLookup(MimePath.get("text/x-clojure"));
    Preferences p = l.lookup(Preferences.class);
    p.put(SimpleValueNames.CODE_FOLDING_ENABLE, "true");
    // Create project repl
    this._replPanel = replPanel; // ??new ReplPanel(special);
    // ??_replPanel.setName("replPanel" + projectName);
    jScrollPane1.setViewportView(_replPanel);
  }
  @Override
  public void restored() {
    final Result<Pipe> result = Lookup.getDefault().lookupResult(Pipe.class);
    Lookup.getDefault().lookup(ConfigurationManager.class);
    Lookup.getDefault().lookup(ConfigurationManagerImpl.class).buildPipe(result.allInstances());

    result.addLookupListener(
        new LookupListener() {
          public void resultChanged(LookupEvent le) {
            Lookup.getDefault()
                .lookup(ConfigurationManagerImpl.class)
                .buildPipe(result.allInstances());
          }
        });
  }
  public AttributeControllerImpl() {
    projectController = Lookup.getDefault().lookup(ProjectController.class);
    projectController.addWorkspaceListener(
        new WorkspaceListener() {

          public void initialize(Workspace workspace) {
            AttributeModel m = workspace.getLookup().lookup(AttributeModel.class);
            if (m == null) {
              workspace.add(new IndexedAttributeModel());
            }
          }

          public void select(Workspace workspace) {}

          public void unselect(Workspace workspace) {}

          public void close(Workspace workspace) {}

          public void disable() {}
        });
    if (projectController.getCurrentProject() != null) {
      for (Workspace workspace :
          projectController
              .getCurrentProject()
              .getLookup()
              .lookup(WorkspaceProvider.class)
              .getWorkspaces()) {
        AttributeModel m = workspace.getLookup().lookup(AttributeModel.class);
        if (m == null) {
          workspace.add(new IndexedAttributeModel());
        }
      }
    }
  }
Beispiel #18
0
  /** Creates new form RendererManagerPanel */
  public RendererManager() {
    initComponents();
    buildTooltip();

    if (UIUtils.isAquaLookAndFeel()) {
      panel.setBackground(UIManager.getColor("NbExplorerView.background"));
    }
    if (UIUtils.isAquaLookAndFeel()) {
      toolBar.setBackground(UIManager.getColor("NbExplorerView.background"));
    }

    previewController = Lookup.getDefault().lookup(PreviewController.class);
    Lookup.getDefault().lookup(PreviewUIController.class).addPropertyChangeListener(this);
    panel.setLayout(new MigLayout("insets 3", "[pref!]"));
    setup();
  }
  public void testHttpOpenHandler() throws MalformedURLException {
    LineConvertor convertor = LineConvertors.httpUrl();

    List<ConvertedLine> lines = new ArrayList<ConvertedLine>();
    assertNull(convertor.convert("nourl1"));
    lines.addAll(convertor.convert("NetBeans site: http://www.netbeans.org"));
    lines.addAll(convertor.convert("https://www.netbeans.org"));

    assertEquals(2, lines.size());
    assertEquals("NetBeans site: http://www.netbeans.org", lines.get(0).getText());
    assertEquals("https://www.netbeans.org", lines.get(1).getText());

    for (ConvertedLine line : lines) {
      assertNotNull(line.getListener());
      line.getListener().outputLineAction(null);
    }

    HttpOpenHandler handler = Lookup.getDefault().lookup(HttpOpenHandler.class);
    assertTrue(handler instanceof TestHttpOpenHandler);

    List<URL> opened = ((TestHttpOpenHandler) handler).getOpened();
    assertEquals(2, opened.size());
    assertEquals(new URL("http://www.netbeans.org"), opened.get(0));
    assertEquals(new URL("https://www.netbeans.org"), opened.get(1));
  }
  public void testTwoPlatformsoverSameSDK() throws Exception {
    final File binDir = new File(getWorkDir(), "boot"); // NOI18N
    binDir.mkdir();
    final File jdocFile1 = new File(getWorkDir(), "jdoc1"); // NOI18N
    jdocFile1.mkdir();
    final File jdocFile2 = new File(getWorkDir(), "jdoc2"); // NOI18N
    jdocFile2.mkdir();
    JavaPlatformProviderImpl provider = Lookup.getDefault().lookup(JavaPlatformProviderImpl.class);
    final URL binRoot = Utilities.toURI(binDir).toURL();
    final ClassPath bootCp = ClassPathSupport.createClassPath(binRoot);
    final List<URL> javadoc1 = Collections.singletonList(Utilities.toURI(jdocFile1).toURL());
    final List<URL> javadoc2 = Collections.singletonList(Utilities.toURI(jdocFile2).toURL());
    final TestJavaPlatform platform1 = new TestJavaPlatform("platform1", bootCp); // NOI18N
    final TestJavaPlatform platform2 = new TestJavaPlatform("platform2", bootCp); // NOI18N
    platform2.setJavadoc(javadoc2);
    provider.addPlatform(platform1);
    provider.addPlatform(platform2);

    final JavadocForBinaryQuery.Result result1 = JavadocForBinaryQuery.findJavadoc(binRoot);
    assertEquals(javadoc2, Arrays.asList(result1.getRoots()));

    platform1.setJavadoc(javadoc1);
    assertEquals(javadoc1, Arrays.asList(result1.getRoots()));

    final JavadocForBinaryQuery.Result result2 = JavadocForBinaryQuery.findJavadoc(binRoot);
    assertEquals(javadoc1, Arrays.asList(result2.getRoots()));

    platform1.setJavadoc(Collections.<URL>emptyList());
    assertEquals(javadoc2, Arrays.asList(result1.getRoots()));
    assertEquals(javadoc2, Arrays.asList(result2.getRoots()));
  }
  private static void rescheduleImpl(FileObject file) {
    LazyHintComputationFactory f = Lookup.getDefault().lookup(LazyHintComputationFactory.class);

    if (f != null) {
      f.reschedule(file);
    }
  }
Beispiel #22
0
 /**
  * Retrieve the RuntimeFactory instance, creating one if necessary.
  *
  * @return RuntimeFactory instance.
  */
 public static synchronized RuntimeFactory getRuntimeFactory() {
   if (rtFactory == null) {
     // Perform lookup to find a RuntimeFactory instance.
     rtFactory = Lookup.getDefault().lookup(RuntimeFactory.class);
   }
   return rtFactory;
 }
 public void addFormEditID(double i, String str) {
   Collection<? extends HelpTutorialDepartment> allSave =
       Lookup.getDefault().lookupAll(HelpTutorialDepartment.class);
   for (HelpTutorialDepartment editCookie : allSave) {
     editCookie.getTutorial(i, str);
   }
 }
  private RankingTopComponent() {
    setName(NbBundle.getMessage(RankingTopComponent.class, "CTL_RankingTopComponent"));
    //        setToolTipText(NbBundle.getMessage(RankingTopComponent.class,
    // "HINT_RankingTopComponent"));
    setIcon(ImageUtilities.loadImage(ICON_PATH));

    modelChangeListener =
        new ChangeListener() {

          public void stateChanged(ChangeEvent ce) {
            refreshModel(ce == null ? null : (RankingUIModel) ce.getSource());
          }
        };
    controller = Lookup.getDefault().lookup(RankingUIController.class);
    controller.setModelChangeListener(modelChangeListener);
    model = controller.getModel();

    initComponents();
    initSouth();
    if (UIUtils.isAquaLookAndFeel()) {
      mainPanel.setBackground(UIManager.getColor("NbExplorerView.background"));
    }

    refreshModel(model);
  }
 public static final void updateBlockChain(final NbEditorDocument doc) {
   if (doc == null) return;
   final Project p = J2MEProjectUtils.getProjectForDocument(doc);
   // TODO J2MEProject?
   if (p != null && p instanceof J2MEProject) {
     final ProjectConfigurationsHelper configHelper =
         p.getLookup().lookup(ProjectConfigurationsHelper.class);
     if (configHelper == null || !configHelper.isPreprocessorOn()) return;
     final HashMap<String, String> activeIdentifiers =
         new HashMap<String, String>(configHelper.getActiveAbilities());
     activeIdentifiers.put(configHelper.getActiveConfiguration().getDisplayName(), null);
     try {
       J2MEProjectUtilitiesProvider utilProvider =
           Lookup.getDefault().lookup(J2MEProjectUtilitiesProvider.class);
       if (utilProvider == null)
         return; // we do not run in full NetBeans, but this should not happen here (no editor)
       final CommentingPreProcessor cpp =
           new CommentingPreProcessor(
               utilProvider.createPPDocumentSource((NbEditorDocument) doc),
               null,
               activeIdentifiers);
       cpp.run();
       setLineInfo(doc, cpp.getLines(), cpp.getBlockList());
     } catch (PreprocessorException e) {
       ErrorManager.getDefault().notify(e);
     }
   }
 }
  /**
   * Simulates deadlock issue 133616 - create MultiFileSystem - create lookup to set our
   * MultiFileSystem and system filesystem - create handler to manage threads - put test FileObject
   * to 'potentialLock' set - call hasLocks - it call LocalFileSystemEx.getInvalid which ends in our
   * DeadlockHandler - it starts lockingThread which calls FileObject.lock which locks our
   * FileObject - when we in LocalFileSystemEx.lock, we notify main thread which continues in
   * getInvalid and tries to accuire lock on FileObject and it dead locks
   */
  public void testLocalFileSystemEx133616() throws Exception {
    System.setProperty("workdir", getWorkDirPath());
    clearWorkDir();

    FileSystem lfs =
        TestUtilHid.createLocalFileSystem("mfs1" + getName(), new String[] {"/fold/file1"});
    LocalFileSystemEx exfs = new LocalFileSystemEx();
    exfs.setRootDirectory(FileUtil.toFile(lfs.getRoot()));
    FileSystem xfs = TestUtilHid.createXMLFileSystem(getName(), new String[] {});
    FileSystem mfs = new MultiFileSystem(exfs, xfs);
    testedFS = mfs;
    System.setProperty(
        "org.openide.util.Lookup", LocalFileSystemEx133616Test.class.getName() + "$Lkp");
    Lookup l = Lookup.getDefault();
    if (!(l instanceof Lkp)) {
      fail("Wrong lookup: " + l);
    }

    final FileObject file1FO = mfs.findResource("/fold/file1");
    File file1File = FileUtil.toFile(file1FO);

    Logger.getLogger(LocalFileSystemEx.class.getName()).setLevel(Level.FINEST);
    Logger.getLogger(LocalFileSystemEx.class.getName()).addHandler(new DeadlockHandler(file1FO));
    LocalFileSystemEx.potentialLock(file1FO.getPath());
    LocalFileSystemEx.hasLocks();
  }
Beispiel #27
0
  /**
   * Checks if the Jboss installation has installed remote management package
   *
   * @return is remote management supported
   */
  public static boolean isRemoteManagementSupported(Lookup lookup) {
    JBDeploymentManager dm = lookup.lookup(JBDeploymentManager.class);
    if (dm == null) {
      return false;
    }
    try {
      dm.invokeRemoteAction(
          new JBRemoteAction<Boolean>() {

            @Override
            public Boolean action(
                MBeanServerConnection connection, JBoss5ProfileServiceProxy profileService)
                throws Exception {
              // FIXME is this refletion needed
              ObjectName searchPattern = new ObjectName("jboss.management.local:*");
              Method method =
                  connection
                      .getClass()
                      .getMethod("queryMBeans", new Class[] {ObjectName.class, QueryExp.class});
              method = fixJava4071957(method);
              Set managedObj = (Set) method.invoke(connection, new Object[] {searchPattern, null});

              return !managedObj.isEmpty();
            }
          });
    } catch (ExecutionException ex) {
      LOGGER.log(Level.INFO, null, ex);
    }

    return true;
  }
  void chosePolicy() {
    if (support == null) {
      return;
    }

    Collection<? extends JaxWsPoliciesCodeGenerator> generators =
        Lookup.getDefault().lookupAll(JaxWsPoliciesCodeGenerator.class);
    JaxWsPoliciesCodeGenerator policyGenerator = null;
    for (JaxWsPoliciesCodeGenerator gen : generators) {
      if (gen.isApplicable(policyIds, support.getPlatform(), getLocalWsdl())) {
        policyGenerator = gen;
        break;
      }
    }
    if (policyGenerator == null) {
      return;
    }

    List<String> clientPolicyIds = support.getClientPolicyIds();
    StringBuilder builder = new StringBuilder();
    String clientPolicyId = null;
    if (policyIds.isEmpty()) {
      clientPolicyId = choosePolicyId(clientPolicyIds);
      if (clientPolicyId == null) {
        return;
      }
      policyIds = Collections.singleton(clientPolicyId);
    }

    generator = policyGenerator;
    importFqns = policyGenerator.getRequiredClasses(chosenId);
    support.extendsProjectClasspath(getPorject(), importFqns);
    chosenId = policyGenerator.generatePolicyAccessCode(policyIds, client, builder);
    optionalCode = builder.toString();
  }
Beispiel #29
0
 /**
  * Retrieve the PathManager instance for the given Session, creating one if necessary.
  *
  * @param session Session for which to get PathManager.
  * @return path manager instance.
  */
 public static PathManager getPathManager(Session session) {
   synchronized (mapsLock) {
     PathManager inst = instanceMap.get(session);
     if (inst == null) {
       // Perform lookup to find a PathManager instance.
       PathManager prototype = Lookup.getDefault().lookup(PathManager.class);
       // Using this prototype, construct a new instance for the
       // given Session, rather than sharing the single instance.
       Class<? extends PathManager> protoClass = prototype.getClass();
       try {
         inst = protoClass.newInstance();
       } catch (InstantiationException ie) {
         logger.log(Level.SEVERE, null, ie);
         return null;
       } catch (IllegalAccessException iae) {
         logger.log(Level.SEVERE, null, iae);
         return null;
       }
       instanceMap.put(session, inst);
       reverseMap.put(inst, session);
       if (inst instanceof SessionListener) {
         session.addSessionListener((SessionListener) inst);
       }
     }
     return inst;
   }
 }
 public void select() {
   AttributeController attributeController = Lookup.getDefault().lookup(AttributeController.class);
   attributeController.getModel(workspace).addAttributeListener(this);
   if (!autoRankings.isEmpty()) {
     autoTransformer.start();
   }
 }