public boolean equals(Object o) { if (!(o instanceof SignerWrapper)) return false; SignerWrapper other = (SignerWrapper) o; ApplicationDescriptor matchAppDesc = appDesc != null ? appDesc : other.appDesc; String matchPattern = appDesc != null ? other.pattern : pattern; return matchAppDesc.matchDNChain(matchPattern); } }
/** * Unsets the lock state of the application. * * @throws SecurityException if the caller doesn't have "lock" * ApplicationAdminPermission for the application. * @throws IllegalStateException if the application descriptor is * unregistered */ public final void unlock() { try { delegate.unlock(); } catch (SecurityException se) { isLaunchableSpecific(); /* check whether the bundle was uninstalled */ /* if yes, throws IllegalStateException */ throw se; /* otherwise throw the catched SecurityException */ } unlockSpecific(); }
/** * Sets the lock state of the application. If an application is locked then * launching a new instance is not possible. It does not affect the already * launched instances. * * @throws SecurityException if the caller doesn't have "lock" * ApplicationAdminPermission for the application. * @throws IllegalStateException if the application descriptor is * unregistered */ public final void lock() { try { delegate.lock(); } catch (SecurityException se) { isLaunchableSpecific(); /* check whether the bundle was uninstalled */ /* if yes, throws IllegalStateException */ throw se; /* otherwise throw the catched SecurityException */ } lockSpecific(); }
delegate.launch(arguments); } catch (SecurityException se) { isLaunchableSpecific(); /* check whether the bundle was uninstalled */ if (!isLaunchableSpecific()) throw new ApplicationException(ApplicationException.APPLICATION_NOT_LAUNCHABLE, "Cannot launch the application!"); try { return launchSpecific(arguments); } catch (IllegalStateException ise) { throw ise; throw ae; } catch (Exception t) { throw new ApplicationException(ApplicationException.APPLICATION_INTERNAL_ERROR, t);
Map props = getPropertiesSpecific(locale); boolean isLocked = delegate.isLocked(); // the real locking state Boolean containerLocked = (Boolean) props.remove(APPLICATION_LOCKED); if (containerLocked != null && containerLocked.booleanValue() != isLocked) { try { if (isLocked) /* if the container's information is not correct */ lockSpecific(); /* unlockSpecific(); } catch (Exception e) {
delegate.destroy(); } catch (SecurityException se) { descriptor.isLaunchableSpecific(); /* destroySpecific();
return false; /* it cannot be, this might be a bug */ if (!other.applicationID.equals(other.applicationDescriptor.getApplicationId())) return false; } else { Hashtable props = new Hashtable(); props.put("pid", other.applicationDescriptor.getApplicationId()); props.put("signer", new SignerWrapper(other.applicationDescriptor)); Filter flt = getFilter(); if (flt == null) return false;
/** * This contructor should be used when creating * {@code ApplicationAdminPermission} instance for {@code checkPermission} * call. * * @param application the tareget of the operation, it must not be * {@code null} * @param actions the required operation. it must not be {@code null} * @throws NullPointerException if any of the arguments is null. */ public ApplicationAdminPermission(ApplicationDescriptor application, String actions) { super(application.getApplicationId()); if (application == null || actions == null) throw new NullPointerException("ApplicationDescriptor and action string cannot be null!"); this.filter = application.getApplicationId(); this.applicationDescriptor = application; this.actions = actions; init(); }
isLaunchableSpecific(); // checks if the ApplicationDescriptor was return delegate.schedule(scheduleId, arguments, topic, eventFilter, recurring); } catch (SecurityException se) { isLaunchableSpecific(); /* check whether the bundle was uninstalled */
/** * Constructs the {@code ApplicationDescriptor}. * * @param applicationId The identifier of the application. Its value is also * available as the {@code service.pid} service property of this * {@code ApplicationDescriptor} service. This parameter must not be * {@code null}. * @throws NullPointerException if the specified {@code applicationId} is * null. */ protected ApplicationDescriptor(String applicationId) { if (null == applicationId) { throw new NullPointerException("Application ID must not be null!"); } this.pid = applicationId; try { delegate = new Delegate(); delegate.setApplicationDescriptor(this, applicationId); } catch (Exception e) { // Too bad ... e.printStackTrace(); System.err.println("No implementation available for ApplicationDescriptor, property is: " + Delegate.cName); } }
delegate = new Delegate(); delegate.setApplicationHandle(this, descriptor.delegate); } catch (Exception e) {
public boolean equals(Object with) { if (with == null || !(with instanceof ApplicationAdminPermission)) return false; ApplicationAdminPermission other = (ApplicationAdminPermission) with; // Compare actions: if (other.actionsVector.size() != actionsVector.size()) return false; for (int i = 0; i != actionsVector.size(); i++) if (!other.actionsVector.contains(actionsVector.get(i))) return false; return equal(this.filter, other.filter) && equal(this.applicationDescriptor, other.applicationDescriptor) && equal(this.applicationID, other.applicationID); }
/** * This method can be used in the {@link java.security.ProtectionDomain} * implementation in the {@code implies} method to insert the application ID * of the current application into the permission being checked. This * enables the evaluation of the {@code <<SELF>>} pseudo targets. * * @param applicationId the ID of the current application. * @return the permission updated with the ID of the current application */ public ApplicationAdminPermission setCurrentApplicationId(String applicationId) { ApplicationAdminPermission newPerm = null; if (this.applicationDescriptor == null) { try { newPerm = new ApplicationAdminPermission(this.filter, this.actions); } catch (InvalidSyntaxException e) { throw new RuntimeException(e); /* this can never happen */ } } else newPerm = new ApplicationAdminPermission(this.applicationDescriptor, this.actions); newPerm.applicationID = applicationId; return newPerm; }
private void init() { actionsVector = actionsVector(actions); if (actions.equals("*")) actionsVector = actionsVector(LIFECYCLE_ACTION + "," + SCHEDULE_ACTION + "," + LOCK_ACTION); else if (!ACTIONS.containsAll(actionsVector)) throw new IllegalArgumentException("Illegal action!"); applicationID = null; }
FrameworkUtil.createFilter(this.filter); // check if the filter is init();
/** * Unsets the lock state of the application. * * @throws SecurityException * if the caller doesn't have "lock" ApplicationAdminPermission * for the application. * @throws IllegalStateException * if the application descriptor is unregistered */ public final void unlock() { try { delegate.unlock(); }catch( SecurityException se ) { isLaunchableSpecific(); /* check whether the bundle was uninstalled */ /* if yes, throws IllegalStateException */ throw se; /* otherwise throw the catched SecurityException */ } unlockSpecific(); }
/** * Sets the lock state of the application. If an application is locked then * launching a new instance is not possible. It does not affect the already * launched instances. * * @throws SecurityException * if the caller doesn't have "lock" ApplicationAdminPermission * for the application. * @throws IllegalStateException * if the application descriptor is unregistered */ public final void lock() { try { delegate.lock(); }catch( SecurityException se ) { isLaunchableSpecific(); /* check whether the bundle was uninstalled */ /* if yes, throws IllegalStateException */ throw se; /* otherwise throw the catched SecurityException */ } lockSpecific(); }
/** * This contructor should be used when creating <code>ApplicationAdminPermission</code> * instance for <code>checkPermission</code> call. * @param application the tareget of the operation, it must not be <code>null</code> * @param actions the required operation. it must not be <code>null</code> * @throws NullPointerException if any of the arguments is null. */ public ApplicationAdminPermission(ApplicationDescriptor application, String actions) { super(application.getApplicationId()); if( application == null || actions == null ) throw new NullPointerException( "ApplicationDescriptor and action string cannot be null!" ); this.filter = application.getApplicationId(); this.applicationDescriptor = application; this.actions = actions; init(); }
public boolean equals(Object o) { if (!(o instanceof SignerWrapper)) return false; SignerWrapper other = (SignerWrapper) o; ApplicationDescriptor matchAppDesc = (ApplicationDescriptor) (appDesc != null ? appDesc : other.appDesc); String matchPattern = appDesc != null ? other.pattern : pattern; return matchAppDesc.matchDNChain(matchPattern); } }
public boolean equals(Object with) { if( with == null || !(with instanceof ApplicationAdminPermission) ) return false; ApplicationAdminPermission other = (ApplicationAdminPermission)with; // Compare actions: if( other.actionsVector.size() != actionsVector.size() ) return false; for( int i=0; i != actionsVector.size(); i++ ) if( !other.actionsVector.contains( actionsVector.get( i ) ) ) return false; return equal(this.filter, other.filter ) && equal(this.applicationDescriptor, other.applicationDescriptor) && equal(this.applicationID, other.applicationID); }