Package org.ejbca.core.model.services

Examples of org.ejbca.core.model.services.ServiceConfiguration


      HashMap h = (HashMap) decoder.readObject();
      decoder.close();
      // Handle Base64 encoded string values
      HashMap data = new Base64GetHashMap(h);
      float oldversion = ((Float) data.get(UpgradeableDataHashMap.VERSION)).floatValue();
      ServiceConfiguration serviceConfiguration = new ServiceConfiguration();
      serviceConfiguration.loadData(data);
      if ( ((serviceConfiguration != null) && (Float.compare(oldversion, serviceConfiguration.getVersion()) != 0))) {
        // Upgrade in version 4 of ServiceConfiguration. If we do not have nextRunTimeStamp and runTimeStamp set in
        // the database, but we have them in serviceConfiguration, we will simply copy the values over.
        // After this we will not use the values in ServiceConfiguration any more
        final String NEXTRUNTIMESTAMP = "NEXTRUNTIMESTAMP";
        final String OLDRUNTIMESTAMP = "OLDRUNTIMESTAMP";
View Full Code Here


  /**
   * Method that populates a service configuration from a
   * GUI data.
   */
  public ServiceConfiguration getServiceConfiguration(ArrayList<String> errorMessages) throws IOException{
    ServiceConfiguration retval = new ServiceConfiguration();
    retval.setActive(isActive());
    retval.setHidden(isHidden());
    retval.setDescription(getDescription());
    retval.setActionClassPath(getActionType().getClassPath());
    retval.setActionProperties(getActionType().getProperties(errorMessages));
    retval.setIntervalClassPath(getIntervalType().getClassPath());
    retval.setIntervalProperties(getIntervalType().getProperties(errorMessages));
    retval.setWorkerClassPath(getWorkerType().getClassPath());
    retval.setWorkerProperties(getWorkerType().getProperties(errorMessages));
    retval.setPinToNodes(getPinToNodes());
    return retval;
  }
View Full Code Here

    List<SortableSelectItem> availableServices = new ArrayList<SortableSelectItem>();
      Collection<Integer> availableServicesIds = ejb.getServiceSession().getAuthorizedVisibleServiceIds(getAdmin());
      Iterator<Integer> iter = availableServicesIds.iterator();
      while (iter.hasNext()) {
        Integer id = (Integer) iter.next();
        ServiceConfiguration serviceConfig =  ejb.getServiceSession().getServiceConfiguration(getAdmin(), id.intValue());
        String serviceName = ejb.getServiceSession().getServiceName(getAdmin(), id.intValue());
        String hidden = "";
        if (serviceConfig.isHidden()) {
          hidden = "<Hidden, Debug mode>";
        }
        if (serviceConfig.isActive()) {
          availableServices.add(new SortableSelectItem(serviceName, serviceName+ " (" + EjbcaJSFHelper.getBean().getText().get("ACTIVE") + ")" + hidden));
        } else {
          availableServices.add(new SortableSelectItem(serviceName, serviceName + " (" + EjbcaJSFHelper.getBean().getText().get("INACTIVE") + ")" + hidden));
        }
      }
View Full Code Here

  public String editService(){
    String retval = "editservice";
    if(selectedServiceName != null){     
      try {
        getEditServiceBean().setServiceName(selectedServiceName);
        ServiceConfiguration serviceConf = ejb.getServiceSession().getService(getAdmin(), selectedServiceName);
        getEditServiceBean().setServiceConfiguration(serviceConf);
      } catch (IOException e) {
        addNonTranslatedErrorMessage((String) EjbcaJSFHelper.getBean().getText().get("ERROREDITINGSERVICE") + " " + e.getMessage());           
      }       
    }else{
View Full Code Here

      addErrorMessage("YOUHAVETOENTERASERVICE");
    }else if (errorInServiceName(newServiceName)) {
      addErrorMessage("THECHARACTERSARENTALLOWED");
    }else{     
      try {
        ServiceConfiguration serviceConfig = new ServiceConfiguration();     
        ejb.getServiceSession().addService(getAdmin(), newServiceName, serviceConfig);
        getEditServiceBean().setServiceConfiguration(serviceConfig);
        getEditServiceBean().setServiceName(newServiceName);
      } catch (ServiceExistsException e) {
        addNonTranslatedErrorMessage((String) EjbcaJSFHelper.getBean().getText().get("SERVICENAMEALREADYEXISTS"));
View Full Code Here

  private ServiceConfigurationView serviceConfigurationView;
  private String serviceName = "";

  public EditServiceManagedBean() {
        try {
      setServiceConfiguration(new ServiceConfiguration());
    } catch (IOException e) {
      log.error(e);
    }
  }
View Full Code Here

 
 
  public BaseWorkerType getBaseWorkerType() {
    String name = null;
    try {
      ServiceConfiguration conf = serviceConfigurationView.getServiceConfiguration(new ArrayList<String>());   
      String cp = conf.getWorkerClassPath();
      name = getTypeNameFromClassPath(cp);     
    } catch (IOException e) {
      log.error(e);
    }
    if (log.isDebugEnabled()) {
View Full Code Here

    @Override
    public void cloneService(Admin admin, String oldname, String newname) throws ServiceExistsException {
        if (log.isTraceEnabled()) {
            log.trace(">cloneService(name: " + oldname + ")");
        }
        ServiceConfiguration servicedata = null;
        ServiceData htp = serviceDataSession.findByName(oldname);
        if (htp == null) {
            String msg = "Error cloning service: No such service found.";
            log.error(msg);
            throw new EJBException(msg);
View Full Code Here

        try {
            ServiceData htp = serviceDataSession.findByName(name);
            if (htp == null) {
                throw new FinderException("Cannot find service " + name);
            }
            ServiceConfiguration serviceConfiguration = htp.getServiceConfiguration();
            if (isAuthorizedToEditService(admin, serviceConfiguration)) {
                IWorker worker = getWorker(serviceConfiguration, name, htp.getRunTimeStamp(), htp.getNextRunTimeStamp());
                if (worker != null) {
                    serviceSession.cancelTimer(htp.getId());
                }
View Full Code Here

    @Override
    public ServiceConfiguration getService(Admin admin, String name) {
        if (log.isTraceEnabled()) {
            log.trace(">getService: " + name);
        }
        ServiceConfiguration returnval = null;
        ServiceData serviceData = serviceDataSession.findByName(name);
        if (serviceData != null) {
            returnval = serviceData.getServiceConfiguration();
        }
        if (log.isTraceEnabled()) {
View Full Code Here

TOP

Related Classes of org.ejbca.core.model.services.ServiceConfiguration

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.